[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FUNC_ALLOCA generates warning (problem with -Werror)
From: |
Ralf Wildenhues |
Subject: |
Re: AC_FUNC_ALLOCA generates warning (problem with -Werror) |
Date: |
Tue, 6 Jun 2006 23:00:40 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
* Paul Eggert wrote on Tue, Jun 06, 2006 at 04:01:24AM CEST:
> Jaap Haitsma <address@hidden> writes:
>
> > This generates a warning that the variable p is never used. This is a
> > problem when you run configure with CFLAG="-Werror". Compilation of the
> > above code will fail.
>
> Can you please give more details? I can't reproduce the problem.
> $ cat configure.ac
> AC_INIT
> AC_FUNC_ALLOCA
> AC_OUTPUT
> $ autoconf
> $ ./configure CFLAGS='-Werror'
The issue is exposed with CFLAGS='-W -Wall -Werror'.
How about this patch? It shouldn't be so likely to eventually cause an
"likely infinite loop" warning.
Cheers,
Ralf
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Work around
`unused variable' compiler warning, for `-Wall -Werror'.
Report by Jaap Haitsma <address@hidden>.
Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.104
diff -u -r1.104 functions.m4
--- lib/autoconf/functions.m4 27 May 2006 03:20:51 -0000 1.104
+++ lib/autoconf/functions.m4 6 Jun 2006 07:57:41 -0000
@@ -351,7 +351,8 @@
AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(address@hidden:@include <alloca.h>]],
- [[char *p = (char *) alloca (2 * sizeof (int));]])],
+ [[char *p = (char *) alloca (2 * sizeof (int));
+ if (p) return 0;]])],
[ac_cv_working_alloca_h=yes],
[ac_cv_working_alloca_h=no])])
if test $ac_cv_working_alloca_h = yes; then
@@ -382,7 +383,8 @@
# endif
# endif
#endif
-]], [[char *p = (char *) alloca (1);]])],
+]], [[char *p = (char *) alloca (1);
+ if (p) return 0;]])],
[ac_cv_func_alloca_works=yes],
[ac_cv_func_alloca_works=no])])