Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-23 Thread Ed Smith-Rowland
On 05/22/2015 06:19 PM, Mikhail Maltsev wrote: On 22.05.2015 12:10, Marek Polacek wrote: Thanks, applied. Here's the final version. By the way, we have a feature test macro, __cpp_attributes=200809 which can be used to determine, whether C++11 attribute syntax is supported by the compiler. I

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-22 Thread Marek Polacek
On Thu, May 21, 2015 at 02:00:26PM -0400, Jason Merrill wrote: On 05/07/2015 12:22 PM, Marek Polacek wrote: - mark_used (decl); + mark_used (decl, 0); This should use tf_none rather than 0. Fixed. + build_enumerator (DECL_NAME (decl), value, newtag, +

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-22 Thread Mikhail Maltsev
On 22.05.2015 12:10, Marek Polacek wrote: Thanks, applied. Here's the final version. By the way, we have a feature test macro, __cpp_attributes=200809 which can be used to determine, whether C++11 attribute syntax is supported by the compiler. I propose to add something similar for this

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-21 Thread Jason Merrill
On 05/07/2015 12:22 PM, Marek Polacek wrote: - mark_used (decl); + mark_used (decl, 0); This should use tf_none rather than 0. + build_enumerator (DECL_NAME (decl), value, newtag, + DECL_ATTRIBUTES (decl), DECL_SOURCE_LOCATION (decl)); This is assuming

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-21 Thread Marek Polacek
I'm pinging the C++ parts. Thanks, On Thu, May 07, 2015 at 06:22:40PM +0200, Marek Polacek wrote: This (third) version of the patch entails the change in tsubst_enum Ed suggested + new testcase. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2015-05-07 Marek Polacek

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-14 Thread Joseph Myers
On Thu, 14 May 2015, Marek Polacek wrote: Ping. Joseph, do you have any further comments on the patch? The C front-end changes are OK. -- Joseph S. Myers jos...@codesourcery.com

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-14 Thread Marek Polacek
Ping. Joseph, do you have any further comments on the patch? Jason, can you review the C++ parts? Thanks, On Thu, May 07, 2015 at 06:22:40PM +0200, Marek Polacek wrote: This (third) version of the patch entails the change in tsubst_enum Ed suggested + new testcase. Bootstrapped/regtested on

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Marek Polacek
On Thu, May 07, 2015 at 11:23:51AM -0600, Sandra Loosemore wrote: How about making the new Enumerator Attributes node a subsection of the Type Attributes section, instead of a section of its own at the same level? Sorry, I don't particularly like this idea. I think an enumerator is not

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Marek Polacek
[ CC'ing Sandra: since you were recently cleaning up the attributes docs (thanks), the doc/extend.texi bits in this patch might be of interest to you. ] On Wed, May 06, 2015 at 08:44:10PM +0200, Marek Polacek wrote: 2015-05-06 Marek Polacek pola...@redhat.com PR c/47043 *

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Ed Smith-Rowland
On 05/07/2015 09:59 AM, Marek Polacek wrote: On Wed, May 06, 2015 at 11:17:20PM -0400, Ed Smith-Rowland wrote: In addition to a PR this is 1/2 of a C=+17 feature. (The other half - really a separate thing - is attributes on namespaces). Ah, nice, I wasn't aware. For the record, this is

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Marek Polacek
On Wed, May 06, 2015 at 11:17:20PM -0400, Ed Smith-Rowland wrote: In addition to a PR this is 1/2 of a C=+17 feature. (The other half - really a separate thing - is attributes on namespaces). Ah, nice, I wasn't aware. For the record, this is

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Marek Polacek
On Thu, May 07, 2015 at 10:21:28AM -0400, Ed Smith-Rowland wrote: Instead of NULL_TREE in pt.c I grabbed the attrs. /* Actually build the enumerator itself. */ build_enumerator (DECL_NAME (decl), value, newtag, DECL_ATTRIBUTES (decl), DECL_SOURCE_LOCATION (decl));

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-07 Thread Sandra Loosemore
On 05/07/2015 10:22 AM, Marek Polacek wrote: [snip] * doc/extend.texi (Enumerator Attributes): New section. Document syntax of enumerator attributes. How about making the new Enumerator Attributes node a subsection of the Type Attributes section, instead of a section of its

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-06 Thread Marek Polacek
On Wed, May 06, 2015 at 04:13:05PM +, Joseph Myers wrote: On Wed, 6 May 2015, Marek Polacek wrote: 2015-05-06 Marek Polacek pola...@redhat.com PR c/47043 * c-common.c (handle_deprecated_attribute): Allow CONST_DECL. Do all other attributes already reject CONST_DECL? I

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-06 Thread Joseph Myers
On Wed, 6 May 2015, Marek Polacek wrote: 2015-05-06 Marek Polacek pola...@redhat.com PR c/47043 * c-common.c (handle_deprecated_attribute): Allow CONST_DECL. Do all other attributes already reject CONST_DECL? I don't see any tests for unsupported attributes on enum values

Re: C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-06 Thread Ed Smith-Rowland
In addition to a PR this is 1/2 of a C=+17 feature. (The other half - really a separate thing - is attributes on namespaces). I wonder if we should pedwarn for C++17? Or it could be just an extension for C++17 - I guess that would match with clang. if (SCOPED_ENUM_P (newtag)) diff

C/C++ PATCH to allow deprecating enum values (PR c/47043)

2015-05-06 Thread Marek Polacek
This patch implements a feature quite a lot of people wanted: allow using __attribute__ ((deprecated)) on an enumerator. Implementing it was quite straightforward: parse the attributes and apply them to the CONST_DECL. I hit an issue in the C++ FE though: since r217677 we produce the deprecated