浏览代码

Cleanup foo.h headers and __config to work in C

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252274 91177308-0d34-0410-b5e6-96231b3b80d8
Eric Fiselier 9 年之前
父节点
当前提交
38e7a30143
共有 6 个文件被更改,包括 24 次插入3 次删除
  1. 9 2
      include/__config
  2. 4 0
      include/errno.h
  3. 4 0
      include/float.h
  4. 1 1
      include/inttypes.h
  5. 4 0
      include/setjmp.h
  6. 2 0
      include/stdlib.h

+ 9 - 2
include/__config

@@ -11,10 +11,16 @@
 #ifndef _LIBCPP_CONFIG
 #ifndef _LIBCPP_CONFIG
 #define _LIBCPP_CONFIG
 #define _LIBCPP_CONFIG
 
 
-#if !defined(_MSC_VER) || defined(__clang__)
+#if defined(_MSC_VER) && !defined(__clang__)
+#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#endif
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #pragma GCC system_header
 #pragma GCC system_header
 #endif
 #endif
 
 
+#ifdef __cplusplus
+
 #ifdef __GNUC__
 #ifdef __GNUC__
 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
 #else
 #else
@@ -526,7 +532,6 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
 #elif defined(_LIBCPP_MSVC)
 #elif defined(_LIBCPP_MSVC)
 
 
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
-#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
@@ -811,4 +816,6 @@ extern "C" void __sanitizer_annotate_contiguous_container(
 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
 #endif
 #endif
 
 
+#endif // __cplusplus
+
 #endif // _LIBCPP_CONFIG
 #endif // _LIBCPP_CONFIG

+ 4 - 0
include/errno.h

@@ -31,6 +31,8 @@ Macros:
 
 
 #include_next <errno.h>
 #include_next <errno.h>
 
 
+#ifdef __cplusplus
+
 #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
 #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
 
 
 #ifdef ELAST
 #ifdef ELAST
@@ -391,4 +393,6 @@ static const int __elast2 = 105;
 #define EMLINK 9979
 #define EMLINK 9979
 #endif
 #endif
 
 
+#endif // __cplusplus
+
 #endif  // _LIBCPP_ERRNO_H
 #endif  // _LIBCPP_ERRNO_H

+ 4 - 0
include/float.h

@@ -68,6 +68,8 @@ Macros:
 
 
 #include_next <float.h>
 #include_next <float.h>
 
 
+#ifdef __cplusplus
+
 #ifndef FLT_EVAL_METHOD
 #ifndef FLT_EVAL_METHOD
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
 #endif
 #endif
@@ -76,4 +78,6 @@ Macros:
 #define DECIMAL_DIG __DECIMAL_DIG__
 #define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 #endif
 
 
+#endif // __cplusplus
+
 #endif  // _LIBCPP_FLOAT_H
 #endif  // _LIBCPP_FLOAT_H

+ 1 - 1
include/inttypes.h

@@ -246,6 +246,6 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
 #undef imaxabs
 #undef imaxabs
 #undef imaxdiv
 #undef imaxdiv
 
 
-#endif
+#endif // __cplusplus
 
 
 #endif  // _LIBCPP_INTTYPES_H
 #endif  // _LIBCPP_INTTYPES_H

+ 4 - 0
include/setjmp.h

@@ -34,8 +34,12 @@ void longjmp(jmp_buf env, int val);
 
 
 #include_next <setjmp.h>
 #include_next <setjmp.h>
 
 
+#ifdef __cplusplus
+
 #ifndef setjmp
 #ifndef setjmp
 #define setjmp(env) setjmp(env)
 #define setjmp(env) setjmp(env)
 #endif
 #endif
 
 
+#endif // __cplusplus
+
 #endif  // _LIBCPP_SETJMP_H
 #endif  // _LIBCPP_SETJMP_H

+ 2 - 0
include/stdlib.h

@@ -94,6 +94,7 @@ void *aligned_alloc(size_t alignment, size_t size);                       // C11
 #include_next <stdlib.h>
 #include_next <stdlib.h>
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
+
 extern "C++" {
 extern "C++" {
 
 
 #ifdef _LIBCPP_MSVCRT
 #ifdef _LIBCPP_MSVCRT
@@ -123,6 +124,7 @@ inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEX
 #endif // _LIBCPP_MSVCRT / __sun__ / _AIX
 #endif // _LIBCPP_MSVCRT / __sun__ / _AIX
 
 
 }  // extern "C++"
 }  // extern "C++"
+
 #endif  // __cplusplus
 #endif  // __cplusplus
 
 
 #endif  // _LIBCPP_STDLIB_H
 #endif  // _LIBCPP_STDLIB_H