[libcxx] r284494 - [solaris] Convert the support library to C++ to fix -std=c++11 build
Michal Gorny via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 09:55:00 PDT 2016
Author: mgorny
Date: Tue Oct 18 11:54:59 2016
New Revision: 284494
URL: http://llvm.org/viewvc/llvm-project?rev=284494&view=rev
Log:
[solaris] Convert the support library to C++ to fix -std=c++11 build
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
Added:
libcxx/trunk/src/support/solaris/xlocale.cpp
- copied, changed from r284493, libcxx/trunk/src/support/solaris/xlocale.c
Removed:
libcxx/trunk/src/support/solaris/xlocale.c
Modified:
libcxx/trunk/lib/CMakeLists.txt
Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=284494&r1=284493&r2=284494&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Tue Oct 18 11:54:59 2016
@@ -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()
Removed: libcxx/trunk/src/support/solaris/xlocale.c
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/solaris/xlocale.c?rev=284493&view=auto
==============================================================================
--- libcxx/trunk/src/support/solaris/xlocale.c (original)
+++ libcxx/trunk/src/support/solaris/xlocale.c (removed)
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifdef __sun__
-
-#include "support/solaris/xlocale.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/localedef.h>
-
-
-int isxdigit_l(int __c, locale_t __l) {
- return isxdigit(__c);
-}
-
-int iswxdigit_l(wint_t __c, locale_t __l) {
- return isxdigit(__c);
-}
-
-// FIXME: This disregards the locale, which is Very Wrong
-#define vsnprintf_l(__s, __n, __l, __format, __va) \
- vsnprintf(__s, __n, __format, __va)
-
-int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...)
-{
- va_list __va;
- va_start(__va, __format);
- int __res = vsnprintf_l(__s, __n , __l, __format, __va);
- va_end(__va);
- return __res;
-}
-
-int asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- // FIXME:
- int __res = vasprintf(__s, __format, __va);
- va_end(__va);
- return __res;
-}
-
-int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
- // FIXME:
- int __res = vsscanf(__s, __format, __va);
- va_end(__va);
- return __res;
-}
-
-size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb,
- size_t __max, mbstate_t *__ps, locale_t __loc) {
- return mbrtowc(__pwc, __pmb, __max, __ps);
-}
-
-struct lconv *localeconv_l(locale_t __l) {
- return localeconv();
-}
-
-#endif // __sun__
Copied: libcxx/trunk/src/support/solaris/xlocale.cpp (from r284493, libcxx/trunk/src/support/solaris/xlocale.c)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/solaris/xlocale.cpp?p2=libcxx/trunk/src/support/solaris/xlocale.cpp&p1=libcxx/trunk/src/support/solaris/xlocale.c&r1=284493&r2=284494&rev=284494&view=diff
==============================================================================
--- libcxx/trunk/src/support/solaris/xlocale.c (original)
+++ libcxx/trunk/src/support/solaris/xlocale.cpp Tue Oct 18 11:54:59 2016
@@ -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__
More information about the cfe-commits
mailing list