]> git.ipfire.org Git - thirdparty/gcc.git/commit
Implement C++17 [[nodiscard]] attribute.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Apr 2016 19:01:19 +0000 (19:01 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Apr 2016 19:01:19 +0000 (19:01 +0000)
commitddd2a3d49aa496309f7ab3eebe1ded20da121b24
tree0f443efe47d371ec7fe124b59afcaef0d9fe8d67
parent3ae3cb42eba0091e719425ce61d3010b5cdbd430
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235597 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-lex.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/tree.c
gcc/testsuite/c-c++-common/attr-warn-unused-result.c [moved from gcc/testsuite/gcc.dg/attr-warn-unused-result.c with 98% similarity]
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
gcc/testsuite/g++.dg/cpp1z/nodiscard1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nodiscard2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nodiscard3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-result-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/unused-result1.C