Ron <[EMAIL PROTECTED]> writes:

> On Tue, Mar 14, 2006 at 03:12:29PM -0800, Ben Pfaff wrote:
>> Ron <[EMAIL PROTECTED]> writes:
>> 
>> > With my current gcc (4.0.2-10), the following code:
>> >
>> >  int main() { return 0; }
>> >
>> > Will warn: function declaration isn't a prototype
>> > if compiled with -Wstrict-prototypes.
>> >
>> > Since that is the signature for main which autoconf wraps its tests in
>> > when creating conftest.c -- then tests which should normally succeed,
>> > will fail if the language is C, and CPPFLAGS include -Wstrict-prototypes,
>> > and -Werror (the latter being my preferred habit for release builds).
>> 
>> It's not reasonable to expect autoconf to work properly with
>> -Werror.  When the next version of GCC comes out, it may add any
>> number of new warnings for code that is currently accepted
>> silently.  Autoconf doesn't have any way to predict what these
>> new warnings will be.
[...]
> If the reason that autoconf now compiles headers instead of just
> preprocessing them, is 'realism' -- something they seem to emphasise
> quite a lot -- then surely any new warning in an existing test is
> a good thing to know and fix as well.

The "realism" that Autoconf emphasizes is that if something works
in a test, it should work later when compiling real code as
well.  -Werror goes far beyond that: it breaks the tests *and*
the real code too.

> I'm not suggesting -Werror should be the default for autoconf,
> just asking that it have a _chance_ of working, without something
> as fundamental as an illegal (or at least non-standard) main()
> function getting in the way.

There is nothing illegal or non-standard about writing "int
main() { return 0; }".  If you think so, you clearly do not
understand the C standard very well.  Every standard C compiler,
for both the old C89 and the current C99 standard, must accept
the code above.  Adding -Werror transforms GCC into a compiler
for a language that is not C.

>> I too like to use -Werror for writing code.  But I don't pass it
>> to Autoconf.  And I recommend that you not do so as well.
>
> If you can assure me that this is the opinion of upstream, and/or
> offer a good reason to not use one of the standard signatures for
> main (which seems like a no-brainer in every respect otherwise),
> then I might understand this.

I repeat: "int main()" is perfectly acceptable in all standard C
variants, and GCC with -Werror is not a C compiler.

> Otherwise, don't you think it is the sort of thing we ought to
> punt to them before ruling it out so summarily?  Or do you speak
> with an upstream hat to wear?

I do not have an upstream hat, but I disagree that this is a
bug.  If you want to take it to upstream, go ahead, but I will
not do so for you.
-- 
"Unix... is not so much a product
 as it is a painstakingly compiled oral history
 of the hacker subculture."
--Neal Stephenson


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to