[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 10:12:47 PDT 2018


pirama updated this revision to Diff 159330.
pirama added a comment.

Rebase


Repository:
  rC Clang

https://reviews.llvm.org/D37302

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


Index: test/Headers/float.c
===================================================================
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -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
 
 
Index: lib/Headers/float.h
===================================================================
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -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__


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37302.159330.patch
Type: text/x-patch
Size: 2237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180806/53192741/attachment-0001.bin>


More information about the cfe-commits mailing list