[solaris] Convert the support library to C++ to fix -std=c++11 build
authorMichal Gorny <mgorny@gentoo.org>
Tue, 18 Oct 2016 16:54:59 +0000 (16:54 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Tue, 18 Oct 2016 16:54:59 +0000 (16:54 +0000)
Convert the Solaris xlocale.c compatibility library from plain C to C++
in order to fix the build failures caused by the addition of -std=c++11
to LIBCXX_COMPILE_FLAGS. The additional flag got propagated to the C
file, resulting in error with strict compilers.

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

llvm-svn: 284494

libcxx/lib/CMakeLists.txt
libcxx/src/support/solaris/xlocale.cpp [moved from libcxx/src/support/solaris/xlocale.c with 98% similarity]

index ea703f5..1e7c6d4 100644 (file)
@@ -6,7 +6,7 @@ if(WIN32)
   file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
   list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
-  file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c)
+  file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp)
   list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
 endif()
 
similarity index 98%
rename from libcxx/src/support/solaris/xlocale.c
rename to libcxx/src/support/solaris/xlocale.cpp
index 802829c..6eaf317 100644 (file)
@@ -14,6 +14,7 @@
 #include <stdio.h>
 #include <sys/localedef.h>
 
+extern "C" {
 
 int isxdigit_l(int __c, locale_t __l) {
     return isxdigit(__c);
@@ -63,4 +64,6 @@ struct lconv *localeconv_l(locale_t __l) {
   return localeconv();
 }
 
+};
+
 #endif // __sun__