On Wed, Mar 15, 2006 at 02:59:36PM -0800, Ben Pfaff wrote:
> Ron <[EMAIL PROTECTED]> writes:
> 
> > 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).
> 
> You're free to compile your code with whatever options you like.
> I don't dispute that.  But you can't expect everyone *else's*
> code to compile with those options, so you can't expect -Werror
> to work with Autoconf.

Again I fully agree with half of what you say.  If third party
code fails to compile without warnings, then its my problem to
fix that, whether its submitting a patch, or being more permissive
with them.  The same would apply to autoconf if it were one of
the AC_PREDEFINED_TESTS that I was running, but that is not the
problem I am speaking of.

Autoconf makes this fail (more or less gratuitously it appears
at the present) even trying to compile MY tests with AC_TRY_*/
AC_*_IFELSE.  That seems to me to be a silly, avoidable, flaw.


> >> 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.
> 
> It's an obsolescent form, but there's no indication when or if it
> will be removed from the language.  Every compiler for C89 or C99
> must accept it.
> 
> >> 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.
> 
> Any C compiler may warn about anything it likes.  This is
> perfectly valid from a language point of view:
>         foo.c:1: you have bad breath.

This is a very different warning to one about an obsolescent form.
-Werror is a way to help me avoid accidentally using third party
code or compilers that stupid too ;-)

I'm not insane about using it.  But this diminishes (or complicates)
its usefulness with gcc unnecessarily, to the evidence before me.

> Refusing to compile a program is different from issuing a
> diagnostic.

Yes.  -Werror is something I apply to code that I know is clean
enough to use it.  If it ever stops being that clean I want to know.
The reason may provoke me to stop using it with that code for a
while.  But that is also very different to autoconf forcing me to
never use it.  For no apparent reason, other than int main() was
quite likely the optimal choice for a previous generation of compilers.

Clearly the gcc folk want people to reassess that.

> >> 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?
> 
> Oh, so you'd rather get a pair of "unused argument argc" and
> "unused argument argv" errors instead?  Not an improvement in my
> opinion.

And not a very flattering argument, or researched opinion.
I think you'll find the answer to that in my very first post.
The one you summarily closed.  I refer here to a signature,
that could hardly be mistaken for a patch.

Do you know of some compiler that will choke on the more unabbreviated
form I posted earlier?  Or that there is no legal and trivial code that
can otherwise satisfy them all to use an equally (or more) standard
signature for main?

If this problem really is intractable, it is clearly not at the place
where you gave up thinking above.  You can't lecture me on the finer
points of what is and is not legal in the language without knowing
a variety of ways to make that into legal boilerplate.

I'm still waiting for the surprise entry that makes even this
unportable.

> (C does not allow unnamed function arguments as does C++.)

Yes, the point was there is surely a legal and portable way to
use that signature, if in fact there are compilers that will
choke on int main(void).

If there is in fact not such a thing (I've seen worse), I can
understand and accommodate.  But I don't think "gcc is wrong",
or "-Werror is evil", are in any way a reflection on the actual
problem here or the first answer we should grab from thin air.

Times have changed.  Autoconf needs to always look at how to be
relevant to them.  I'm waving a little red flag, and unlikely to
be the last to do so, even if I'm a little early about doing it.

best,
Ron




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

Reply via email to