On Wed, Mar 15, 2006 at 09:04:19AM -0800, Ben Pfaff wrote:
> Ron <[EMAIL PROTECTED]> writes:
> 
> 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.

Yes.  And if that is the level of strictness I choose to filter
my release code though, that is precisely what I want.

The same would be true if I was to use -ansi or -pedantic for
some reason (not my cup of tea, I'd rather port GNU extensions
as required, but while they exist, people should be able to use
them).

> > 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.

That's not implausible, my brain mostly lives in C++ and forgets
the little differences too quickly.  But I thought omitting the
void parameter in that case was deprecated, and accepted to be
pragmatic about existing code.

> Every standard C compiler,
> for both the old C89 and the current C99 standard, must accept
> the code above.

Are they prohibited from warning?  I don't own a copy of the standard
either.  I'm usually more pragmatic coder than language lawyer.

> Adding -Werror transforms GCC into a compiler
> for a language that is not C.

Of course it does -- it turns things not required to be errors
into things that halt compilation.  You don't enable it for
any other reason.

Autoconf runs tests in languages other than C too.  But 'fixing'
this with an AC_LANG_PUSH(C++), before running tests intended
for C code (or masking off options that will be used at compile
time) seem like inglorious (and fragile) hacks.  I shouldn't have
to fight autoconf, its supposed to be running the tests I ask it to,
and passing on the options I gave it.

> >> 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.

As is int main(int,char**).  The question is, what chokes on that,
which makes using it worse with the current generation of supported
compilers?

> 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.

Ack.  I'm not going to waste both our lives convincing you
of something you don't care to change.  I'll feed it up the
line myself.  If they have their reasons not to change it,
then so be it.

The gcc warning seems valid enough (as a warning) to me.
That autoconf should try to avoid it (like all others) if
possible does not seem unreasonable to aim for.

But thanks anyway.  I'll have a(nother) poke about to try
and make sure its not already a faq.

  Ron




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

Reply via email to