Message ID | VI1PR03MB45280F6F44E7E4EC476A77B2E49F0@VI1PR03MB4528.eurprd03.prod.outlook.com |
---|---|
State | New |
Headers | show |
Series | Fix -Wshadow=local warnings in cgraph.h | expand |
On Thu, Oct 3, 2019 at 5:18 PM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote: > > 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? OK. Richard. > > 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. */