[Openmp-commits] [PATCH] D36343: Use va_copy instead of __va_copy to fix building libomp against musl libc

Peter Levine via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 4 17:01:52 PDT 2017


plevine created this revision.

Building libomp in Gentoo Linux with musl as libc using GCC-6.3.0 or GCC-5.4.0 results in:

  /var/tmp/portage/sys-libs/libomp-9999/work/libomp-9999/runtime/src/kmp_str.cpp:171:28: error: ‘__va_copy’ was not declared in this scope
         __va_copy(_args, args); // Make copy of args.
                              ^

musl had previously provided `__va_copy` but has since relegated it only for scenarios in which `__GNUC__ < 3`, in favor of using `va_copy` (see http://git.musl-libc.org/cgit/musl/commit/?id=def0af189871a499efdc9bc37438d8b20eb702ab).

Seeing as libomp source code already uses one-line, double-slash style comments which implies a dependency on at least C99 standard dialect, and that `va_copy` is a C99 standard macro, it would seem the best course of action would be to change `__va_copy` to `va_copy`.

Fixes https://bugs.llvm.org/show_bug.cgi?id=34040


https://reviews.llvm.org/D36343

Files:
  runtime/src/kmp_str.cpp


Index: runtime/src/kmp_str.cpp
===================================================================
--- runtime/src/kmp_str.cpp
+++ runtime/src/kmp_str.cpp
@@ -168,7 +168,7 @@
 
 #if !KMP_OS_WINDOWS
       va_list _args;
-      __va_copy(_args, args); // Make copy of args.
+      va_copy(_args, args); // Make copy of args.
 #define args _args // Substitute args with its copy, _args.
 #endif // KMP_OS_WINDOWS
       rc = KMP_VSNPRINTF(buffer->str + buffer->used, free, format, args);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36343.109837.patch
Type: text/x-patch
Size: 486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170805/73959128/attachment.bin>


More information about the Openmp-commits mailing list