From: Tom Tromey Date: Wed, 18 Dec 2019 18:45:51 +0000 (-0700) Subject: Fix pthread_setname_np build error X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27e4fac77ea57b288ac1e08d936d9a8fdc01a1ee;p=binutils-gdb.git Fix pthread_setname_np build error 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 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 PR build/25268: * gdbsupport/thread-pool.c (set_thread_name): Expect "int" return type on macOS. Add comment. Change-Id: Ib09da6ac33958a0d843f65df2a528112356e7de6 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 53885e13fc7..8e38ada5ea0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-12-18 Tom Tromey + + PR build/25268: + * gdbsupport/thread-pool.c (set_thread_name): Expect "int" return + type on macOS. Add comment. + 2019-12-18 Simon Marchi * c-lang.c (c_get_string, asm_language_defn): Remove space diff --git a/gdb/gdbsupport/thread-pool.c b/gdb/gdbsupport/thread-pool.c index cd548956951..a8c5fb774d9 100644 --- a/gdb/gdbsupport/thread-pool.c +++ b/gdb/gdbsupport/thread-pool.c @@ -49,8 +49,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". */ ATTRIBUTE_UNUSED 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); }