Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH 1/1] tools feature gettid: Undef _GNU_SOURCE before defining it
@ 2026-09-28 12:02 Arnaldo Carvalho de Melo
  2026-09-28 12:04 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-09-28 12:02 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Adrian Hunter, James Clark, Jiri Olsa, Namhyung Kim,
	linux-perf-users

Since most of tools/build/feature/test-*.c feature tests are included in
tools/build/feature/test-all.c, we can't just define _GNU_SOURCE as it
may already been defined and this will break the build with:

  acme@alta:~$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
  In file included from test-all.c:26:
  test-gettid.c:3:9: error: "_GNU_SOURCE" redefined [-Werror]
      3 | #define _GNU_SOURCE
        |         ^~~~~~~~~~~
  In file included from /usr/include/python3.13/pyconfig.h:9,
                   from /usr/include/python3.13/Python.h:14,
                   from test-python-module.c:2,
                   from test-all.c:14:
  /usr/include/aarch64-linux-gnu/python3.13/pyconfig.h:1810:10: note: this is the location of the previous definition
   1810 | # define _GNU_SOURCE 1
        |          ^~~~~~~~~~~
  cc1: all warnings being treated as errors
  acme@alta:~$

I.e. pyconfig.h is included by the new test-python-module.c, that is at
the start of test-all.c, defines _GNU_SOURCE, noticed on Debian 13
(/usr/include/aarch64-linux-gnu/python3.13/pyconfig.h, libpython
3.13.5-2+deb13u5), and then test-all.c includes test-gettid.c that was
defining it as well, undef it first as does several other tests.

Fixes: 1b7e0280e247b93d ("perf Makefile: Update Python script installation path")
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/feature/test-gettid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/build/feature/test-gettid.c b/tools/build/feature/test-gettid.c
index ef24e42d3f1b877d..a8fdb26196697b66 100644
--- a/tools/build/feature/test-gettid.c
+++ b/tools/build/feature/test-gettid.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 // Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
+#undef _GNU_SOURCE
 #define _GNU_SOURCE
 #include <unistd.h>
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-28 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28 12:02 [PATCH 1/1] tools feature gettid: Undef _GNU_SOURCE before defining it Arnaldo Carvalho de Melo
2026-09-28 12:04 ` sashiko-bot
2026-09-28 12:09 ` Arnaldo Carvalho de Melo
2026-09-28 15:12 ` Ian Rogers
2026-09-28 16:30   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox