netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@fomichev.me>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
	song@kernel.org, yhs@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org
Subject: Re: [PATCH bpf] selftests/bpf: Filter out _GNU_SOURCE when compiling test_cpp
Date: Fri, 26 Jul 2024 20:32:45 -0700	[thread overview]
Message-ID: <ZqRqXYljLTSKaFwz@mini-arch> (raw)
In-Reply-To: <20240726181020.19bca47d@kernel.org>

On 07/26, Jakub Kicinski wrote:
> On Fri, 26 Jul 2024 17:45:06 -0700 Andrii Nakryiko wrote:
> > or we could
> > 
> > #ifndef _GNU_SOURCE
> > #define _GNU_SOURCE
> > #endif
> > 
> > (though we have 61 places with that...) so as to not have to update
> > every target in Makefile.
> 
> AFAIU we have -D_GNU_SOURCE= twice _in the command line args_ :(
> One is from the Makefile which now always adds it to CFLAGS,
> the other is "built-in" in g++ for some weird reason.
> 
> FWIW I have added this patch to the netdev "hack queue" so no
> preference any more where the patch lands :)

Yeah, it can't be fixed with an ifdef because the conflict happens a bit
earlier:

$ echo "int main(int argc, char *argv[]){return 0;}" > test.cpp
$ clang++ -Wall -Werror -D_GNU_SOURCE= test.cpp
In file included from <built-in>:454:
<command line>:1:9: error: '_GNU_SOURCE' macro redefined [-Werror,-Wmacro-redefined]
    1 | #define _GNU_SOURCE
      |         ^
<built-in>:445:9: note: previous definition is here
  445 | #define _GNU_SOURCE 1
      |         ^
1 error generated.

  reply	other threads:[~2024-07-27  3:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25 21:40 [PATCH bpf] selftests/bpf: Filter out _GNU_SOURCE when compiling test_cpp Stanislav Fomichev
2024-07-25 22:13 ` Jakub Kicinski
2024-07-26 17:15 ` Jiri Olsa
2024-07-27  0:45 ` Andrii Nakryiko
2024-07-27  1:10   ` Jakub Kicinski
2024-07-27  3:32     ` Stanislav Fomichev [this message]
2024-07-28  4:27       ` Yonghong Song
2024-07-29 21:05 ` patchwork-bot+netdevbpf

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=ZqRqXYljLTSKaFwz@mini-arch \
    --to=sdf@fomichev.me \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yhs@fb.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 NNTP newsgroup(s).