* [Qemu-devel] [PATCH] softfloat: fix for C99
@ 2011-12-27 15:11 Avi Kivity
2011-12-27 16:15 ` Andreas Färber
2012-03-17 16:24 ` Blue Swirl
0 siblings, 2 replies; 6+ messages in thread
From: Avi Kivity @ 2011-12-27 15:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber
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 <avi@redhat.com>
---
fpu/softfloat-specialize.h | 8 ++++----
fpu/softfloat.h | 2 ++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index c5e2dab..4902450 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -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
@@ -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
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..2ce4110 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -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;
@@ -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.
--
1.7.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] softfloat: fix for C99
2011-12-27 15:11 [Qemu-devel] [PATCH] softfloat: fix for C99 Avi Kivity
@ 2011-12-27 16:15 ` Andreas Färber
2012-02-09 16:20 ` Andreas Färber
2012-03-17 16:24 ` Blue Swirl
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Färber @ 2011-12-27 16:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
Am 27.12.2011 16:11, schrieb Avi Kivity:
> 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 <avi@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
For the record, tested with --extra-cflags=-std=gnu99.
> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
> index c5e2dab..4902450 100644
> --- a/fpu/softfloat-specialize.h
> +++ b/fpu/softfloat-specialize.h
> @@ -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);
Calling it init_floatx80 would avoid the line break, but I'm okay with
it either way.
Thanks,
Andreas
$ gcc --version
gcc (SUSE Linux) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] softfloat: fix for C99
2011-12-27 16:15 ` Andreas Färber
@ 2012-02-09 16:20 ` Andreas Färber
2012-02-09 16:38 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Färber @ 2012-02-09 16:20 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
Am 27.12.2011 17:15, schrieb Andreas Färber:
> Am 27.12.2011 16:11, schrieb Avi Kivity:
>> C99 appears to consider compound literals as non-constants, and complains
>> when they are used in static initializers. Switch to ordinary initializer
>> syntax.
>>
Reported-by: Andreas Färber <andreas.faerber@web.de>
>> Signed-off-by: Avi Kivity <avi@redhat.com>
>
> Acked-by: Andreas Färber <afaerber@suse.de>
>
> For the record, tested with --extra-cflags=-std=gnu99.
>
>> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
>> index c5e2dab..4902450 100644
>> --- a/fpu/softfloat-specialize.h
>> +++ b/fpu/softfloat-specialize.h
>> @@ -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);
>
> Calling it init_floatx80 would avoid the line break, but I'm okay with
> it either way.
Ping! Avi, you didn't indicate whether you were going to simplify this
patch or whether you're waiting for someone to apply it as is?
Regards,
Andreas
>
> Thanks,
> Andreas
>
>
> $ gcc --version
> gcc (SUSE Linux) 4.6.2
> Copyright (C) 2011 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] softfloat: fix for C99
2012-02-09 16:20 ` Andreas Färber
@ 2012-02-09 16:38 ` Avi Kivity
2012-03-16 10:01 ` Andreas Färber
0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2012-02-09 16:38 UTC (permalink / raw)
To: Andreas Färber, Blue Swirl, Anthony Liguori; +Cc: qemu-devel
On 02/09/2012 06:20 PM, Andreas Färber wrote:
> Am 27.12.2011 17:15, schrieb Andreas Färber:
> > Am 27.12.2011 16:11, schrieb Avi Kivity:
> >> C99 appears to consider compound literals as non-constants, and complains
> >> when they are used in static initializers. Switch to ordinary initializer
> >> syntax.
> >>
>
> Reported-by: Andreas Färber <andreas.faerber@web.de>
>
> >> Signed-off-by: Avi Kivity <avi@redhat.com>
> >
> > Acked-by: Andreas Färber <afaerber@suse.de>
> >
> > For the record, tested with --extra-cflags=-std=gnu99.
> >
> >> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
> >> index c5e2dab..4902450 100644
> >> --- a/fpu/softfloat-specialize.h
> >> +++ b/fpu/softfloat-specialize.h
> >> @@ -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);
> >
> > Calling it init_floatx80 would avoid the line break, but I'm okay with
> > it either way.
>
> Ping! Avi, you didn't indicate whether you were going to simplify this
> patch or whether you're waiting for someone to apply it as is?
>
Actually I forgot all about it. If everyone's okay with it as is I'd
like it to be applied, otherwise I'll respin. Copying some maintainers
completely at random.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] softfloat: fix for C99
2012-02-09 16:38 ` Avi Kivity
@ 2012-03-16 10:01 ` Andreas Färber
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2012-03-16 10:01 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, Lee Essen, Avi Kivity, Anthony Liguori
Am 09.02.2012 17:38, schrieb Avi Kivity:
> On 02/09/2012 06:20 PM, Andreas Färber wrote:
>> Am 27.12.2011 17:15, schrieb Andreas Färber:
>>> Am 27.12.2011 16:11, schrieb Avi Kivity:
>>>> C99 appears to consider compound literals as non-constants, and complains
>>>> when they are used in static initializers. Switch to ordinary initializer
>>>> syntax.
>>>>
>>
>> Reported-by: Andreas Färber <andreas.faerber@web.de>
>>
>>>> Signed-off-by: Avi Kivity <avi@redhat.com>
>>>
>>> Acked-by: Andreas Färber <afaerber@suse.de>
>>>
>>> For the record, tested with --extra-cflags=-std=gnu99.
>>>
>>>> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
>>>> index c5e2dab..4902450 100644
>>>> --- a/fpu/softfloat-specialize.h
>>>> +++ b/fpu/softfloat-specialize.h
>>>> @@ -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);
>>>
>>> Calling it init_floatx80 would avoid the line break, but I'm okay with
>>> it either way.
>>
>> Ping! Avi, you didn't indicate whether you were going to simplify this
>> patch or whether you're waiting for someone to apply it as is?
>>
>
> Actually I forgot all about it. If everyone's okay with it as is I'd
> like it to be applied, otherwise I'll respin. Copying some maintainers
> completely at random.
Ping?
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] softfloat: fix for C99
2011-12-27 15:11 [Qemu-devel] [PATCH] softfloat: fix for C99 Avi Kivity
2011-12-27 16:15 ` Andreas Färber
@ 2012-03-17 16:24 ` Blue Swirl
1 sibling, 0 replies; 6+ messages in thread
From: Blue Swirl @ 2012-03-17 16:24 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, Andreas Färber
Thanks, applied.
On Tue, Dec 27, 2011 at 15:11, Avi Kivity <avi@redhat.com> wrote:
> 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 <avi@redhat.com>
> ---
> fpu/softfloat-specialize.h | 8 ++++----
> fpu/softfloat.h | 2 ++
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
> index c5e2dab..4902450 100644
> --- a/fpu/softfloat-specialize.h
> +++ b/fpu/softfloat-specialize.h
> @@ -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
> @@ -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
> diff --git a/fpu/softfloat.h b/fpu/softfloat.h
> index 07c2929..2ce4110 100644
> --- a/fpu/softfloat.h
> +++ b/fpu/softfloat.h
> @@ -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;
> @@ -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.
> --
> 1.7.7.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-17 16:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-27 15:11 [Qemu-devel] [PATCH] softfloat: fix for C99 Avi Kivity
2011-12-27 16:15 ` Andreas Färber
2012-02-09 16:20 ` Andreas Färber
2012-02-09 16:38 ` Avi Kivity
2012-03-16 10:01 ` Andreas Färber
2012-03-17 16:24 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).