-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Nico R. on 6/24/2008 12:14 PM: | Hello! Hello, and sorry for a delayed response, | AC_LANG_PROGRAM(C) uses a ‘main’ function without a prototype. If CFLAGS | contains ‘-Werror’ (it does in my case, because the configure script in | the glibc package adds it), a test using AC_LANG_PROGRAM(C), for example | AC_LINK_IFELSE, fails. | | Shouldn’t the line | main () | be | main (void) | instead? Per C99 5.1.2.2.1, main must be compatible with one of these two prototypes: main(void); main(int, char**); But 6.7.5.3 states "An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters.", which is the same result as using a list of exactly void. If that's not enough evidence that main() is compatible with main(void) when coupled with the function definition, then you should also look at the example in 6.5.3.4 that shows a use of main(){...} as a valid C99 program. | Or may this cause problems with some compilers? Should | ‘-Wstrict-prototypes’ be removed from CFLAGS instead? And should this be | fixed in autoconf or should I report a bug against glibc? I argue that using the construct main(){} not a bug in autoconf - we are using a valid C99 program (and I assume C89 as well, although I don't have C89 in front of me at the moment). It may be worth asking the gcc folks, to see if they are issuing a bogus warning for a valid program, or whether they are intentionally giving a warning because the construct is of dubious value even though it is valid. Meanwhile, while we try to be nice to configuring with -Werror, we do not guarantee that it will always work (there are just too many compiler variants that warn about too many distinct items to make any program warning free across all compilers). Now, as to C89 vs. K&R, I think the list sentiment the last few months has been that these days, we can rely on C89 compilers on most reasonable platforms. The proposal has been made to switch the default autoconf behavior to require C89 (ie. use the tests currently run only by using AC_PROG_CC_C89), but to add a AC_PROG_CC_K_R macro that will allow the rarer programs that still want to support K&R compilers in their configure script (or put another way: right now, we default to K&R but support C89 or C99; with the addition of new macro, we default to C89 but support K&R or C99). But no one has written a patch to do this yet. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@xxxxxxx -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkh5OZ4ACgkQ84KuGfSFAYCw+QCeMAcKDJ3wPVDZ5VCaBLA1xWXK pOMAoLGdETexQVPkmL7DvE8n26Nr7+r/ =Ji3w -----END PGP SIGNATURE----- _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf