]> granicus.if.org Git - clang/commitdiff
C++ really shouldn't check these #defines, thanks to Howard
authorChris Lattner <sabre@nondot.org>
Sat, 7 Feb 2009 22:21:31 +0000 (22:21 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 7 Feb 2009 22:21:31 +0000 (22:21 +0000)
for pointing this out!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64037 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/stdint.h

index ec8810a840a1d8a1a7b588223f7b1046c94caf78..8841ed06e59f612c32da59e407f76c641805e953 100644 (file)
@@ -100,10 +100,11 @@ typedef __UINTMAX_TYPE__ uintmax_t;
  * C99 7.18.2.2 Limits of minimum-width integer types.
  * Since we map these directly onto fixed-sized types, these values the same.
  * C99 7.18.2.3 Limits of fastest minimum-width integer types.
+ *
+ * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
+ * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
  */
 
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
-
 #define INT8_MAX    127
 #define INT8_MIN  (-128)
 #define UINT8_MAX   255
@@ -202,12 +203,11 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #define WCHAR_MIN (-__WCHAR_MAX__-1)
 #endif
 
-#endif /* C++ needs __STDC_LIMIT_MACROS. */
-
-/* C99 7.18.4 Macros for minimum-width integer constants. */
-
-/* C99 Footnote 220: C++ requires __STDC_CONSTANT_MACROS. */
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+/* C99 7.18.4 Macros for minimum-width integer constants.
+ *
+ * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
+ * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
+ */
 
 #define INT8_C(v)   (v)
 #define UINT8_C(v)  (v##U)
@@ -226,6 +226,4 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #define INTMAX_C(v)  (v##LL)
 #define UINTMAX_C(v) (v##ULL)
 
-#endif  /* C++ requires __STDC_CONSTANT_MACROS */
-
 #endif /* __STDINT_H */