[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-28 Thread David Tenty via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG27ee91162dd3: [AIX][clang] include_next through clang 
provided float.h (authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D117935?vs=404083=404085#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

Files:
  clang/lib/Headers/float.h
  clang/test/Headers/Inputs/include/float.h
  clang/test/Headers/float-aix.c


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify 
-internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(FLOAT_LOCAL_DEF, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define FLOAT_LOCAL_DEF 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||
\
+ defined(_AIX)) && 
\
 __STDC_HOSTED__ && __has_include_next()
 
 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
@@ -37,7 +38,9 @@
 #  undef FLT_MANT_DIG
 #  undef DBL_MANT_DIG
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201103L
+#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201103L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef DECIMAL_DIG
 #  endif
 #  undef FLT_DIG
@@ -64,7 +67,9 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201703L
+#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201703L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef FLT_TRUE_MIN
 #undef DBL_TRUE_MIN
 #undef LDBL_TRUE_MIN
@@ -87,7 +92,9 @@
 #define DBL_MANT_DIG __DBL_MANT_DIG__
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 
@@ -123,7 +130,9 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__
 #  define DBL_TRUE_MIN __DBL_DENORM_MIN__
 #  define LDBL_TRUE_MIN __LDBL_DENORM_MIN__


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify -internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(FLOAT_LOCAL_DEF, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define FLOAT_LOCAL_DEF 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional 

[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-28 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 404083.
daltenty added a comment.

Use more unique macro name


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

Files:
  clang/lib/Headers/float.h
  clang/test/Headers/Inputs/include/float.h
  clang/test/Headers/float-aix.c


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify 
-internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(ERSATZ_SYSTEM_FLOAT_H, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define ERSATZ_SYSTEM_FLOAT_H 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||
\
+ defined(_AIX)) && 
\
 __STDC_HOSTED__ && __has_include_next()
 
 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
@@ -37,7 +38,9 @@
 #  undef FLT_MANT_DIG
 #  undef DBL_MANT_DIG
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201103L
+#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201103L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef DECIMAL_DIG
 #  endif
 #  undef FLT_DIG
@@ -64,7 +67,9 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201703L
+#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201703L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef FLT_TRUE_MIN
 #undef DBL_TRUE_MIN
 #undef LDBL_TRUE_MIN
@@ -87,7 +92,9 @@
 #define DBL_MANT_DIG __DBL_MANT_DIG__
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 
@@ -123,7 +130,9 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__
 #  define DBL_TRUE_MIN __DBL_DENORM_MIN__
 #  define LDBL_TRUE_MIN __LDBL_DENORM_MIN__


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify -internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(ERSATZ_SYSTEM_FLOAT_H, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define ERSATZ_SYSTEM_FLOAT_H 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||\
+ defined(_AIX)) &&  

[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-26 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.

LGTM with minor comment.




Comment at: clang/test/Headers/Inputs/include/float.h:2
+#pragma once
+#define FLOAT_LOCAL_DEF 1

Minor nit: Suggest to use more explicit name.



Comment at: clang/test/Headers/float-aix.c:6
+
+_Static_assert(FLOAT_LOCAL_DEF, "");




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 402720.
daltenty added a comment.

Address review comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

Files:
  clang/lib/Headers/float.h
  clang/test/Headers/Inputs/include/float.h
  clang/test/Headers/float-aix.c


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify 
-internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(FLOAT_LOCAL_DEF, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define FLOAT_LOCAL_DEF 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||
\
+ defined(_AIX)) && 
\
 __STDC_HOSTED__ && __has_include_next()
 
 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
@@ -37,7 +38,9 @@
 #  undef FLT_MANT_DIG
 #  undef DBL_MANT_DIG
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201103L
+#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201103L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef DECIMAL_DIG
 #  endif
 #  undef FLT_DIG
@@ -64,7 +67,9 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201703L
+#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201703L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef FLT_TRUE_MIN
 #undef DBL_TRUE_MIN
 #undef LDBL_TRUE_MIN
@@ -87,7 +92,9 @@
 #define DBL_MANT_DIG __DBL_MANT_DIG__
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 
@@ -123,7 +130,9 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__
 #  define DBL_TRUE_MIN __DBL_DENORM_MIN__
 #  define LDBL_TRUE_MIN __LDBL_DENORM_MIN__


Index: clang/test/Headers/float-aix.c
===
--- /dev/null
+++ clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify -internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(FLOAT_LOCAL_DEF, "");
Index: clang/test/Headers/Inputs/include/float.h
===
--- /dev/null
+++ clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define FLOAT_LOCAL_DEF 1
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||\
+ defined(_AIX)) && 

[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/Headers/float.h:40-41
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 #undef DECIMAL_DIG

Do not remove scoping indentation; see below where reformatting actively causes 
confusion.



Comment at: clang/lib/Headers/float.h:68-69
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L || defined(_AIX) && defined(_ALL_SOURCE)
 #undef FLT_TRUE_MIN

Change in indentation makes it look like (an casual reading) that the 
corresponding `#endif` is the one on line 80.



Comment at: clang/lib/Headers/float.h:92-93
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 #  define DECIMAL_DIG __DECIMAL_DIG__

I understand why `_ALL_SOURCE` matters when `__STDC_HOSTED__` does not evaluate 
to 0, but the general logic of the file is that platform extensions are not 
present for freestanding. The interfaces injected via `_ALL_SOURCE` are 
platform extensions.



Comment at: clang/lib/Headers/float.h:129-130
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L || defined(_AIX) && defined(_ALL_SOURCE)
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__

Same comment as above. Applies also to similar changes in the rest of the file.



Comment at: clang/test/Headers/float.c:7
 // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++17 -ffreestanding %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify -std=c99 
-ffreestanding -D_ALL_SOURCE %s
 // expected-no-diagnostics

The changes to the test are for functionality that I do not believe should be 
present (see earlier comments).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

More comments may follow, but didn't want to delay the first one.




Comment at: clang/lib/Headers/float.h:20-21
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
-__STDC_HOSTED__ && __has_include_next()
+#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) || 
\
+defined(_AIX) && __STDC_HOSTED__ && __has_include_next()
 

Fix the binding of the `&&` and remove the preexisting excess parentheses.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D117935: [AIX][clang] include_next through clang provided float.h

2022-01-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast updated this revision to Diff 402156.
hubert.reinterpretcast edited the summary of this revision.
hubert.reinterpretcast added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Refresh with full context


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117935/new/

https://reviews.llvm.org/D117935

Files:
  clang/lib/Headers/float.h
  clang/test/Headers/float.c

Index: clang/test/Headers/float.c
===
--- clang/test/Headers/float.c
+++ clang/test/Headers/float.c
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++11 -ffreestanding %s
 // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++14 -ffreestanding %s
 // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++17 -ffreestanding %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify -std=c99 -ffreestanding -D_ALL_SOURCE %s
 // expected-no-diagnostics
 
 /* Basic floating point conformance checks against:
@@ -45,7 +46,8 @@
 #endif
 
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201703L || defined(_AIX) && defined(_ALL_SOURCE)
 #ifndef FLT_DECIMAL_DIG
 #error "Mandatory macro FLT_DECIMAL_DIG is missing."
 #elif   FLT_DECIMAL_DIG < 6
@@ -101,7 +103,8 @@
 #endif
 
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 #ifndef DECIMAL_DIG
 #error "Mandatory macro DECIMAL_DIG is missing."
 #elif   DECIMAL_DIG < 10
@@ -215,13 +218,15 @@
 _Static_assert(DBL_MANT_DIG == __DBL_MANT_DIG__, "");
 _Static_assert(LDBL_MANT_DIG == __LDBL_MANT_DIG__, "");
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201703L || defined(_AIX) && defined(_ALL_SOURCE)
 _Static_assert(FLT_DECIMAL_DIG == __FLT_DECIMAL_DIG__, "");
 _Static_assert(DBL_DECIMAL_DIG == __DBL_DECIMAL_DIG__, "");
 _Static_assert(LDBL_DECIMAL_DIG == __LDBL_DECIMAL_DIG__, "");
 #endif
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 _Static_assert(DECIMAL_DIG == __DECIMAL_DIG__, "");
 #endif
 
Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -14,11 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
-__STDC_HOSTED__ && __has_include_next()
+#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) || \
+defined(_AIX) && __STDC_HOSTED__ && __has_include_next()
 
 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
  * of #include_next to keep Metrowerks compilers happy. Avoid this
@@ -37,7 +37,8 @@
 #  undef FLT_MANT_DIG
 #  undef DBL_MANT_DIG
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 #undef DECIMAL_DIG
 #  endif
 #  undef FLT_DIG
@@ -64,7 +65,8 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201703L || defined(_AIX) && defined(_ALL_SOURCE)
 #undef FLT_TRUE_MIN
 #undef DBL_TRUE_MIN
 #undef LDBL_TRUE_MIN
@@ -87,7 +89,8 @@
 #define DBL_MANT_DIG __DBL_MANT_DIG__
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||\
+__cplusplus >= 201103L || defined(_AIX) && defined(_ALL_SOURCE)
 #  define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 
@@ -123,7 +126,8 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
+#if __STDC_VERSION__ >= 201112L ||