]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix pthread_setname_np build error
authorTom Tromey <tromey@adacore.com>
Wed, 18 Dec 2019 18:45:51 +0000 (11:45 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 18 Dec 2019 18:54:01 +0000 (11:54 -0700)
My earlier patch to fix the pthread_setname_np build error on macOS
was incorrect.  While the macOS man page claims that
pthread_setname_np returns void, in <pthread.h> it is actually
declared returning "int".  I knew this earlier, but must have made
some mistake when preparing the patch for submission (perhaps when
removing the templates?).

This patch re-fixes the bug.  I'm also applying it to the 9.1 branch.

Tested by building on macOS High Sierra.

gdb/ChangeLog
2019-12-18  Tom Tromey  <tromey@adacore.com>

PR build/25268:
* gdbsupport/thread-pool.c (set_thread_name): Expect "int" return
type on macOS.  Add comment.

Change-Id: Ib09da6ac33958a0d843f65df2a528112356e7de6

gdb/ChangeLog
gdb/gdbsupport/thread-pool.c

index 6174da4e8da73cf0a0ce49b43195343add3a5624..c8431b309fa7a0dec80de81eeb27655c182b2778 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-18  Tom Tromey  <tromey@adacore.com>
+
+       PR build/25268:
+       * gdbsupport/thread-pool.c (set_thread_name): Expect "int" return
+       type on macOS.  Add comment.
+
 2019-12-18  Tom Tromey  <tromey@adacore.com>
 
        PR build/25250:
index f6ea6d8b1711cd239c0487e8a2fd90f9427b77cc..37d1d97d16ab1def92afd32bef9f64f513ba101f 100644 (file)
@@ -53,8 +53,10 @@ set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
   set_name (pthread_self (), name);
 }
 
+/* The macOS man page says that pthread_setname_np returns "void", but
+   the headers actually declare it returning "int".  */
 static void
-set_thread_name (void (*set_name) (const char *), const char *name)
+set_thread_name (int (*set_name) (const char *), const char *name)
 {
   set_name (name);
 }