]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Port to compilers that moan about K&R func decls
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Sep 2022 21:19:50 +0000 (16:19 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 2 Sep 2022 17:09:32 +0000 (12:09 -0500)
* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
Use '(void)' rather than '()' in function prototypes, as the latter
provokes fatal errors in some compilers nowadays.
* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
* tests/semantics.at (AC_CHECK_DECLS):
Don’t use () in a function decl.

doc/autoconf.texi
lib/autoconf/c.m4
lib/autoconf/functions.m4
tests/fortran.at
tests/semantics.at

index 67f31064318ef594bacaf87e982cf604f59f9536..38e085978204552bf62681beeaf032145d256e9c 100644 (file)
@@ -5460,9 +5460,7 @@ the @samp{#undef malloc}):
 #include <config.h>
 #undef malloc
 
-#include <sys/types.h>
-
-void *malloc ();
+#include <stdlib.h>
 
 /* Allocate an N-byte block of memory from the heap.
    If N is zero, allocate a 1-byte block.  */
@@ -8297,7 +8295,7 @@ needed:
 #  ifdef __cplusplus
      extern "C"
 #  endif
-   int F77_DUMMY_MAIN () @{ return 1; @}
+   int F77_DUMMY_MAIN (void) @{ return 1; @}
 #endif
 @end example
 
index abbb83fe654932cf3bd005a822ad8477bd3b0a02..4751c7f5936f23d42477073c039c1de6e4ef1887 100644 (file)
@@ -133,7 +133,7 @@ m4_if([$2], [main], ,
 #ifdef __cplusplus
 extern "C"
 #endif
-char $2 ();])], [return $2 ();])])
+char $2 (void);])], [return $2 ();])])
 
 
 # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
@@ -157,7 +157,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
 #define $1 innocuous_$1
 
 /* System header to define __stub macros and hopefully few prototypes,
-   which can conflict with char $1 (); below.  */
+   which can conflict with char $1 (void); below.  */
 
 #include <limits.h>
 #undef $1
@@ -168,7 +168,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
 #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.  */
index 9f44a1cea752c8d484eafdbd5dceebce0fff97e9..ee519a3858f7e09af7ac58eb5817e8bc559514a3 100644 (file)
@@ -1613,9 +1613,6 @@ AC_DEFUN([AC_FUNC_STRTOD],
 AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,
 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 ]AC_INCLUDES_DEFAULT[
-#ifndef strtod
-double strtod ();
-#endif
 int
 main (void)
 {
index 75b50b1a70d8654e772c129b20f3caaaa4ee4e0a..473b39f639c87631adfa2c66ade240dd57fc1267 100644 (file)
@@ -233,7 +233,7 @@ void FOOBAR_F77 (double *x, double *y);
 #  ifdef __cplusplus
      extern "C"
 #  endif
-   int F77_DUMMY_MAIN () { return 1; }
+   int F77_DUMMY_MAIN (void) { return 1; }
 #endif
 
 int main(int argc, char *argv[])
@@ -315,7 +315,7 @@ void FOOBAR_FC(double *x, double *y);
 #  ifdef __cplusplus
      extern "C"
 #  endif
-   int FC_DUMMY_MAIN () { return 1; }
+   int FC_DUMMY_MAIN (void) { return 1; }
 #endif
 
 int main (int argc, char *argv[])
@@ -561,7 +561,7 @@ void @foobar@ (int *x);
 #  ifdef __cplusplus
      extern "C"
 #  endif
-   int F77_DUMMY_MAIN () { return 1; }
+   int F77_DUMMY_MAIN (void) { return 1; }
 #endif
 
 int main(int argc, char *argv[])
@@ -637,7 +637,7 @@ void @foobar@ (int *x);
 #  ifdef __cplusplus
      extern "C"
 #  endif
-   int FC_DUMMY_MAIN () { return 1; }
+   int FC_DUMMY_MAIN (void) { return 1; }
 #endif
 
 int main(int argc, char *argv[])
index d24c45516fa28488d4aeba8de83c56e17e7d77cc..276d97446485f8ccfcf8fe9b3eabcaf1ac578c9e 100644 (file)
@@ -207,7 +207,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS],
                 [[extern int yes;
                   enum { myenum };
                   extern struct mystruct_s { int x[20]; } mystruct;
-                  extern int myfunc();
+                  extern int myfunc (int);
                   #define mymacro1(arg) arg
                   #define mymacro2]])
   # Ensure we can detect missing declarations of functions whose