[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_CC_C99 fails when configure with CFLAGS="-Werror -Wall"
From: |
Paul Eggert |
Subject: |
Re: AC_PROG_CC_C99 fails when configure with CFLAGS="-Werror -Wall" |
Date: |
Mon, 10 Dec 2012 10:09:17 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
Thanks, it doesn't hurt to squash those warnings
so I installed the following (slightly different) patch.
>From 1ee5bc84f36b90fe4d95ba630c0840525cc33991 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Mon, 10 Dec 2012 10:06:10 -0800
Subject: [PATCH] AC_PROG_CC_C99: avoid unused-var warning
* lib/autoconf/c.m4 (_AC_C_C99_TEST_HEADER): Rewrite to use vars.
Problem reported by ChangZhuo Chen in
<http://lists.gnu.org/archive/html/bug-autoconf/2012-12/msg00000.html>.
---
lib/autoconf/c.m4 | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 02b999e..e17df1e 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1257,7 +1257,7 @@ test_restrict (ccp restrict text)
}
// Check varargs and va_copy.
-static void
+static bool
test_varargs (const char *format, ...)
{
va_list args;
@@ -1265,9 +1265,9 @@ test_varargs (const char *format, ...)
va_list args_copy;
va_copy (args_copy, args);
- const char *str;
- int number;
- float fnumber;
+ const char *str = "";
+ int number = 0;
+ float fnumber = 0;
while (*format)
{
@@ -1288,6 +1288,8 @@ test_varargs (const char *format, ...)
}
va_end (args_copy);
va_end (args);
+
+ return *str && number && fnumber;
}]])# _AC_C_C99_TEST_HEADER
# _AC_C_C99_TEST_BODY
@@ -1304,7 +1306,7 @@ AC_DEFUN([_AC_C_C99_TEST_BODY],
char *restrict newvar = "Another string";
// Check varargs.
- test_varargs ("s, d' f .", "string", 65, 34.234);
+ success &= test_varargs ("s, d' f .", "string", 65, 34.234);
test_varargs_macros ();
// Check flexible array members.
--
1.7.11.7