r363939 - AIX system headers need stdint.h and inttypes.h to be re-enterable

Xing Xue via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 20 08:36:32 PDT 2019


Author: xingxue
Date: Thu Jun 20 08:36:32 2019
New Revision: 363939

URL: http://llvm.org/viewvc/llvm-project?rev=363939&view=rev
Log:
AIX system headers need stdint.h and inttypes.h to be re-enterable

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

Modified:
    cfe/trunk/lib/Headers/inttypes.h
    cfe/trunk/lib/Headers/stdint.h

Modified: cfe/trunk/lib/Headers/inttypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/inttypes.h?rev=363939&r1=363938&r2=363939&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/inttypes.h (original)
+++ cfe/trunk/lib/Headers/inttypes.h Thu Jun 20 08:36:32 2019
@@ -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

Modified: cfe/trunk/lib/Headers/stdint.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stdint.h?rev=363939&r1=363938&r2=363939&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/stdint.h (original)
+++ cfe/trunk/lib/Headers/stdint.h Thu Jun 20 08:36:32 2019
@@ -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.




More information about the cfe-commits mailing list