From c4573875e2765595093d23b2e73cfa3a976a4ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 11 Mar 2019 19:28:37 +0000 Subject: [PATCH] Bug 1533969 - Fix build error with newer glibc. r=nbp New glibc versions provide a wrapper for gettid, which means that our stuff fails to build with: ``` /home/emilio/src/moz/gecko/js/src/util/NativeStack.cpp:28:14: error: static declaration of 'gettid' follows non-static declaration static pid_t gettid() { return syscall(__NR_gettid); } ^ /usr/include/bits/unistd_ext.h:34:16: note: previous declaration is here extern __pid_t gettid (void) __THROW; ``` Differential Revision: https://phabricator.services.mozilla.com/D22829 --HG-- extra : moz-landing-system : lando --- js/src/util/NativeStack.cpp | 2 +- tools/profiler/core/platform.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/util/NativeStack.cpp b/js/src/util/NativeStack.cpp index 57beda99c76c1..b988faee7c5b7 100644 --- a/js/src/util/NativeStack.cpp +++ b/js/src/util/NativeStack.cpp @@ -25,11 +25,7 @@ # include # include # include -static pid_t -gettid() -{ - return syscall(__NR_gettid); -} +# define gettid() static_cast(syscall(__NR_gettid)) # endif #else # error "Unsupported platform" diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index f02faf2822364..8379eb0347554 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -39,22 +39,16 @@ #include "PlatformMacros.h" #include -// We need a definition of gettid(), but glibc doesn't provide a +// We need a definition of gettid(), but old glibc versions don't provide a // wrapper for it. #if defined(__GLIBC__) #include #include -static inline pid_t gettid() -{ - return (pid_t) syscall(SYS_gettid); -} +# define gettid() static_cast(syscall(SYS_gettid)) #elif defined(GP_OS_darwin) #include #include -static inline pid_t gettid() -{ - return (pid_t) syscall(SYS_thread_selfid); -} +# define gettid() static_cast(syscall(SYS_thread_selfid)) #elif defined(GP_OS_android) #include #elif defined(GP_OS_windows)