From: Edward Liaw <edliaw@google.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: shuah@kernel.org, "Mickaël Salaün" <mic@digikod.net>,
"Günther Noack" <gnoack@google.com>,
"Christian Brauner" <brauner@kernel.org>,
"Richard Cochran" <richardcochran@gmail.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Muhammad Usama Anjum" <usama.anjum@collabora.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kernel-team@android.com, linux-security-module@vger.kernel.org,
netdev@vger.kernel.org, linux-riscv@lists.infradead.org,
bpf@vger.kernel.org
Subject: Re: [PATCH v3 03/68] selftests: Compile with -D_GNU_SOURCE when including lib.mk
Date: Thu, 9 May 2024 15:58:35 -0700 [thread overview]
Message-ID: <CAG4es9Xv0Pwst+b0mre2g+QkBGoQS0cWj4xizRt+cHFJ0BTDaQ@mail.gmail.com> (raw)
In-Reply-To: <0e196143-c0bf-4d70-9735-7e6d9a69ea8f@nvidia.com>
On Thu, May 9, 2024 at 2:25 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> On 5/9/24 12:57 PM, Edward Liaw wrote:
> > lib.mk will add -D_GNU_SOURCE to CFLAGS by default. This will make it
> > unnecessary to add #define _GNU_SOURCE in the source code.
> >
> > Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX")
> > Suggested-by: John Hubbard <jhubbard@nvidia.com>
> > Signed-off-by: Edward Liaw <edliaw@google.com>
> > ---
> > tools/testing/selftests/Makefile | 4 ++--
> > tools/testing/selftests/lib.mk | 5 ++++-
> > 2 files changed, 6 insertions(+), 3 deletions(-)
> >
>
> Hi Edward,
>
> This looks good, with one small refactoring opportunity remaining, though:
>
> > diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> > index f0431e6cb67e..9039f3709aff 100644
> > --- a/tools/testing/selftests/Makefile
> > +++ b/tools/testing/selftests/Makefile
> > @@ -170,11 +170,11 @@ ifneq ($(KBUILD_OUTPUT),)
> > # $(realpath ...) resolves symlinks
> > abs_objtree := $(realpath $(abs_objtree))
> > BUILD := $(abs_objtree)/kselftest
> > - KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_objtree}/usr/include
> > + KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
> > else
> > BUILD := $(CURDIR)
> > abs_srctree := $(shell cd $(top_srcdir) && pwd)
> > - KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_srctree}/usr/include
> > + KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
>
> As mentioned in [1] (but there are a lot of patches to manage here, and
> I think it got overlooked), you could factor out the duplicated
> -D_GNU_SOURCE items into a single place:
Hi John,
Here I'm reverting the change I made to the Makefile in patch 1/68,
since -D_GNU_SOURCE is being added directly to CFLAGS now, I didn't
think it was necessary to add it to KHDR_INCLUDES anymore. I would
have merged the two patches together, but since the first and second
patches from v2 were already merged, I thought I should leave them in
the series.
Thanks,
Edward
>
> [1]
> https://lore.kernel.org/all/ac8c217e-4109-4ca7-a7dd-fc4fc8b0a4de@nvidia.com/
>
> thanks,
> --
> John Hubbard
> NVIDIA
>
> > DEFAULT_INSTALL_HDR_PATH := 1
> > endif
> >
> > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> > index 3023e0e2f58f..e782f4c96aee 100644
> > --- a/tools/testing/selftests/lib.mk
> > +++ b/tools/testing/selftests/lib.mk
> > @@ -67,7 +67,7 @@ MAKEFLAGS += --no-print-directory
> > endif
> >
> > ifeq ($(KHDR_INCLUDES),)
> > -KHDR_INCLUDES := -D_GNU_SOURCE -isystem $(top_srcdir)/usr/include
> > +KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
> > endif
> >
> > # In order to use newer items that haven't yet been added to the user's system
> > @@ -188,6 +188,9 @@ endef
> > clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
> > $(CLEAN)
> >
> > +# Build with _GNU_SOURCE by default
> > +CFLAGS += -D_GNU_SOURCE
> > +
> > # Enables to extend CFLAGS and LDFLAGS from command line, e.g.
> > # make USERCFLAGS=-Werror USERLDFLAGS=-static
> > CFLAGS += $(USERCFLAGS)
>
>
next prev parent reply other threads:[~2024-05-09 22:59 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 19:57 [PATCH v3 00/68] Define _GNU_SOURCE for sources using Edward Liaw
2024-05-09 19:57 ` [PATCH v3 01/68] selftests: Compile kselftest headers with -D_GNU_SOURCE Edward Liaw
2024-05-09 19:57 ` [PATCH v3 02/68] selftests/sgx: Include KHDR_INCLUDES in Makefile Edward Liaw
2024-05-09 19:57 ` [PATCH v3 03/68] selftests: Compile with -D_GNU_SOURCE when including lib.mk Edward Liaw
2024-05-09 21:25 ` John Hubbard
2024-05-09 22:58 ` Edward Liaw [this message]
2024-05-09 19:57 ` [PATCH v3 04/68] selftests/arm64: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:57 ` [PATCH v3 05/68] selftests/arm64: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:57 ` [PATCH v3 06/68] selftests/bpf: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:57 ` [PATCH v3 07/68] selftests/breakpoints: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 08/68] selftests/cachestat: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 09/68] selftests/capabilities: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 10/68] selftests/cgroup: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 11/68] selftests/clone3: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 12/68] selftests/core: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 13/68] selftests/damon: " Edward Liaw
2024-05-09 20:31 ` SeongJae Park
2024-05-09 21:19 ` Edward Liaw
2024-05-09 19:58 ` [PATCH v3 14/68] selftests/drivers: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 15/68] selftests/exec: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 16/68] selftests/fchmodat2: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 17/68] selftests/filelock: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 18/68] selftests/filesystems: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 19/68] selftests/firmware: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 20/68] selftests/fpu: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 21/68] selftests/futex: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 22/68] selftests/futex: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 23/68] selftests/intel_pstate: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 24/68] selftests/iommu: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 25/68] selftests/ipc: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 26/68] selftests/kcmp: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 27/68] selftests/landlock: " Edward Liaw
2024-05-13 5:11 ` Mickaël Salaün
2024-05-09 19:58 ` [PATCH v3 28/68] selftests/lsm: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 29/68] selftests/membarrier: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 30/68] selftests/memfd: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 31/68] selftests/mincore: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 32/68] selftests/mm: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 33/68] selftests/mount: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 34/68] selftests/mount_setattr: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 35/68] selftests/move_mount_set_group: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 36/68] selftests/mqueue: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 37/68] selftests/net: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 38/68] selftests/net: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 39/68] selftests/nolibc: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 40/68] selftests/nsfs: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 41/68] selftests/openat2: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 42/68] selftests/perf_events: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 43/68] selftests/pid_namespace: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 44/68] selftests/pidfd: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 45/68] selftests/ptrace: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 46/68] selftests/powerpc: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 47/68] selftests/proc: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 48/68] selftests/proc: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 49/68] selftests/ptp: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 50/68] selftests/resctrl: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 22:22 ` Reinette Chatre
2024-05-09 19:58 ` [PATCH v3 51/68] selftests/riscv: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 52/68] selftests/riscv: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 53/68] selftests/rlimits: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 54/68] selftests/rseq: " Edward Liaw
2024-05-09 20:16 ` Mathieu Desnoyers
2024-05-09 21:19 ` Edward Liaw
2024-05-09 19:58 ` [PATCH v3 55/68] selftests/safesetid: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 56/68] selftests/sched: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 57/68] selftests/seccomp: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 58/68] selftests/sigaltstack: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 59/68] selftests/splice: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 60/68] selftests/syscall_user_dispatch: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 61/68] selftests/thermal: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 62/68] selftests/timens: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 63/68] selftests/tmpfs: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 64/68] selftests/uevent: Drop define _GNU_SOURCE Edward Liaw
2024-05-09 19:58 ` [PATCH v3 65/68] selftests/user_events: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 66/68] selftests/vDSO: " Edward Liaw
2024-05-09 19:58 ` [PATCH v3 67/68] selftests/wireguard: " Edward Liaw
2024-05-09 19:59 ` [PATCH v3 68/68] selftests/x86: " Edward Liaw
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=CAG4es9Xv0Pwst+b0mre2g+QkBGoQS0cWj4xizRt+cHFJ0BTDaQ@mail.gmail.com \
--to=edliaw@google.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=gnoack@google.com \
--cc=hawk@kernel.org \
--cc=jhubbard@nvidia.com \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@android.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=richardcochran@gmail.com \
--cc=shuah@kernel.org \
--cc=usama.anjum@collabora.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).