Fix compilation error on platforms where real64_t is mapped onto 'long double'
authormjsousa
Thu, 08 May 2014 12:21:48 +0100
changeset 890 499486ece119
parent 889 5f380b99e95e
child 891 58109ca87903
Fix compilation error on platforms where real64_t is mapped onto 'long double'
main.hh
stage3/constant_folding.cc
--- a/main.hh	Tue Apr 08 14:35:31 2014 +0100
+++ b/main.hh	Thu May 08 12:21:48 2014 +0100
@@ -78,14 +78,16 @@
 
 #include <float.h>
 #if    (LDBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
-  #define long_double long double
-  #define real64_t long_double /* so we can later use #if (real64_t == long_double) directives in the code! */
+  #define real64_tX long_double /* so we can later use #if (real64_t == long_double) directives in the code! */
+  #define real64_t  long double /* NOTE: no underscore '_' between 'long' and 'double' */
   #define REAL64_MAX  LDBL_MAX
 #elif  ( DBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
-  #define real64_t double
+  #define real64_tX double
+  #define real64_t  double
   #define REAL64_MAX  DBL_MAX
 #elif  ( FLT_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */
-  #define real64_t float
+  #define real64_tX float
+  #define real64_t  float
   #define REAL64_MAX  FLT_MAX
 #else 
   #error Could not find a 64 bit floating point data type on this platform. Aborting...
@@ -93,16 +95,16 @@
 
 
 #if    (LDBL_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
-  #ifndef long_double 
-    #define long_double long double
-  #endif  
-  #define real32_t long_double /* so we can later use #if (real32_t == long_double) directives in the code! */
+  #define real32_tX long_double /* so we can later use #if (real32_t == long_double) directives in the code! */
+  #define real32_t  long double /* NOTE: no underscore '_' between 'long' and 'double' */
   #define REAL32_MAX  LDBL_MAX
 #elif  ( DBL_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
-  #define real32_t double
+  #define real32_tX double
+  #define real32_t  double
   #define REAL32_MAX  DBL_MAX
 #elif  ( FLT_MANT_DIG == 24) /* NOTE: 32 bit IEC559 real has 24 bits for mantissa! */
-  #define real32_t float
+  #define real32_tX float
+  #define real32_t  float
   #define REAL32_MAX  FLT_MAX
 #else 
   #error Could not find a 32 bit floating point data type on this platform. Aborting...
--- a/stage3/constant_folding.cc	Tue Apr 08 14:35:31 2014 +0100
+++ b/stage3/constant_folding.cc	Thu May 08 12:21:48 2014 +0100
@@ -379,14 +379,14 @@
   else ERROR;
     
   errno = 0; // since strtoXX() may legally return 0, we must set errno to 0 to detect errors correctly!
-  #if    (real64_t  == float)
+  #if    (real64_tX  == float)
     ret = strtof(str.c_str(),  &endptr);
-  #elif  (real64_t  == double)
+  #elif  (real64_tX  == double)
     ret = strtod(str.c_str(),  &endptr);
-  #elif  (real64_t  == long_double)
+  #elif  (real64_tX  == long_double)
     ret = strtold(str.c_str(), &endptr);
   #else 
-    #error Could not determine which data type is being used for real64_t (defined in absyntax.hh). Aborting!
+    #error Could not determine which data type is being used for real64_t (defined in main.hh). Aborting!
   #endif
   if (overflow != NULL)
     *overflow = (errno == ERANGE);