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 <s...@weilnetz.de>
Seems like a sensible optimization,
Reviewed-by: Andreas Färber <afaer...@suse.de>
Andreas