[binutils-gdb] * dwarf2dbg.c (dwarf2dbg_final_check): Rename local variable exp from expr.

Hans-Peter Nilsson hp@sourceware.org
Sun Jul 23 22:54:00 GMT 2017


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=723dfee7b84099118e849c90e4e95dc275cb9d97

commit 723dfee7b84099118e849c90e4e95dc275cb9d97
Author: Hans-Peter Nilsson <hp@bitrange.com>
Date:   Mon Jul 24 00:53:34 2017 +0200

    * dwarf2dbg.c (dwarf2dbg_final_check): Rename local variable exp from expr.
    
    Trying to build (for mmix-knuth-mmixware but I don't think that
    matters) yields the following (repeatable on e.g. CompileFarm gcc20
    sporting gcc-4.7.2 as default):
    
    gcc -DHAVE_CONFIG_H -I. -I/home/hp/binutils/src/gas  -I. -I/home/hp/binutils/src/gas -I../bfd -I/home/hp/binutils/src/gas/config -I/home/hp/binutils/src/gas/../include -I/home/hp/binutils/src/gas/.. -I/home/hp/binutils/src/gas/../bfd -DLOCALEDIR="\"/usr/local/share/locale\""  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -Wwrite-strings -I/home/hp/binutils/src/gas/../zlib -g -O2 -MT dwarf2dbg.o -MD -MP -MF .deps/dwarf2dbg.Tpo -c -o dwarf2dbg.o /home/hp/binutils/src/gas/dwarf2dbg.c
    cc1: warnings being treated as errors
    /home/hp/binutils/src/gas/dwarf2dbg.c: In function 'dwarf2dbg_final_check':
    /home/hp/binutils/src/gas/dwarf2dbg.c:2246: error: declaration of 'expr' shadows a global declaration
    /home/hp/binutils/src/gas/expr.h:180: error: shadowed declaration is here
    make[4]: *** [dwarf2dbg.o] Error 1
    
    IIRC this is a false namespace clash and the warning is not observable
    with a new-enough gcc.  Committed as obvious.
    
    brgds, H-P
    PS. Idea: -Wcompiler; warn about constructs problematic with e.g. old gcc. 1/2 ;-)

Diff:
---
 gas/ChangeLog   |  5 +++++
 gas/dwarf2dbg.c | 10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 58f2ef4..17bdf52 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-24  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* dwarf2dbg.c (dwarf2dbg_final_check): Rename local variable exp
+	from expr.
+
 2017-07-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
 	* config/tc-s390.c (s390_parse_cpu): Add z14 as alternate CPU
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 4f70330..ad9d3f3 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2243,21 +2243,21 @@ dwarf2dbg_final_check (void)
      holding the check value in X_op_symbol.  */
   while (view_assert_failed)
     {
-      expressionS *expr;
+      expressionS *exp;
       symbolS *sym;
       offsetT failed;
 
       gas_assert (!symbol_resolved_p (view_assert_failed));
 
-      expr = symbol_get_value_expression (view_assert_failed);
+      exp = symbol_get_value_expression (view_assert_failed);
       sym = view_assert_failed;
 
       /* If view_assert_failed looks like a compound check in the
 	 chain, break it up.  */
-      if (expr->X_op == O_add && expr->X_add_number == 0 && expr->X_unsigned)
+      if (exp->X_op == O_add && exp->X_add_number == 0 && exp->X_unsigned)
 	{
-	  view_assert_failed = expr->X_add_symbol;
-	  sym = expr->X_op_symbol;
+	  view_assert_failed = exp->X_add_symbol;
+	  sym = exp->X_op_symbol;
 	}
       else
 	view_assert_failed = NULL;



More information about the Binutils-cvs mailing list