aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-03 23:00:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-03 23:00:48 +0000
commit6fdca0e1f8352a102f4f0cea0dc29c2209182b15 (patch)
treef4f772967b65dde0857176810979e193c937a7fb
parent53202857c60214d80950a975e6e52aebf30bd16a (diff)
Fix for PR3841: follow gcc's example and fall back to the system
stdint.h unless we are freestanding. Any suggestions here are welcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70806 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Headers/stdint.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h
index 46eff354ed..a7020d838e 100644
--- a/lib/Headers/stdint.h
+++ b/lib/Headers/stdint.h
@@ -22,8 +22,15 @@
*
\*===----------------------------------------------------------------------===*/
-#ifndef __STDINT_H
-#define __STDINT_H
+#ifndef __CLANG_STDINT_H
+#define __CLANG_STDINT_H
+
+/* If we're hosted, fall back to the system's stdint.h, which might have
+ * additional definitions.
+ */
+#if __STDC_HOSTED__
+# include_next <stdint.h>
+#else
/* We currently only support targets with power of two, 2s complement integers.
*/
@@ -221,4 +228,5 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define INTMAX_C(v) (v##LL)
#define UINTMAX_C(v) (v##ULL)
-#endif /* __STDINT_H */
+#endif /* __STDC_HOSTED__ */
+#endif /* __CLANG_STDINT_H */