This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix -Wshadow=local warnings in cgraph.h
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 3 Oct 2019 15:18:28 +0000
- Subject: [PATCH] Fix -Wshadow=local warnings in cgraph.h
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F1MecBj3sQE7QhN1pp0IDQj2EHSNVu81w2LhffzohZU=; b=cq7NrEuJIQs/MDnwoBPT/42KRw7GivnKPiZ2r6kRxzZNhbHcXLuK+S8poUsAmWYiXV74a6/QNauPBL0rDgUya35t5BfiH3FRYP0ed6zpMY6WH/z6dZB8KmQ7wj65y7IYIR44FeBR1tw6PBossOusJs04hw8bR+9yoe3dZYkh4/8i1EhknHbveySd/AbGsTmchGyFCq8aSTjsyZZJOpyU4jX5N15SqvJuapcH+9SFRfns+zwReDO4+qhNtVtrHEe44RpGSn9YJwEB4twSLRtOUpgmESMa0gzRC+sbaQPrqmo5037P2QAwPtONXgTetma/Ifcu+wAOpeVBrT03wBgXSQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W0Pz7QfIXocj9KuHFQOxFoP2Utjrrz076w0Io3d7Rg0nlRl0rC93SM1cwZ98qBKwYCN8VGjq65j3iTn9Dsn86ktxP/rCRq8b1rSc/IvkgjkH04bQylpdM0mrTp59tXEvf4lPS+dlE0hHysSo1ioxdueQGHi4MQEZJ1hjW4m/9zlO4vlEjTz3JsskS8f92TP/kBpr7y+6y9niunVCFWU/Lu47G4QBOueh0qZPo8dfe70QHL/FRSbjqz1LQPsCk7K/SbLY2ZpcS//ty6xLj76ieqvoEzn4bS0MY2pEtJQdp0+A4JIQb+72+oCjequTwVsWBDMIw4ZqOtQzmi3+/ht/rw==
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. */