On Mon, Aug 29, 2022 at 1:16 PM Jose E. Marchesi via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > LLVM defines both __bpf__ and __BPF_ as target macros. > GCC was defining only __BPF__. > > This patch defines __bpf__ as a target macro for BPF. > Tested in bpf-unknown-none. > > gcc/ChangeLog: > > * config/bpf/bpf.cc (bpf_target_macros): Define __bpf__ as a > target macro. > --- > gcc/config/bpf/bpf.cc | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc > index 7e37e080808..9cb56cfb287 100644 > --- a/gcc/config/bpf/bpf.cc > +++ b/gcc/config/bpf/bpf.cc > @@ -291,6 +291,7 @@ void > bpf_target_macros (cpp_reader *pfile) > { > builtin_define ("__BPF__"); > + builtin_define ("__bpf__"); > > if (TARGET_BIG_ENDIAN) > builtin_define ("__BPF_BIG_ENDIAN__"); > -- > 2.30.2 >
Having multiple choices in this case seems to just add confusion to users and making code search slightly more inconvenient. How much code uses LLVM specific __bpf__? Can it be migrated? Should LLVM undefine the macro instead?