[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Autoconf generates C code that doesn't compile with -Wstrict-prototypes
From: |
Bradley Smith |
Subject: |
Autoconf generates C code that doesn't compile with -Wstrict-prototypes and -Werror |
Date: |
Mon, 15 Sep 2008 12:08:41 +0100 |
When using macros like AC_CHECK_LIB for example, the C code generated by
autoconf does not compile when -Wstrict-prototypes and -Werror are set in
the CFLAGS, and hence the test fails. (error: function declaration isn’t a
prototype) etc.
Here is a patch that fixes this problem.
diff -Naur autoconf/lib/autoconf/c.m4
autoconf.new/lib/autoconf/c.m4
--- autoconf/lib/autoconf/c.m4 2008-04-06 00:04:48.000000000 +0100
+++ autoconf.new/lib/autoconf/c.m4 2008-09-14 23:42:44.000000000 +0100
@@ -202,7 +202,7 @@
m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS],
[_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
m4_ifdef([_AC_LANG_PROGRAM_C_FC_HOOKS],
[_AC_LANG_PROGRAM_C_FC_HOOKS])[]dnl
int
-main ()
+main (void)
{
dnl Do *not* indent the following line: there may be CPP directives.
dnl Don't move the `;' right after for the same reason.
@@ -224,7 +224,7 @@
#ifdef __cplusplus
extern "C"
#endif
-char $2 ();])], [return $2 ();])])
+char $2 (void);])], [return $2 ();])])
# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
@@ -266,7 +266,7 @@
#ifdef __cplusplus
extern "C"
#endif
-char $1 ();
+char $1 (void);
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
Regards,
Bradley Smith
--
Bradley Smith <address@hidden> GPG: 0xC718D347
signature.asc
Description: PGP signature
- Autoconf generates C code that doesn't compile with -Wstrict-prototypes and -Werror,
Bradley Smith <=