Commit b02a5e26 by Marek Polacek Committed by Marek Polacek

re PR c/70791 (-Wnested-externs prints inconsistent column number)

	PR c/70791
	* c-decl.c (pushdecl): Pass LOCUS down to warning.

	* gcc.dg/Wnested-externs-2.c: New test.

From-SVN: r235447
parent 2448a956
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
(c_parser_switch_statement): Use it. (c_parser_switch_statement): Use it.
(c_parser_while_statement): Use it. (c_parser_while_statement): Use it.
PR c/70791
* c-decl.c (pushdecl): Pass LOCUS down to warning.
2016-04-20 Ilya Verbin <ilya.verbin@intel.com> 2016-04-20 Ilya Verbin <ilya.verbin@intel.com>
PR c++/69363 PR c++/69363
......
...@@ -2949,7 +2949,8 @@ pushdecl (tree x) ...@@ -2949,7 +2949,8 @@ pushdecl (tree x)
} }
if (scope != file_scope if (scope != file_scope
&& !DECL_IN_SYSTEM_HEADER (x)) && !DECL_IN_SYSTEM_HEADER (x))
warning (OPT_Wnested_externs, "nested extern declaration of %qD", x); warning_at (locus, OPT_Wnested_externs,
"nested extern declaration of %qD", x);
while (b && !B_IN_EXTERNAL_SCOPE (b)) while (b && !B_IN_EXTERNAL_SCOPE (b))
{ {
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
* gcc.dg/pr67784-4.c: New test. * gcc.dg/pr67784-4.c: New test.
* gcc.dg/pr67784-5.c: New test. * gcc.dg/pr67784-5.c: New test.
PR c/70791
* gcc.dg/Wnested-externs-2.c: New test.
2016-04-26 Marc Glisse <marc.glisse@inria.fr> 2016-04-26 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/fold-plusmult.c: Adjust. * gcc.dg/fold-plusmult.c: Adjust.
......
/* PR c/70791 */
/* { dg-do compile } */
/* { dg-options "-Wnested-externs" } */
void
bar (void)
{
extern int i; /* { dg-warning "14:nested extern declaration of 'i'" } */
extern short foo (void); /* { dg-warning "16:nested extern declaration of 'foo'" } */
extern struct S *s; /* { dg-warning "20:nested extern declaration of 's'" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment