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: rf13@xxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3427) Remove noreturn attribute
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Feb 2003 11:05:50 -0800
Reply-to: rt@xxxxxxxxxxxxxx

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.

jason




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