Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From 7ccfea413216bddd988823acf4e93421ea0f7f9f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 16 Aug 2022 18:35:45 -0700 |
| 4 | Subject: [PATCH] specify void prototype for functions with no parameters |
| 5 | |
| 6 | Compilers defaulting to C99 flag such functions as warning which fails |
| 7 | to compile when using -Werror |
| 8 | |
| 9 | Fixes |
| 10 | error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] |
| 11 | |
| 12 | Upstream-Status: Submitted [https://lists.gnu.org/archive/html/autoconf-patches/2022-08/msg00003.html] |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | lib/autoconf/c.m4 | 4 ++-- |
| 16 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 17 | |
| 18 | --- a/lib/autoconf/c.m4 |
| 19 | +++ b/lib/autoconf/c.m4 |
| 20 | @@ -127,7 +127,7 @@ m4_if([$2], [main], , |
| 21 | [/* Override any GCC internal prototype to avoid an error. |
| 22 | Use char because int might match the return type of a GCC |
| 23 | builtin and then its argument prototype would still apply. */ |
| 24 | -char $2 ();])], [return $2 ();])]) |
| 25 | +char $2 (void);])], [return $2 ();])]) |
| 26 | |
| 27 | |
| 28 | # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION) |
| 29 | @@ -151,7 +151,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)], |
| 30 | #define $1 innocuous_$1 |
| 31 | |
| 32 | /* System header to define __stub macros and hopefully few prototypes, |
| 33 | - which can conflict with char $1 (); below. */ |
| 34 | + which can conflict with char $1 (void); below. */ |
| 35 | |
| 36 | #include <limits.h> |
| 37 | #undef $1 |
| 38 | @@ -162,7 +162,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)], |
| 39 | #ifdef __cplusplus |
| 40 | extern "C" |
| 41 | #endif |
| 42 | -char $1 (); |
| 43 | +char $1 (void); |
| 44 | /* The GNU C library defines this for functions which it implements |
| 45 | to always fail with ENOSYS. Some functions are actually named |
| 46 | something starting with __ and the normal name is an alias. */ |
| 47 | @@ -252,7 +252,7 @@ dnl other built-in extern "C" functions, |
| 48 | dnl when it actually happens. |
| 49 | [AC_LANG_PROGRAM([[$1 |
| 50 | namespace conftest { |
| 51 | - extern "C" int $2 (); |
| 52 | + extern "C" int $2 (void); |
| 53 | }]], |
| 54 | [[return conftest::$2 ();]])]) |
| 55 | |
| 56 | @@ -2457,7 +2457,7 @@ using std::strcmp; |
| 57 | |
| 58 | namespace { |
| 59 | |
| 60 | -void test_exception_syntax() |
| 61 | +void test_exception_syntax(void) |
| 62 | { |
| 63 | try { |
| 64 | throw "test"; |