Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute
Home

[Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Thu, 6 Mar 2003 04:02:55 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Thu, Mar 06, 2003 at 03:25:27AM -0800, Jason Short wrote:
> 
> [rp - Wed Mar  5 19:45:48 2003]:
> 
> > On Fri, Feb 28, 2003 at 02:14:37AM -0800, Raimar Falke wrote:
> > > On Fri, Feb 28, 2003 at 01:13:39AM -0800, Jason Short wrote:
> > > > Raimar Falke wrote:
> > > > > On Thu, Feb 27, 2003 at 09:19:18AM -0800, Reinier Post wrote:
> > > > 
> > > > > Next version without variadic arguments. Tested with gcc and icc6.
> > > > 
> > > > > +#define die(format, args...)    \
> > > > > +  do{                           \
> > > > > +    real_die(format , ## args); \
> > > > > +    exit(EXIT_FAILURE);         \
> > > > > +  } while(0)
> > > > > +
> > > > 
> > > > Um, those are variadic arguments.
> > > 
> > > *reading* Yes. __VA_ARGS__ is the version from C99. "## args" is the
> > > gcc extension.
> > > 
> > > So since we don't want/can require a C99 compiler I will propose again
> > > my first fix.
> > > 
> > >   Raimar
> > 
> > I do not understand.  Neither are C89 compliant.
> > We have variadic arguments of functions in the code already.
> > Keep Freeciv C89 compliant as long as you don't have an actual reason
> > to break it.  BTW I think it's ridiculous to use macros for cases
> > like this.
> 
> The issue here is with compiler warnings and gcc attributes.
> 
> die() has the gcc "noreturn" attribute, meaning gcc will be able to
> optimize things slightly better and will also change its warnings: for
> instance:

The question is what are the benefits of the "noreturn"
attribute. Optimizing things can't it be since this is an error
path. This leaves warnings which indicate that the code behind a die
isn't executed. Little value IMHO. Another benefit would be that we
don't have to set certain variables to make the compiler happy. But
the last is required for other compilers.

So the benefits are small and the problem this causes are not so
small.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "brand memory are for windows users that think their stability
   problems come from the memory"
    -- bomek in #freeciv




[Prev in Thread] Current Thread [Next in Thread]