re PR c/47043 (allow deprecating enum values)
authorMarek Polacek <polacek@redhat.com>
Fri, 22 May 2015 09:07:31 +0000 (09:07 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 22 May 2015 09:07:31 +0000 (09:07 +0000)
commitfd5c817a2457050649c2aadd8657091b2f6bbdaf
tree28c0b41bb4cb2b1945924c7e303895d48ba4b7e4
parentafbe632536736558f24680aa2c4c00b2d451e0b6
re PR c/47043 (allow deprecating enum values)

PR c/47043
* c-common.c (handle_deprecated_attribute): Allow CONST_DECL.

* c-parser.c (c_parser_enum_specifier): Parse and apply enumerator
attributes.

* cp-tree.h (build_enumerator): Update declaration.
* decl.c (build_enumerator): Add attributes parameter.  Call
cplus_decl_attributes.
* init.c (constant_value_1): Pass tf_none to mark_used.
* parser.c (cp_parser_enumerator_definition): Parse attributes and
pass them down to build_enumerator.
* pt.c (tsubst_enum): Pass decl attributes to build_enumerator.
* semantics.c (finish_id_expression): Don't warn_deprecated_use here.

* doc/extend.texi (Enumerator Attributes): New section.
Document syntax of enumerator attributes.

* c-c++-common/attributes-enum-1.c: New test.
* c-c++-common/attributes-enum-2.c: New test.
* g++.dg/cpp0x/attributes-enum-1.C: New test.
* g++.dg/cpp1y/attributes-enum-1.C: New test.

Co-Authored-By: Edward Smith-Rowland <3dw4rd@verizon.net>
From-SVN: r223527
18 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/attributes-enum-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/attributes-enum-2.c [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/attributes-enum-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/attributes-enum-1.C [new file with mode: 0644]