autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] specify void prototype for functions with no parameters


From: Khem Raj
Subject: [PATCH] specify void prototype for functions with no parameters
Date: Tue, 16 Aug 2022 20:29:10 -0700

Compilers defaulting to C99 flag such functions as warning which fails
to compile when using -Werror

Fixes
error: a function declaration without a prototype is deprecated in all versions 
of C [-Werror,-Wstrict-prototypes]

---
 lib/autoconf/c.m4 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index abbb83fe..c6202789 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -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.  */
@@ -258,7 +258,7 @@ dnl other built-in extern "C" functions, but let's worry 
about that
 dnl when it actually happens.
 [AC_LANG_PROGRAM([[$1
 namespace conftest {
-  extern "C" int $2 ();
+  extern "C" int $2 (void);
 }]],
 [[return conftest::$2 ();]])])
 
@@ -2474,7 +2474,7 @@ using std::strcmp;
 
 namespace {
 
-void test_exception_syntax()
+void test_exception_syntax(void)
 {
   try {
     throw "test";
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]