bug-gnulib
[Top][All Lists]
Advanced

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

Re: coreutils-6.5: yet another C89 problem


From: Jim Meyering
Subject: Re: coreutils-6.5: yet another C89 problem
Date: Tue, 28 Nov 2006 09:37:21 +0100

address@hidden (Bob Proulx) wrote:
> Jim Meyering wrote:
>> Here's what Paul just added to Makefile.maint.
>> That should do it, as long as you do that build
>> on a relatively modern Linux system:
>>
>>     $ grep -C2 ansi Makefile.maint
>>               && (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \
>>               && ./configure --disable-largefile            \
>>                   CFLAGS='-Werror -ansi -pedantic -Wno-long-long' \
>>               && $(MAKE)
>>             -rm -rf $(t)
>
> Sure thing.  It is all set up with those options.
>
>> Another one that'd be nice to automate (though not as important,
>> so could be run far less frequently) is the "configure-without-NLS-
>> then-compile-with-Wformat", from the preceding "my-distcheck" rules,
>> in Makefile.maint:
>>
>>        && ./configure --disable-nls                  \
>>        && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow -Wpointer-arith' \
>>            AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'       \
>
> Okay.  I set that up to run nightly.
>
>> Its purpose is to ensure that all format strings match the types of
>> their arguments.  The only catch is that your tools/headers need to
>> be at some minimum level.  I haven't tried running "make distcheck"
>> on anything other than my bleeding-edge system.  You wouldn't need to
>> bother with null_AM_MAKEFLAGS.
>>
>> Thanks for doing that!

Here's the first compile failure (I presume because the infrastructure
on that build system is a little dated):
I hope it's the last!

  In file included from regex.c:61:
  regcomp.c: In function `parse_branch':
  regcomp.c:2180: warning: declaration of `exp' shadows a global declaration
  <built-in>:0: warning: shadowed declaration is here
  make[2]: *** [regex.o] Error 1

gnulib's config/srclist.txt says that file is currently not being
sync'd from glibc, so making this additional change should be fine:

2006-11-28  Jim Meyering  <address@hidden>

        * lib/regcomp.c (parse_branch): Rename local, exp->expr, to avoid
        warning from "gcc -Wshadow" about shadowing the builtin.

Index: lib/regcomp.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/regcomp.c,v
retrieving revision 1.22
diff -u -p -r1.22 regcomp.c
--- lib/regcomp.c       13 Apr 2006 22:14:12 -0000      1.22
+++ lib/regcomp.c       28 Nov 2006 08:33:29 -0000
@@ -2177,7 +2177,7 @@ static bin_tree_t *
 parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
              reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
 {
-  bin_tree_t *tree, *exp;
+  bin_tree_t *tree, *expr;
   re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
   tree = parse_expression (regexp, preg, token, syntax, nest, err);
   if (BE (*err != REG_NOERROR && tree == NULL, 0))
@@ -2186,14 +2186,14 @@ parse_branch (re_string_t *regexp, regex
   while (token->type != OP_ALT && token->type != END_OF_RE
         && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
     {
-      exp = parse_expression (regexp, preg, token, syntax, nest, err);
-      if (BE (*err != REG_NOERROR && exp == NULL, 0))
+      expr = parse_expression (regexp, preg, token, syntax, nest, err);
+      if (BE (*err != REG_NOERROR && expr == NULL, 0))
        {
          return NULL;
        }
-      if (tree != NULL && exp != NULL)
+      if (tree != NULL && expr != NULL)
        {
-         tree = create_tree (dfa, tree, exp, CONCAT);
+         tree = create_tree (dfa, tree, expr, CONCAT);
          if (tree == NULL)
            {
              *err = REG_ESPACE;
@@ -2201,8 +2201,8 @@ parse_branch (re_string_t *regexp, regex
            }
        }
       else if (tree == NULL)
-       tree = exp;
-      /* Otherwise exp == NULL, we don't need to create new tree.  */
+       tree = expr;
+      /* Otherwise expr == NULL, we don't need to create new tree.  */
     }
   return tree;
 }




reply via email to

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