Commit 7dae2950 by Paolo Carlini Committed by Paolo Carlini

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
parent d1409ea5
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.
......
......@@ -4372,7 +4372,8 @@ 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 "
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))
......
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
......
......@@ -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);
......
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