This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -Wshadow=local warnings in cgraph.h


Hi,

this fixes a -Wshadow=local warning in the FOR_EACH_ALIAS macro
that happens when it is used in lto/lto-partition.c in a nested
block.

For now to keep the patch simple, using the fact that the ALIAS
parameter is always a simple name, concatenate _iter_ to make
the loop variable a reserved name.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

2019-10-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* cgraph.h (FOR_EACH_ALIAS): Avoid shadowing the loop variable.

Index: gcc/cgraph.h
===================================================================
--- gcc/cgraph.h	(revision 276484)
+++ gcc/cgraph.h	(working copy)
@@ -648,8 +648,10 @@ symtab_node::checking_verify_symtab_nodes (void)
 }
 
 /* Walk all aliases for NODE.  */
-#define FOR_EACH_ALIAS(node, alias) \
-  for (unsigned x_i = 0; node->iterate_direct_aliases (x_i, alias); x_i++)
+#define FOR_EACH_ALIAS(NODE, ALIAS)				\
+  for (unsigned ALIAS##_iter_ = 0;				\
+       (NODE)->iterate_direct_aliases (ALIAS##_iter_, ALIAS);	\
+       ALIAS##_iter_++)
 
 /* This is the information that is put into the cgraph local structure
    to recover a function.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]