Re2: Re: rsync v2.6.9: small patch fixing NORETURN failures

ThMO thmo-13 at gmx.de
Wed Nov 22 18:50:06 GMT 2006


Hello Wayne,

> On Tue, Nov 21, 2006 at 09:45:01PM +0100, ThMO wrote:
> > as of gcc v2.7.2.1, the noreturn attribute needs to be given
> > *after* the prototype declaration and not before, but for
> > gcc v3.x, things changed for this attribute again, since
> > gcc v2.5.x did it the way, newer gcc versions prefer it...
> 
> Thanks for pointing this out.  The proto.h file is auto-generated, so we
> can't make changes to it that don't come from the C source.  I decided
> to just commit a change that makes older gcc versions ignore the
> NORETURN attribute.

it *might* be possible, that gcc v[34].x will accept this attribute
after the function prototype like v2.[7-9].x does too, which would
mean, you could use the attributes for all but very old gcc's (OTOH
I should use nowadays the oldest gcc version so far... ;-)

As far as the autogenerated proto.h is concerned, since the NORETURN
prepends the function declaration too (which is a no-op in my case)
this script could automatically append a NORETURN2 then.

The reason is very obvious, if you'll have a look at the generated
assembly file, you'll notice, that mostly some calls like

  while ( 42)
    {
      ...
      if ( ...)
        NORETURN fatal( ...);
      ...
    }

inside loops will result in much better code, as gcc already does
for functions like exit(), where gcc knows, that this function will
never return when called - the NORETURN macro in this case, and I'm
using this gimmick heavily myself, is simply a comment, signifying
things...

Just a thought.

THX for listening.

CU Tom.
(Thomas M.Ott)
Germany


More information about the rsync mailing list