From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9aQZ-00047v-4S for qemu-devel@nongnu.org; Mon, 19 Mar 2012 07:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9aQT-0002xl-1b for qemu-devel@nongnu.org; Mon, 19 Mar 2012 07:07:02 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:41719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9aQS-0002xc-Nt for qemu-devel@nongnu.org; Mon, 19 Mar 2012 07:06:56 -0400 Message-ID: <4F67134D.5030504@weilnetz.de> Date: Mon, 19 Mar 2012 12:06:53 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1332108964-12716-1-git-send-email-sw@weilnetz.de> <4F670E50.1020705@suse.de> In-Reply-To: <4F670E50.1020705@suse.de> Content-Type: multipart/alternative; boundary="------------010004000209050501010502" Subject: Re: [Qemu-devel] [PATCH 1/3] Add support for target helper functions which don't return List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: Blue Swirl , qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------010004000209050501010502 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Am 19.03.2012 11:45, schrieb Andreas F=E4rber: > 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=20 function return which is no longer needed), nor will there be a huge gain in execution=20 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=3D||noreturn|) - it is surprising how many functions= =20 never return! Regards, Stefan > >> >> Signed-off-by: Stefan Weil > > Seems like a sensible optimization, > > Reviewed-by: Andreas F=E4rber > > Andreas --------------010004000209050501010502 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Am 19.03.2012 11:45, schrieb Andreas F=E4rber:
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.<= br> We might also add a compiler warning for missing attributes some day
(-Wsuggest-attribute=3D
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=E4rber <afaerber@suse.de>

Andreas
--------------010004000209050501010502--