autoconf-patches
[Top][All Lists]
Advanced

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

Re: const/volatile vs. -Werror


From: Eric Blake
Subject: Re: const/volatile vs. -Werror
Date: Fri, 07 Apr 2006 21:57:34 +0000

Hi Ralf.

> > This patch allows:
> > ./testsuite -d -k 'C keywords' CFLAGS='-Wall -Werror'
> > to succeed with gcc 3.4.4.  There were so many tests in AC_C_CONST, some
> > with duplicate names but different scopes, that I relettered the local
> > variables.
> 
> Eric, please make my life easier and resubmit a *minimal* patch
> that allows me to quickly see what's going on.  No renaming.

Understood.  The resubmittal is now 5 insertions, 1 deletion, per
diffstat.

> 
> Let's put this in a bit stronger words: until the alpha release,
> I will reject any non-minimal patch for new stuff, even bugfixes.
> I don't have unlimited time, and I don't want this release to
> take unlimited time, and after 2.60 there'll be enough time for
> everyone to do cleanup patches and thus introduce new bugs.

This resubmittal is tested with
./testsuite -d -k 'C keywords' CFLAGS='-std=c89 -Wall -Werror'
and fixes the C89 regression I made in the first version.  I
understand if you decide to delay this patch until after the alpha
release, since it only helps the corner case of configuring with
-Werror.

In the process, it pointed out a couple of bugs with autotest;
a followup post will give details and a patch for one of
the two issues.

2006-04-07  Eric Blake  <address@hidden>

        * lib/autoconf/c.m4 (AC_C_CONST, AC_C_VOLATILE): Avoid warnings
        from gcc.

 Index: lib/autoconf/c.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.220
diff -u -p -r1.220 c.m4
--- lib/autoconf/c.m4   6 Apr 2006 11:24:00 -0000       1.220
+++ lib/autoconf/c.m4   7 Apr 2006 21:40:05 -0000
@@ -1461,6 +1461,7 @@ AC_DEFUN([AC_C_CONST],
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
+    if (s) return 0;
   }
   { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
     int x[] = {25, 17};
@@ -1479,7 +1480,9 @@ AC_DEFUN([AC_C_CONST],
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
+    if (!foo) return 0;
   }
+  return !x[0] && !zero.x;
 #endif
 ]])],
                   [ac_cv_c_const=yes],
@@ -1547,7 +1550,8 @@ AC_DEFUN([AC_C_VOLATILE],
 [AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
 volatile int x;
-int * volatile y;])],
+int * volatile y = (int *) 0;
+return !x && !y;])],
                   [ac_cv_c_volatile=yes],
                   [ac_cv_c_volatile=no])])
 if test $ac_cv_c_volatile = no; then




reply via email to

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