Author: rsmith Date: Thu Oct 8 15:36:30 2015 New Revision: 249738 URL: http://llvm.org/viewvc/llvm-project?rev=249738&view=rev Log: Split <ctype.h> out of <cctype>.
Added: libcxx/trunk/include/ctype.h - copied, changed from r249736, libcxx/trunk/include/cctype Modified: libcxx/trunk/include/cctype libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp Modified: libcxx/trunk/include/cctype URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cctype?rev=249738&r1=249737&r2=249738&view=diff ============================================================================== --- libcxx/trunk/include/cctype (original) +++ libcxx/trunk/include/cctype Thu Oct 8 15:36:30 2015 @@ -37,10 +37,6 @@ int toupper(int c); #include <__config> #include <ctype.h> -#if defined(_LIBCPP_MSVCRT) -#include "support/win32/support.h" -#include "support/win32/locale_win32.h" -#endif // _LIBCPP_MSVCRT #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -48,33 +44,19 @@ int toupper(int c); _LIBCPP_BEGIN_NAMESPACE_STD -#undef isalnum using ::isalnum; -#undef isalpha using ::isalpha; -#undef isblank using ::isblank; -#undef iscntrl using ::iscntrl; -#undef isdigit using ::isdigit; -#undef isgraph using ::isgraph; -#undef islower using ::islower; -#undef isprint using ::isprint; -#undef ispunct using ::ispunct; -#undef isspace using ::isspace; -#undef isupper using ::isupper; -#undef isxdigit using ::isxdigit; -#undef tolower using ::tolower; -#undef toupper using ::toupper; _LIBCPP_END_NAMESPACE_STD Copied: libcxx/trunk/include/ctype.h (from r249736, libcxx/trunk/include/cctype) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ctype.h?p2=libcxx/trunk/include/ctype.h&p1=libcxx/trunk/include/cctype&r1=249736&r2=249738&rev=249738&view=diff ============================================================================== --- libcxx/trunk/include/cctype (original) +++ libcxx/trunk/include/ctype.h Thu Oct 8 15:36:30 2015 @@ -1,5 +1,5 @@ // -*- C++ -*- -//===---------------------------- cctype ----------------------------------===// +//===---------------------------- ctype.h ---------------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,14 +8,11 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_CCTYPE -#define _LIBCPP_CCTYPE +#ifndef _LIBCPP_CTYPE_H +#define _LIBCPP_CTYPE_H /* - cctype synopsis - -namespace std -{ + ctype.h synopsis int isalnum(int c); int isalpha(int c); @@ -31,52 +28,41 @@ int isupper(int c); int isxdigit(int c); int tolower(int c); int toupper(int c); - -} // std */ #include <__config> -#include <ctype.h> -#if defined(_LIBCPP_MSVCRT) -#include "support/win32/support.h" -#include "support/win32/locale_win32.h" -#endif // _LIBCPP_MSVCRT +#include_next <ctype.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD +#ifdef __cplusplus + +#if defined(_LIBCPP_MSVCRT) +// We support including .h headers inside 'extern "C"' contexts, so switch +// back to C++ linkage before including these C++ headers. +extern "C++" { + #include "support/win32/support.h" + #include "support/win32/locale_win32.h" +} +#endif // _LIBCPP_MSVCRT #undef isalnum -using ::isalnum; #undef isalpha -using ::isalpha; #undef isblank -using ::isblank; #undef iscntrl -using ::iscntrl; #undef isdigit -using ::isdigit; #undef isgraph -using ::isgraph; #undef islower -using ::islower; #undef isprint -using ::isprint; #undef ispunct -using ::ispunct; #undef isspace -using ::isspace; #undef isupper -using ::isupper; #undef isxdigit -using ::isxdigit; #undef tolower -using ::tolower; #undef toupper -using ::toupper; -_LIBCPP_END_NAMESPACE_STD +#endif -#endif // _LIBCPP_CCTYPE +#endif // _LIBCPP_CTYPE_H Modified: libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp?rev=249738&r1=249737&r2=249738&view=diff ============================================================================== --- libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp (original) +++ libcxx/trunk/test/std/strings/c.strings/cctype.pass.cpp Thu Oct 8 15:36:30 2015 @@ -86,18 +86,18 @@ int main() static_assert((std::is_same<decltype(std::tolower(0)), int>::value), ""); static_assert((std::is_same<decltype(std::toupper(0)), int>::value), ""); - assert(isalnum('a')); - assert(isalpha('a')); - assert(isblank(' ')); - assert(!iscntrl(' ')); - assert(!isdigit('a')); - assert(isgraph('a')); - assert(islower('a')); - assert(isprint('a')); - assert(!ispunct('a')); - assert(!isspace('a')); - assert(!isupper('a')); - assert(isxdigit('a')); - assert(tolower('A') == 'a'); - assert(toupper('a') == 'A'); + assert(std::isalnum('a')); + assert(std::isalpha('a')); + assert(std::isblank(' ')); + assert(!std::iscntrl(' ')); + assert(!std::isdigit('a')); + assert(std::isgraph('a')); + assert(std::islower('a')); + assert(std::isprint('a')); + assert(!std::ispunct('a')); + assert(!std::isspace('a')); + assert(!std::isupper('a')); + assert(std::isxdigit('a')); + assert(std::tolower('A') == 'a'); + assert(std::toupper('a') == 'A'); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits