bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ftoastr: work around compiler bug in IBM xlc 12.1


From: Paul Eggert
Subject: [PATCH] ftoastr: work around compiler bug in IBM xlc 12.1
Date: Fri, 30 May 2014 09:42:30 -0700

* lib/ftoastr.h (_GL_FLT_PREC_BOUND, _GL_DBL_PREC_BOUND)
(_GL_LDBL_PREC_BOUND): Make these macros, not enums, to work
around a compiler bug in IBM xlc 12.1.0.0: it complains
'"ftoastr.c", line 80.37: 1506-045 (S) Undeclared identifier
_GL_FLT_PREC_BOUND.'
---
 ChangeLog     |  9 +++++++++
 lib/ftoastr.h | 17 +++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6b94234..5bb9d97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-05-30  Paul Eggert  <address@hidden>
+
+       ftoastr: work around compiler bug in IBM xlc 12.1
+       * lib/ftoastr.h (_GL_FLT_PREC_BOUND, _GL_DBL_PREC_BOUND)
+       (_GL_LDBL_PREC_BOUND): Make these macros, not enums, to work
+       around a compiler bug in IBM xlc 12.1.0.0: it complains
+       '"ftoastr.c", line 80.37: 1506-045 (S) Undeclared identifier
+       _GL_FLT_PREC_BOUND.'
+
 2014-05-30  Kieran Colford  <address@hidden>
 
        valgrind-tests: fixed misleading help message
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index 6236292..26cad73 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -72,12 +72,13 @@ enum
 
 /* _GL_FLT_PREC_BOUND is an upper bound on the precision needed to
    represent a float value without losing information.  Likewise for
-   _GL_DBL_PREC_BOUND and double, and _GL_LDBL_PREC_BOUND and long double.  */
+   _GL_DBL_PREC_BOUND and double, and _GL_LDBL_PREC_BOUND and long double.
+   These are macros, not enums, to work around a bug in IBM xlc 12.1.  */
 
 #if FLT_RADIX == 10 /* decimal floating point */
- enum {  _GL_FLT_PREC_BOUND =  FLT_MANT_DIG };
- enum {  _GL_DBL_PREC_BOUND =  DBL_MANT_DIG };
- enum { _GL_LDBL_PREC_BOUND = LDBL_MANT_DIG };
+# define  _GL_FLT_PREC_BOUND  FLT_MANT_DIG
+# define  _GL_DBL_PREC_BOUND  DBL_MANT_DIG
+# define _GL_LDBL_PREC_BOUND LDBL_MANT_DIG
 #else
 
 /* An upper bound on the number of bits needed to represent a single
@@ -95,13 +96,13 @@ enum
    DIG digits.  For why the "+ 1" is needed, see "Binary to Decimal
    Conversion" in David Goldberg's paper "What Every Computer
    Scientist Should Know About Floating-Point Arithmetic"
-   <http://docs.sun.com/source/806-3568/ncg_goldberg.html>.  */
+   <http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>.  */
 # define _GL_FLOAT_PREC_BOUND(dig) \
    (INT_BITS_STRLEN_BOUND ((dig) * _GL_FLOAT_DIG_BITS_BOUND) + 1)
 
- enum {  _GL_FLT_PREC_BOUND = _GL_FLOAT_PREC_BOUND ( FLT_MANT_DIG) };
- enum {  _GL_DBL_PREC_BOUND = _GL_FLOAT_PREC_BOUND ( DBL_MANT_DIG) };
- enum { _GL_LDBL_PREC_BOUND = _GL_FLOAT_PREC_BOUND (LDBL_MANT_DIG) };
+# define  _GL_FLT_PREC_BOUND _GL_FLOAT_PREC_BOUND ( FLT_MANT_DIG)
+# define  _GL_DBL_PREC_BOUND _GL_FLOAT_PREC_BOUND ( DBL_MANT_DIG)
+# define _GL_LDBL_PREC_BOUND _GL_FLOAT_PREC_BOUND (LDBL_MANT_DIG)
 #endif
 
 
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]