Hi,

this fixes a -Wshadow=local warning when using AUTO_DUMP_SCOPE in
nested blocks.  Since NAME i a string I cannot use it to create
a unique name for the auto_dump_scope object.

So I used XCONCAT2 from good old symcat.h, to mangle the __LINE__
macro into the scope object name.


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


Thanks
Bernd.

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

	* dumpfile.h (AUTO_DUMP_SCOPE): Use XCONCAT2 and __LINE__
	to form a unique name for the scope variable.

Index: gcc/dumpfile.h
===================================================================
--- gcc/dumpfile.h	(revision 276484)
+++ gcc/dumpfile.h	(working copy)
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_DUMPFILE_H
 #define GCC_DUMPFILE_H 1
 
+#include "symcat.h" /* XCONCAT2 */
 #include "profile-count.h"
 
 /* An attribute for annotating formatting printing functions that use
@@ -634,7 +635,7 @@ class auto_dump_scope
    in a nested scope implicitly default to MSG_PRIORITY_INTERNALS.  */
 
 #define AUTO_DUMP_SCOPE(NAME, USER_LOC) \
-  auto_dump_scope scope (NAME, USER_LOC)
+  auto_dump_scope XCONCAT2 (scope, __LINE__) (NAME, USER_LOC)
 
 extern void dump_function (int phase, tree fn);
 extern void print_combine_total_stats (void);

Reply via email to