Complete.Org: Mailing Lists: Archives: freeciv-dev: February 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: Tue, 18 Feb 2003 12:39:22 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Feb 18, 2003 at 11:05:50AM -0800, Jason Short wrote:
> Raimar Falke wrote:
> > On Fri, Feb 14, 2003 at 11:13:05AM -0800, Jason Short wrote:
> > 
> >>Raimar Falke wrote:
> >>
> >>>Non-gcc compiler will complain about the missing return statements and
> >>>so on.
> >>
> >>I'm strongly against this change.
> > 
> > 
> > So did I convinced you?
> 
> Well, not really.  I do see the value of getting compiler warnings from 
> other compilers, and that is made easier by avoiding spurious warnings.
> 
> I'm not actually sure that gcc will give an error in the above case. 
> Perhaps it will be intelligent, and will allow the 'return' statement as 
> long as you don't try to actually do anything.
> 
> Another alternative is to use macros to avoid the gcc warning. 
> Something like:
> 
> #ifdef __GCC__
> #  define noreturn(x)
> #else
> #  define noreturn(x) return (x)
> #endif
> 
> which makes clear to the reader that the line is never reached, takes 
> advantage of the noreturn attribute, and also avoids any compiler 
> warnings under non-gcc compilers.

There is another solution:

#define die(x)   real_die(x),exit(1)

Every compiler should now that exit doesn't return.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Understanding is a three-edged sword; 
  your side, their side, and the truth."
    -- a well-known Vorlon





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