Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Fix clone-new-thread-event.c with glibc 2.30
@ 2020-07-14  8:36 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-07-14  8:36 UTC (permalink / raw)
  To: gdb-patches

Hi,

Starting glibc 2.30, unistd.h declares gettid (for _GNU_SOURCE).

This clashes with a static gettid in test source
clone-new-thread-event.c:
...
gdb compile failed, gdb.threads/clone-new-thread-event.c:46:1: error: \
  static declaration of 'gettid' follows non-static declaration
   46 | gettid (void)
      | ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from gdb.threads/clone-new-thread-event.c:27:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' \
  was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
...

Fix this by renaming the static gettid to local_gettid.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix clone-new-thread-event.c with glibc 2.30

gdb/testsuite/ChangeLog:

2020-07-14  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/clone-new-thread-event.c (gettid): Rename to ...
	(local_gettid): ... this.
	(fn): Update.

---
 gdb/testsuite/gdb.threads/clone-new-thread-event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/clone-new-thread-event.c b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
index 51dbb4fae6..b4a3c04347 100644
--- a/gdb/testsuite/gdb.threads/clone-new-thread-event.c
+++ b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
@@ -43,7 +43,7 @@ tkill (int lwpid, int signo)
 }
 
 static pid_t
-gettid (void)
+local_gettid (void)
 {
   return syscall (__NR_gettid);
 }
@@ -51,7 +51,7 @@ gettid (void)
 static int
 fn (void *unused)
 {
-  tkill (gettid (), SIGUSR1);
+  tkill (local_gettid (), SIGUSR1);
   return 0;
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-14  8:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  8:36 [committed][gdb/testsuite] Fix clone-new-thread-event.c with glibc 2.30 Tom de Vries

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