[cfe-commits] [cfe-dev] [patch] add cxx_auto and cxx_for_range to has_extension

Richard Smith richard at metafoo.co.uk
Tue Sep 6 11:06:01 PDT 2011


Hi,

On Mon, September 5, 2011 14:02, Richard Smith wrote:
> On Mon, September 5, 2011 09:20, Chandler Carruth wrote:
>> On Mon, Sep 5, 2011 at 12:46 AM, Jean-Daniel Dupas
>> <jddupas at gmail.com>wrote:
>>
>>> I just saw that a recent commit add support of "auto type" and "for
>>> range" to c++98 as language extension. (r39102: PR10458: Finesse behaviour
>>> of C++0x features when in pre-0x mode. Accept for-range and auto with an
>>> ExtWarn,
>>> and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a
>>> storage class.)
>>
>>> Shouldn't be this changed reflected in the __has_extension macro like
>>> other language extensions ?
>>>
>>> I attach a patch to fix this inconsistency.
>>
>> Seems likely good, but I'll let the person who flipped the switch chime in.
>
> The for-range part seems fine.

I've checked in the for-range half of the patch as r139149.

> If we want to enable __has_extension(cxx_auto_type), we should also update
> the documentation to indicate precisely what it means, and we might benefit
> from a separate __has_feature() flag for (a). My current preference would be
> to promote the warning to an error (and use the "extension" for error recovery
> only).

Keeping the extension, but not advertising cxx_auto_type, seems like the best
compromise: we don't support the full syntax of cxx_auto_type in C++98.

Richard




More information about the cfe-commits mailing list