r339284 - [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL
Pirama Arumuga Nainar via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 13:38:38 PDT 2018
Author: pirama
Date: Wed Aug 8 13:38:38 2018
New Revision: 339284
URL: http://llvm.org/viewvc/llvm-project?rev=339284&view=rev
Log:
[Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL
Summary:
These macros are defined in the C11 standard and can be defined based on
the __*_HAS_DENORM__ default macros.
Reviewers: bruno, rsmith, doug.gregor
Subscribers: llvm-commits, enh, srhines
Differential Revision: https://reviews.llvm.org/D37302
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=339284&r1=339283&r2=339284&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/float.h (original)
+++ cfe/trunk/lib/Headers/float.h Wed Aug 8 13:38:38 2018
@@ -85,6 +85,9 @@
# undef FLT_DECIMAL_DIG
# undef DBL_DECIMAL_DIG
# undef LDBL_DECIMAL_DIG
+# undef FLT_HAS_SUBNORM
+# undef DBL_HAS_SUBNORM
+# undef LDBL_HAS_SUBNORM
# endif
#endif
@@ -141,6 +144,9 @@
# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+# define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+# define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+# define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
#endif
#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
Modified: cfe/trunk/test/Headers/float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/float.c?rev=339284&r1=339283&r2=339284&view=diff
==============================================================================
--- cfe/trunk/test/Headers/float.c (original)
+++ cfe/trunk/test/Headers/float.c Wed Aug 8 13:38:38 2018
@@ -61,6 +61,21 @@
#if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
#error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
#endif
+ #ifndef FLT_HAS_SUBNORM
+ #error "Mandatory macro FLT_HAS_SUBNORM is missing."
+ #elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+ #error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+ #endif
+ #ifndef LDBL_HAS_SUBNORM
+ #error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+ #elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+ #error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+ #endif
+ #ifndef DBL_HAS_SUBNORM
+ #error "Mandatory macro DBL_HAS_SUBNORM is missing."
+ #elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+ #error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+ #endif
#else
#ifdef FLT_DECIMAL_DIG
#error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
#ifdef LDBL_DECIMAL_DIG
#error "Macro LDBL_DECIMAL_DIG should not be defined."
#endif
+ #ifdef FLT_HAS_SUBNORM
+ #error "Macro FLT_HAS_SUBNORM should not be defined."
+ #endif
+ #ifdef DBL_HAS_SUBNORM
+ #error "Macro DBL_HAS_SUBNORM should not be defined."
+ #endif
+ #ifdef LDBL_HAS_SUBNORM
+ #error "Macro LDBL_HAS_SUBNORM should not be defined."
+ #endif
#endif
More information about the cfe-commits
mailing list