public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [COMMITTED] bpf: define __bpf__ as well as __BPF__ as a target macro
Date: Mon, 29 Aug 2022 17:31:00 -0700	[thread overview]
Message-ID: <CAFP8O3KpuAgMjsmfh_BxOKhjvNjTtkQxn1NUEOU3SZPY20H7Pw@mail.gmail.com> (raw)
In-Reply-To: <87edwyst58.fsf@oracle.com>

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?

  reply	other threads:[~2022-08-30  0:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 20:15 Jose E. Marchesi
2022-08-30  0:31 ` Fangrui Song [this message]
2022-08-30 16:45   ` Jose E. Marchesi
2022-08-30 17:24     ` Fangrui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFP8O3KpuAgMjsmfh_BxOKhjvNjTtkQxn1NUEOU3SZPY20H7Pw@mail.gmail.com \
    --to=maskray@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jose.marchesi@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).