r354691 - [clang] Only provide C11 features in <float.h> starting with C++17

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 22 12:48:54 PST 2019


Author: ldionne
Date: Fri Feb 22 12:48:54 2019
New Revision: 354691

URL: http://llvm.org/viewvc/llvm-project?rev=354691&view=rev
Log:
[clang] Only provide C11 features in <float.h> starting with C++17

Summary:
In r353970, I enabled those features in C++11 and above. To be strictly
conforming, those features should only be enabled in C++17 and above.

Reviewers: jfb, eli.friedman

Subscribers: jkorous, dexonsmith, libcxx-commits

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

Modified:
    cfe/trunk/lib/Headers/float.h
    cfe/trunk/test/Headers/float.c

Modified: cfe/trunk/lib/Headers/float.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/float.h?rev=354691&r1=354690&r2=354691&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/float.h (original)
+++ cfe/trunk/lib/Headers/float.h Fri Feb 22 12:48:54 2019
@@ -78,7 +78,7 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
 #    undef FLT_TRUE_MIN
 #    undef DBL_TRUE_MIN
 #    undef LDBL_TRUE_MIN
@@ -137,7 +137,7 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__
 #  define DBL_TRUE_MIN __DBL_DENORM_MIN__
 #  define LDBL_TRUE_MIN __LDBL_DENORM_MIN__

Modified: cfe/trunk/test/Headers/float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/float.c?rev=354691&r1=354690&r2=354691&view=diff
==============================================================================
--- cfe/trunk/test/Headers/float.c (original)
+++ cfe/trunk/test/Headers/float.c Fri Feb 22 12:48:54 2019
@@ -45,7 +45,7 @@
 #endif
 
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
     #ifndef FLT_DECIMAL_DIG
         #error "Mandatory macro FLT_DECIMAL_DIG is missing."
     #elif   FLT_DECIMAL_DIG < 6
@@ -215,7 +215,7 @@ _Static_assert(FLT_MANT_DIG == __FLT_MAN
 _Static_assert(DBL_MANT_DIG == __DBL_MANT_DIG__, "");
 _Static_assert(LDBL_MANT_DIG == __LDBL_MANT_DIG__, "");
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201103L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 201703L
 _Static_assert(FLT_DECIMAL_DIG == __FLT_DECIMAL_DIG__, "");
 _Static_assert(DBL_DECIMAL_DIG == __DBL_DECIMAL_DIG__, "");
 _Static_assert(LDBL_DECIMAL_DIG == __LDBL_DECIMAL_DIG__, "");




More information about the cfe-commits mailing list