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
This commit is contained in:
Marek Polacek 2016-04-26 15:01:09 +00:00 committed by Marek Polacek
parent 2448a956be
commit b02a5e265d
4 changed files with 19 additions and 1 deletions

View File

@ -8,6 +8,9 @@
(c_parser_switch_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>
PR c++/69363

View File

@ -2949,7 +2949,8 @@ pushdecl (tree x)
}
if (scope != file_scope
&& !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))
{

View File

@ -5,6 +5,9 @@
* gcc.dg/pr67784-4.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>
* gcc.dg/fold-plusmult.c: Adjust.

View File

@ -0,0 +1,11 @@
/* 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'" } */
}