]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Change main () to main (void) for C/C++
authorVincent Lefevre <vincent@vinc17.net>
Sun, 5 Jan 2014 03:50:02 +0000 (04:50 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 13 Feb 2014 18:38:12 +0000 (11:38 -0700)
This patch changes "main ()" to "main (void)" for C/C++.
See: http://lists.gnu.org/archive/html/bug-autoconf/2014-01/msg00005.html

On my machine, before this patch, 3 tests were failing:

  38: tools.at:1329      autom4te cache locking
 218: autotest.at:1893   C unit tests
      ac_config_testdir at_tested autotest
 219: autotest.at:1948   C unit tests (EXEEXT)
      ac_config_testdir at_tested autotest

With this patch, 2 tests were failing:

 218: autotest.at:1893   C unit tests
      ac_config_testdir at_tested autotest
 219: autotest.at:1948   C unit tests (EXEEXT)
      ac_config_testdir at_tested autotest

(I suspect that 38 is unrelated.)

Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
Copyright-paperwork-exempt: Yes

doc/autoconf.texi
lib/autoconf/c.m4
lib/autoconf/functions.m4
lib/autoconf/specific.m4
lib/autoconf/types.m4
tests/c.at
tests/compile.at

index 6795fcb6f1f66ff266f6414575672f8032efb0f9..4a4ee81d85fc0e486e37f08516d81cf380c9175e 100644 (file)
@@ -9132,7 +9132,7 @@ on a system with @command{gcc} installed, results in:
 
 const char hw[] = "Hello, World\n";
 int
-main ()
+main (void)
 @{
 fputs (hw, stdout);
   ;
index f0f666781ea737636b104764ee0bbc689d7ec87c..b58e42d36c02e5067717fc8c462ecb870a92e712 100644 (file)
@@ -97,7 +97,7 @@ m4_define([AC_LANG_PROGRAM(C)],
 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.
@@ -2061,7 +2061,7 @@ m4_define([_AC_LANG_OPENMP(C)],
  choke me
 #endif
 #include <omp.h>
-int main () { return omp_get_num_threads (); }
+int main (void) { return omp_get_num_threads (); }
 ])
 
 # _AC_LANG_OPENMP(C++)
index 41752127ae607d70fccc96f1cc7599c0ade8f4b0..c7790ec3761307c22d2d2c9c50acf899359d9faf 100644 (file)
@@ -1147,7 +1147,7 @@ year_2050_test ()
 }
 
 int
-main ()
+main (void)
 {
   time_t t, delta;
   int i, j;
@@ -1274,7 +1274,7 @@ AC_CACHE_CHECK([for working mmap], [ac_cv_func_mmap_fixed_mapped],
 #endif /* no HAVE_GETPAGESIZE */
 
 int
-main ()
+main (void)
 {
   char *data, *data2, *data3;
   const char *cdata2;
@@ -1562,7 +1562,7 @@ AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,
 double strtod ();
 #endif
 int
-main()
+main (void)
 {
   {
     /* Some versions of Linux strtod mis-parse strings with leading '+'.  */
@@ -1900,7 +1900,7 @@ sparc_address_test (int arg)
 }
 
 int
-main ()
+main (void)
 {
   pid_t parent = getpid ();
   pid_t child;
@@ -2018,7 +2018,7 @@ AC_CACHE_CHECK([for wait3 that fills in rusage],
 #include <sys/wait.h>
 /* HP-UX has wait3 but does not fill in rusage at all.  */
 int
-main ()
+main (void)
 {
   struct rusage r;
   int i;
index eadde52eadfa6e23beb2a947c1c4f18d9023fc60..de940f214f4a03a62695a0ed8dd646ab59cad537 100644 (file)
@@ -254,7 +254,7 @@ void ucatch (dummy) int dummy; { }
 #endif
 
 int
-main ()
+main (void)
 {
   int i = fork (), status;
 
index 2ef4d534dafa9f24e4930708796fafe8ae9f552f..a7a229ef0531ec13e3f51b246af7b359d77bf058 100644 (file)
@@ -267,7 +267,7 @@ AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
 #define MAX(x, y) ((x) > (y) ? (x) : (y))
 
 int
-main ()
+main (void)
 {
   gid_t gidset[NGID];
   int i, n;
index 2684397072fd4378dc75a3ee8c3e6203a2bbdd54..b500faa2181b0394ed60ccb87ed771fd8bb07852 100644 (file)
@@ -366,7 +366,7 @@ AT_DATA([foo.c],
 #endif
 #include <stdio.h>
 
-int main ()
+int main (void)
 {
 #ifdef _OPENMP
 #pragma omp parallel
@@ -416,7 +416,7 @@ foo.@OBJEXT@: foo.cpp
 ]])
 
 AT_DATA([foo.cpp],
-[[int main ()
+[[int main (void)
 {
   return 0;
 }
index e6e96fac3f41a92536a864ce7b13021c25548a33..43c36e5263609b39e50c66793580bfed840a2521 100644 (file)
@@ -124,7 +124,7 @@ AC_PROG_CC
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
 choke me
 #endif
-int main ()
+int main (void)
 {
   return 0;
 }
@@ -150,7 +150,7 @@ AC_LANG([C++])
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PACKAGE_NAME
 choke me
 #endif
-int main ()
+int main (void)
 {
   return 0;
 }
@@ -249,7 +249,7 @@ AT_CHECK([sed -n 's/ *$//; /#define PACKAGE/,$p' stdout], [],
 
 const char hw[] = "Hello, World\n";
 int
-main ()
+main (void)
 {
 fputs (hw, stdout);
   ;
@@ -269,7 +269,7 @@ AT_KEYWORDS([AC_LANG_DEFINES_PROVIDED])
 
 AT_DATA([configure.ac],
 [[AC_INIT
-AC_COMPILE_IFELSE([int main () { return 0; }], [],
+AC_COMPILE_IFELSE([int main (void) { return 0; }], [],
   [AC_MSG_ERROR([compiling trivial program failed])])
 ]])
 
@@ -280,7 +280,7 @@ AT_CHECK_CONFIGURE([-q])
 
 AT_DATA([configure.ac],
 [[AC_INIT
-AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED()int main () { return 0; }], [],
+AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED()int main (void) { return 0; }], [],
   [AC_MSG_ERROR([compiling trivial program failed])])
 ]])
 
@@ -324,7 +324,7 @@ test $estatus != 2 &&
   AC_MSG_ERROR([did not get as 2 exit status: $estatus])])
 
 # The old stinky one.
-AC_TRY_RUN([int main () { return 3; }],
+AC_TRY_RUN([int main (void) { return 3; }],
           [AC_MSG_ERROR([saw `return 3' as a success])],
           [estatus=$?
 test $estatus != 3 &&