From: Stefan Weil <sw@weilnetz.de>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Blue Swirl <blauwirbel@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] Add support for target helper functions which don't return
Date: Mon, 19 Mar 2012 12:06:53 +0100 [thread overview]
Message-ID: <4F67134D.5030504@weilnetz.de> (raw)
In-Reply-To: <4F670E50.1020705@suse.de>
[-- Attachment #1: Type: text/plain, Size: 928 bytes --]
Am 19.03.2012 11:45, schrieb Andreas Färber:
> Am 18.03.2012 23:16, schrieb Stefan Weil:
>> Most functions which handle exceptions don't return.
>>
>> With a compiler attribute (added by QEMU_NORETURN),
>> gcc can optimize the code.
>
> Do you have any numbers?
Yes, of course: for (;;) { printf("%ld\n", random()); } :-)
To be honest, I don't expect large savings of code (some bytes for the
function return
which is no longer needed), nor will there be a huge gain in execution
speed.
It's more for documentation purposes that this attribute is useful here.
|We might also add a compiler warning for missing attributes some day
(-Wsuggest-attribute=||noreturn|) - it is surprising how many functions
never return!
Regards,
Stefan
>
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>
> Seems like a sensible optimization,
>
> Reviewed-by: Andreas Färber <afaerber@suse.de>
>
> Andreas
[-- Attachment #2: Type: text/html, Size: 1831 bytes --]
prev parent reply other threads:[~2012-03-19 11:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-18 22:16 [Qemu-devel] [PATCH 1/3] Add support for target helper functions which don't return Stefan Weil
2012-03-18 22:16 ` [Qemu-devel] [PATCH 2/3] target-mips: Add compiler attribute to some " Stefan Weil
2012-03-19 10:46 ` Andreas Färber
2012-03-18 22:16 ` [Qemu-devel] [PATCH 3/3] target-sparc: " Stefan Weil
2012-03-19 10:45 ` [Qemu-devel] [PATCH 1/3] Add support for target helper " Andreas Färber
2012-03-19 11:06 ` Stefan Weil [this message]
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=4F67134D.5030504@weilnetz.de \
--to=sw@weilnetz.de \
--cc=afaerber@suse.de \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.