[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Change main () to main (void) for C/C++
From: |
Vincent Lefevre |
Subject: |
[PATCH] Change main () to main (void) for C/C++ |
Date: |
Sun, 5 Jan 2014 04:50:02 +0100 |
User-agent: |
Mutt/1.5.21-6305-vl-r59709 (2013-04-16) |
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 <address@hidden>
---
doc/autoconf.texi | 2 +-
lib/autoconf/c.m4 | 4 ++--
lib/autoconf/functions.m4 | 10 +++++-----
lib/autoconf/specific.m4 | 2 +-
lib/autoconf/types.m4 | 2 +-
tests/c.at | 4 ++--
tests/compile.at | 12 ++++++------
7 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 6c374c0..09947a6 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -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);
;
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index f0f6667..b58e42d 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -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++)
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 4175212..c7790ec 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -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;
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index eadde52..de940f2 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -254,7 +254,7 @@ void ucatch (dummy) int dummy; { }
#endif
int
-main ()
+main (void)
{
int i = fork (), status;
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index 2ef4d53..a7a229e 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -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;
diff --git a/tests/c.at b/tests/c.at
index 2684397..b500faa 100644
--- a/tests/c.at
+++ b/tests/c.at
@@ -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 @@ address@hidden@: foo.cpp
]])
AT_DATA([foo.cpp],
-[[int main ()
+[[int main (void)
{
return 0;
}
diff --git a/tests/compile.at b/tests/compile.at
index e6e96fa..43c36e5 100644
--- a/tests/compile.at
+++ b/tests/compile.at
@@ -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 &&
--
1.8.5.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Change main () to main (void) for C/C++,
Vincent Lefevre <=