[Openmp-commits] [openmp] r284492 - Fix a compile error on musl-libc due to strerror_r() prototype

Michal Gorny via Openmp-commits openmp-commits at lists.llvm.org
Tue Oct 18 09:38:44 PDT 2016


Author: mgorny
Date: Tue Oct 18 11:38:44 2016
New Revision: 284492

URL: http://llvm.org/viewvc/llvm-project?rev=284492&view=rev
Log:
Fix a compile error on musl-libc due to strerror_r() prototype

Function strerror_r() has different signatures in different
implementations of libc: glibc's version returns a char*, while BSDs
and musl return a int. libomp unconditionally assumes glibc on Linux
and thus fails to compile against musl-libc. This patch addresses this
issue.

Differential Revision: https://reviews.llvm.org/D25071

Modified:
    openmp/trunk/runtime/src/kmp_i18n.c

Modified: openmp/trunk/runtime/src/kmp_i18n.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_i18n.c?rev=284492&r1=284491&r2=284492&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_i18n.c (original)
+++ openmp/trunk/runtime/src/kmp_i18n.c Tue Oct 18 11:38:44 2016
@@ -809,7 +809,7 @@ sys_error(
                 int    strerror_r( int, char *, size_t );  // XSI version
         */
 
-        #if KMP_OS_LINUX
+        #if defined(__GLIBC__) && defined(_GNU_SOURCE)
 
             // GNU version of strerror_r.
 




More information about the Openmp-commits mailing list