]> granicus.if.org Git - clang/commitdiff
AIX system headers need stdint.h and inttypes.h to be re-enterable
authorXing Xue <xingxue@outlook.com>
Thu, 20 Jun 2019 15:36:32 +0000 (15:36 +0000)
committerXing Xue <xingxue@outlook.com>
Thu, 20 Jun 2019 15:36:32 +0000 (15:36 +0000)
Summary:
AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined so that limit macro definitions such as UINT32_MAX can be found. This patch attempts to allow that on AIX.

Reviewers: hubert.reinterpretcast, jasonliu, mclow.lists, EricWF

Reviewed by: hubert.reinterpretcast, mclow.lists

Subscribers: jfb, jsji, christof, cfe-commits, libcxx-commits, llvm-commits

Tags: #LLVM, #clang, #libc++

Differential Revision: https://reviews.llvm.org/D59253

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

lib/Headers/inttypes.h
lib/Headers/stdint.h

index cd2c70a5316249f80e6a373c6b8ce70ab60ef03b..1c894c4aca4975d7439ed3abda221818dbc57e94 100644 (file)
@@ -7,7 +7,12 @@
 \*===----------------------------------------------------------------------===*/
 
 #ifndef __CLANG_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define __CLANG_INTTYPES_H
+#endif
 
 #if defined(_MSC_VER) && _MSC_VER < 1800
 #error MSVC does not have inttypes.h prior to Visual Studio 2013
index 47fc97670f1407c2e9d8078f96b29849bc64156e..192f653e95a11757b17d0d4c4d869a5aca8e919c 100644 (file)
@@ -7,7 +7,12 @@
 \*===----------------------------------------------------------------------===*/
 
 #ifndef __CLANG_STDINT_H
+// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
 #define __CLANG_STDINT_H
+#endif
 
 /* If we're hosted, fall back to the system's stdint.h, which might have
  * additional definitions.