summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-25 20:13:30 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-25 20:13:30 +0000
commit341e8de0e5f10ad68bae8e32df9de857489a8ba6 (patch)
tree937aa10144a4433575e7d13aac3f7cf16deecfa4
parentf976f8216322eddcfeb7e29158e659e002f22011 (diff)
downloadmpfr-341e8de0e5f10ad68bae8e32df9de857489a8ba6.tar.gz
[src/mpfr-gmp.h] For _MPFR_IEEE_FLOATS, changed bit-field type from
unsigned long, which is implementation-defined, to unsigned int. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10377 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mpfr-gmp.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h
index 4f4f6901d..df437cff1 100644
--- a/src/mpfr-gmp.h
+++ b/src/mpfr-gmp.h
@@ -442,6 +442,21 @@ typedef const mp_limb_t *mpfr_limb_srcptr;
float endianness, this is true everywhere we know of and it'd be a fairly
strange system that did anything else. */
+/* Note for MPFR: building with "gcc -std=c89 -pedantic -pedantic-errors"
+ fails if the bit-field type is unsigned long:
+
+ error: type of bit-field '...' is a GCC extension [-Wpedantic]
+
+ Though with -std=c99 no errors are obtained, this is still an extension
+ in C99, which says:
+
+ A bit-field shall have a type that is a qualified or unqualified version
+ of _Bool, signed int, unsigned int, or some other implementation-defined
+ type.
+
+ So, unsigned int should be better.
+*/
+
#ifndef _MPFR_IEEE_FLOATS
#ifdef HAVE_DOUBLE_IEEE_LITTLE_ENDIAN
@@ -450,10 +465,10 @@ union mpfr_ieee_double_extract
{
struct
{
- unsigned long manl:32;
- unsigned long manh:20;
- unsigned long exp:11;
- unsigned long sig:1;
+ unsigned int manl:32;
+ unsigned int manh:20;
+ unsigned int exp:11;
+ unsigned int sig:1;
} s;
double d;
};
@@ -465,10 +480,10 @@ union mpfr_ieee_double_extract
{
struct
{
- unsigned long sig:1;
- unsigned long exp:11;
- unsigned long manh:20;
- unsigned long manl:32;
+ unsigned int sig:1;
+ unsigned int exp:11;
+ unsigned int manh:20;
+ unsigned int manl:32;
} s;
double d;
};