diff options
author | Marek Polacek <polacek@redhat.com> | 2014-07-20 10:43:26 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-07-20 10:43:26 +0000 |
commit | 30281de2ce283349a61f62df7084d12c6315ef42 (patch) | |
tree | a76fb12428a8114d268d86f377fda454e1826d98 /gcc | |
parent | 55d1bd59572283e06cd7662dbbf0450b5fc98753 (diff) | |
download | gcc-30281de2ce283349a61f62df7084d12c6315ef42.zip gcc-30281de2ce283349a61f62df7084d12c6315ef42.tar.gz gcc-30281de2ce283349a61f62df7084d12c6315ef42.tar.bz2 |
re PR c/61852 (Incorrect column number for -Wimplicit-function-declaration)
PR c/61852
* c-decl.c (implicit_decl_warning): Add location_t parameter. Use it.
(implicitly_declare): Pass location to implicit_decl_warning.
* gcc.dg/pr61852.c: New test.
From-SVN: r212865
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr61852.c | 10 |
4 files changed, 27 insertions, 6 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 260aa08..0106497 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2014-07-20 Marek Polacek <polacek@redhat.com> + + PR c/61852 + * c-decl.c (implicit_decl_warning): Add location_t parameter. Use it. + (implicitly_declare): Pass location to implicit_decl_warning. + 2014-07-14 Jakub Jelinek <jakub@redhat.com> PR middle-end/61294 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 0ca2e0d..425fc58 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2951,18 +2951,18 @@ pushdecl_top_level (tree x) } static void -implicit_decl_warning (tree id, tree olddecl) +implicit_decl_warning (location_t loc, tree id, tree olddecl) { if (warn_implicit_function_declaration) { bool warned; if (flag_isoc99) - warned = pedwarn (input_location, OPT_Wimplicit_function_declaration, + warned = pedwarn (loc, OPT_Wimplicit_function_declaration, "implicit declaration of function %qE", id); else - warned = warning (OPT_Wimplicit_function_declaration, - G_("implicit declaration of function %qE"), id); + warned = warning_at (loc, OPT_Wimplicit_function_declaration, + G_("implicit declaration of function %qE"), id); if (olddecl && warned) locate_old_decl (olddecl); } @@ -3015,7 +3015,7 @@ implicitly_declare (location_t loc, tree functionid) then recycle the old declaration but with the new type. */ if (!C_DECL_IMPLICIT (decl)) { - implicit_decl_warning (functionid, decl); + implicit_decl_warning (loc, functionid, decl); C_DECL_IMPLICIT (decl) = 1; } if (DECL_BUILT_IN (decl)) @@ -3052,7 +3052,7 @@ implicitly_declare (location_t loc, tree functionid) DECL_EXTERNAL (decl) = 1; TREE_PUBLIC (decl) = 1; C_DECL_IMPLICIT (decl) = 1; - implicit_decl_warning (functionid, 0); + implicit_decl_warning (loc, functionid, 0); asmspec_tree = maybe_apply_renaming_pragma (decl, /*asmname=*/NULL); if (asmspec_tree) set_user_assembler_name (decl, TREE_STRING_POINTER (asmspec_tree)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c879f56..19d3bd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-20 Marek Polacek <polacek@redhat.com> + + PR c/61852 + * gcc.dg/pr61852.c: New test. + 2014-07-19 Eric Botcazou <ebotcazou@adacore.com> * gcc.dg/stack-usage-2.c: Adjust. diff --git a/gcc/testsuite/gcc.dg/pr61852.c b/gcc/testsuite/gcc.dg/pr61852.c new file mode 100644 index 0000000..f488aca --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr61852.c @@ -0,0 +1,10 @@ +/* PR c/61852 */ +/* { dg-do compile } */ +/* { dg-options "-Wimplicit-function-declaration" } */ + +int +f (int a) +{ + int b = a + a + a + ff (a); /* { dg-warning "23:implicit declaration of function" } */ + return b; +} |