On Mon, Dec 30, 2024 at 5:26 PM Ihor Solodrai <ihor.solodrai@xxxxx> wrote: > > > > > > > #if STDC_VERSION < 202311L > > > enum { > > > false = 0, > > > true = 1, > > > }; > > > #endif > > > > > > Any drawbacks to this? > > > > > > By special hacking this specific enum in bpftool ? > > Feels like overkill when just adding -std=gnu17 will do. > > Yeah. I've tried both the flag and a btf_dump hack today, and the hack > is indeed an overkill, assuming we don't care about generating > C23-compilant vmlinux.h. To conditionalize the declarations both the > enum and typedef _Bool have to be matched, so it's actually two hacks. > Although we do use hacks like this, noticed an interesting example > today [1]. > > Regardless of how the bool-related error is fixed (with STDC_VERSION > condition or std flag), I get the same int64 errors with GCC > 15-20241229 when building selftests/bpf [2]. > > [1] https://github.com/libbpf/libbpf/blob/master/src/btf_dump.c#L1198-L1201 This is more of a workaround for differences in gcc behavior. There is no way to cure it with a flag. While in this case -std will work. So use it. No need for extra hacks. There is no objective to produce c23 compliant vmlinux.h at the moment. > [2] https://gist.github.com/theihor/7e3341c5a1e1209a744994143abd9e62 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h vs /ci/workspace/bpfgcc.20241229/lib/gcc/bpf-unknown-none/15.0.0/include/stdint.h looks like a configuration issue. We can skip test_cls_redirect*.c for now.