r183881 - Add -Wdeprecated warnings and fixits for things deprecated in C++11:

Richard Smith richard at metafoo.co.uk
Thu Jun 27 13:33:25 PDT 2013


On Thu, Jun 27, 2013 at 1:20 PM, Arthur O'Dwyer
<arthur.j.odwyer at gmail.com> wrote:
> On Thu, Jun 27, 2013 at 1:06 PM, Nico Weber <thakis at chromium.org> wrote:
>>> > On Wed, Jun 12, 2013 at 7:02 PM, Richard Smith <richard-llvm at metafoo.co.uk> wrote:
>>> >> Add -Wdeprecated warnings and fixits for things deprecated in C++11:
>>> >>  - 'register' storage class
>>
>>> >> +def warn_deprecated_register : Warning<
>>> >> +  "'register' storage class specifier is deprecated">, InGroup<Deprecated>;
>>
>> Is this a useful warning? Code generated by flex for example contains
>> register variables, and there doesn't seem much harm in that. Should this be
>> in -pedantic?

No, it can't be in -pedantic because it's not a language extension (at
least, not yet: C++17 might remove it). The point of deprecating it
was to give people time to fix the code which uses it, but that can't
happen if no-one warns on it.

I'm not sure how reasonable it is for us to avoid warning on generated
code; such code frequently contains constructs which would be
completely unreasonable if manually typed by a human. In this
particular case the code is somewhat unreasonable even to be produced
by a machine, and flex should just be fixed -- there is no good reason
to mark a variable as 'register' any more.

> IMHO, -Wdeprecated is the exactly right place for warnings about
> deprecated language constructs. I do think the warning ought to be
> individually toggleable under -Wdeprecated-register as well as being
> part of the <Deprecated> group; I had actually thought that that was
> Richard's plan. It wasn't?

That is indeed the current state. So, I think the pressing question
is, should this warning be enabled by default?



More information about the cfe-commits mailing list