diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2019-01-03 10:00:30 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2019-01-03 10:00:30 +0000 |
commit | 7dae295006bed4093ecbc1fda38a457338ff859b (patch) | |
tree | 19facb6202780a0dd512e3e283e6948274c30f3a /gcc | |
parent | d1409ea5a2f7597be28178e933d7fa695416ee78 (diff) | |
download | gcc-7dae295006bed4093ecbc1fda38a457338ff859b.zip gcc-7dae295006bed4093ecbc1fda38a457338ff859b.tar.gz gcc-7dae295006bed4093ecbc1fda38a457338ff859b.tar.bz2 |
tree.c (handle_nodiscard_attribute): Improve warning location.
/cp
2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
* tree.c (handle_nodiscard_attribute): Improve warning location.
/testsuite
2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp1z/nodiscard3.C: Test locations too.
From-SVN: r267547
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/nodiscard3.C | 4 |
4 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ac5832..5b94654 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2019-01-03 Paolo Carlini <paolo.carlini@oracle.com> + + * tree.c (handle_nodiscard_attribute): Improve warning location. + 2019-01-02 Marek Polacek <polacek@redhat.com> PR c++/88612 - ICE with -Waddress-of-packed-member. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6bbad5f..4db89a4 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -4372,8 +4372,9 @@ handle_nodiscard_attribute (tree *node, tree name, tree /*args*/, if (TREE_CODE (*node) == FUNCTION_DECL) { if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (*node)))) - warning (OPT_Wattributes, "%qE attribute applied to %qD with void " - "return type", name, *node); + warning_at (DECL_SOURCE_LOCATION (*node), + OPT_Wattributes, "%qE attribute applied to %qD with void " + "return type", name, *node); } else if (OVERLOAD_TYPE_P (*node)) /* OK */; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0eb3658..c077f7a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-01-03 Paolo Carlini <paolo.carlini@oracle.com> + + * g++.dg/cpp1z/nodiscard3.C: Test locations too. + 2019-01-03 Martin Liska <mliska@suse.cz> PR testsuite/88436 @@ -14,7 +18,7 @@ PR c++/81486 - CTAD failing with (). * g++.dg/cpp1z/class-deduction60.C: New test. * g++.dg/cpp1z/class-deduction61.C: New test. - + 2019-01-02 Martin Sebor <msebor@redhat.com> Jeff Law <law@redhat.com> @@ -31,7 +35,7 @@ messages only on vect_hw_misalign targets. 2019-01-02 Steven G. Kargl <kargl@gcc.gnu.org> - + * gfortran.dg/argument_checking_7.f90: Remove run-on error message. * gfortran.dg/dec_d_lines_3.f: Ditto. * gfortran.dg/dec_structure_24.f90: Ditto. diff --git a/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C b/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C index 4d24ce5..42485b7 100644 --- a/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C +++ b/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C @@ -13,8 +13,8 @@ typedef struct { char big[1024]; fnt fn; } C; struct [[nodiscard]] D { int i; D(); ~D(); }; WUR E check1 (void); -WUR void check2 (void); /* { dg-warning "nodiscard" } */ -WUR int foo; /* { dg-warning "nodiscard" } */ +WUR void check2 (void); /* { dg-warning "10:.nodiscard." } */ +WUR int foo; /* { dg-warning "9:.nodiscard." } */ int bar (void); WURAI E check3 (void) { return (E)bar (); } WUR A check4 (void); |