This is the mail archive of the
gcc-cvs@gcc.gnu.org
mailing list for the GCC project.
r235597 - in /trunk/gcc: c-family/ChangeLog c-f...
- From: jason at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Thu, 28 Apr 2016 19:01:20 -0000
- Subject: r235597 - in /trunk/gcc: c-family/ChangeLog c-f...
Author: jason
Date: Thu Apr 28 19:01:19 2016
New Revision: 235597
URL: https://gcc.gnu.org/viewcvs?rev=235597&root=gcc&view=rev
Log:
Implement C++17 [[nodiscard]] attribute.
PR c++/38172
PR c++/54379
gcc/c-family/
* c-lex.c (c_common_has_attribute): Handle nodiscard.
gcc/cp/
* parser.c (cp_parser_std_attribute): Handle [[nodiscard]].
* tree.c (handle_nodiscard_attribute): New.
(cxx_attribute_table): Add [[nodiscard]].
* cvt.c (cp_get_fndecl_from_callee, cp_get_callee_fndecl): New.
(maybe_warn_nodiscard): New.
(convert_to_void): Call it.
Added:
trunk/gcc/testsuite/c-c++-common/attr-warn-unused-result.c
- copied, changed from r235596, trunk/gcc/testsuite/gcc.dg/attr-warn-unused-result.c
trunk/gcc/testsuite/g++.dg/cpp1z/nodiscard1.C
trunk/gcc/testsuite/g++.dg/cpp1z/nodiscard2.C
trunk/gcc/testsuite/g++.dg/cpp1z/nodiscard3.C
trunk/gcc/testsuite/g++.dg/warn/Wunused-result-2.C
Removed:
trunk/gcc/testsuite/gcc.dg/attr-warn-unused-result.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-lex.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/cvt.c
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
trunk/gcc/testsuite/g++.dg/warn/unused-result1.C