qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Eric Blake <eblake@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Laurent Vivier <laurent@vivier.eu>,
	qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] softfloat: rename make_float[x80|128]_init to const_float[x80|128]
Date: Tue, 19 Sep 2017 20:45:56 +0200	[thread overview]
Message-ID: <9234d486-d4cb-c10e-da8c-48ca800e31a3@redhat.com> (raw)
In-Reply-To: <e67746f6-6855-c761-f4ff-dd6b19391eda@redhat.com>

On 09/19/17 19:39, Eric Blake wrote:
> On 09/19/2017 11:30 AM, Richard Henderson wrote:
>> On 09/18/2017 05:46 AM, Laurent Vivier wrote:
>>> Redefine make_floatx80() and make_float128() as make_float16(),
>>> make_float32() and make_float64() using a variable and not only
>>> a cast.
> 
>>> -#define make_floatx80(exp, mant) ((floatx80) { mant, exp })
>>> -#define make_floatx80_init(exp, mant) { .low = mant, .high = exp }
>>> +#define make_floatx80(exp, mant) __extension__ \
>>> +    ({ floatx80 f80_val = { .low = mant, .high = exp }; f80_val; })
>>> +#define const_floatx80(exp, mant) { .low = mant, .high = exp }
> 
>>
>> I don't like this part -- (type){ init } is a standard C99 compound literal.
>> There's no point using a gcc extension instead.
> 
> The C99 compound literal is not a const initializer in all situations,
> though :(  Here's another thread where we had a similar discussion, but
> there, the solution was to just make the macro behave as an initializer
> (which is C99 compliant, but loses some type safety) instead of relying
> on a gcc extension:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2017-08/msg06566.html
> 
> I suspect you're running into the same issues that Laszlo already helped
> us understand regarding QLit.
> 

Thanks for the CC! I don't have much context, but the patch looks quite
isolated.

I think I agree with Richard here -- I don't think there's any reason to
change the replacement text of make_floatx80.

The patch names make_float64() as an earlier example (already using
__extension__), but I don't understand why make_float64() was written
that way. ... It seems to go back to ancient commit f090c9d4ad58 ("Add
strict checking mode for softfp code.", 2007-11-18). Was C99 support
(esp. compound literals) spotty in gcc back then?

Not having much background, I'd suggest the opposite change -- replace
the statement-expression in make_float64() with a compound literal.

Thanks
Laszlo

  reply	other threads:[~2017-09-19 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 10:46 [Qemu-devel] [PATCH] softfloat: rename make_float[x80|128]_init to const_float[x80|128] Laurent Vivier
2017-09-18 12:47 ` Philippe Mathieu-Daudé
2017-09-19 16:30 ` Richard Henderson
2017-09-19 17:39   ` Eric Blake
2017-09-19 18:45     ` Laszlo Ersek [this message]
2017-09-19 19:31       ` Laurent Vivier
2017-09-19 19:06     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9234d486-d4cb-c10e-da8c-48ca800e31a3@redhat.com \
    --to=lersek@redhat.com \
    --cc=armbru@redhat.com \
    --cc=aurelien@aurel32.net \
    --cc=eblake@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).