[gdb/testsuite] Fix clone-new-thread-event.c with glibc 2.30
authorTom de Vries <tdevries@suse.de>
Tue, 14 Jul 2020 08:36:17 +0000 (10:36 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 14 Jul 2020 08:36:17 +0000 (10:36 +0200)
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.

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/ChangeLog
gdb/testsuite/gdb.threads/clone-new-thread-event.c

index 7f4b25cb521eb5528aba5875e298940c600dde4d..7690acf03385b885d54670b65d89e5f8d22d3a97 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-14  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.threads/clone-new-thread-event.c (gettid): Rename to ...
+       (local_gettid): ... this.
+       (fn): Update.
+
 2020-07-13  Sandra Loosemore  <sandra@codesourcery.com>
 
        * gdb.base/info_sources.exp: Skip directory match tests on
index 51dbb4fae6ec7a098c8f16db8e87211b9d9a89c9..b4a3c04347a8dd855bc6315a79fc22c2237dc354 100644 (file)
@@ -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;
 }