Skip to content

Commit

Permalink
softfloat: fix for C99
Browse files Browse the repository at this point in the history
C99 appears to consider compound literals as non-constants, and complains
when they are used in static initializers.  Switch to ordinary initializer
syntax.

Signed-off-by: Avi Kivity <[email protected]>
Acked-by: Andreas Färber <[email protected]>
Reported-by: Andreas Färber <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
  • Loading branch information
avikivity authored and blueswirl committed Mar 17, 2012
1 parent 6344d92 commit 3bf7e40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fpu/softfloat-specialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 ));
#define floatx80_default_nan_low LIT64( 0xC000000000000000 )
#endif

const floatx80 floatx80_default_nan = make_floatx80(floatx80_default_nan_high,
floatx80_default_nan_low);
const floatx80 floatx80_default_nan
= make_floatx80_init(floatx80_default_nan_high, floatx80_default_nan_low);

/*----------------------------------------------------------------------------
| The pattern for a default generated quadruple-precision NaN. The `high' and
Expand All @@ -104,8 +104,8 @@ const floatx80 floatx80_default_nan = make_floatx80(floatx80_default_nan_high,
#define float128_default_nan_low LIT64( 0x0000000000000000 )
#endif

const float128 float128_default_nan = make_float128(float128_default_nan_high,
float128_default_nan_low);
const float128 float128_default_nan
= make_float128_init(float128_default_nan_high, float128_default_nan_low);

/*----------------------------------------------------------------------------
| Raises the exceptions specified by `flags'. Floating-point traps can be
Expand Down
2 changes: 2 additions & 0 deletions fpu/softfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ typedef struct {
uint16_t high;
} floatx80;
#define make_floatx80(exp, mant) ((floatx80) { mant, exp })
#define make_floatx80_init(exp, mant) { .low = mant, .high = exp }
typedef struct {
#ifdef HOST_WORDS_BIGENDIAN
uint64_t high, low;
Expand All @@ -137,6 +138,7 @@ typedef struct {
#endif
} float128;
#define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ })
#define make_float128_init(high_, low_) { .high = high_, .low = low_ }

/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point underflow tininess-detection mode.
Expand Down

0 comments on commit 3bf7e40

Please sign in to comment.