[PATCH] D151683: [clang] Enable C++11-style attributes in all language modes

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 14:54:27 PDT 2023


MaskRay added a comment.

In D151683#4409633 <https://reviews.llvm.org/D151683#4409633>, @aaron.ballman wrote:

> In D151683#4384017 <https://reviews.llvm.org/D151683#4384017>, @erichkeane wrote:
>
>> In D151683#4382408 <https://reviews.llvm.org/D151683#4382408>, @philnik wrote:
>>
>>> No. I guess, since you are asking I should write one for this? Only for the removal of `-fdouble-square-bracket-attributes`, or also for back porting this?
>>
>> The RFC I would expect for "allow C/C++ style attributes as an extension in previous modes".  This is a pretty significant feature to allow as an extension, particularly since our two main alternative compilers (G++/MSVC) don't have this as an extension. I'd be curious how the other C compilers do this as well.
>
> I think this does warrant an RFC because it impacts both C++ and C, but I'm hoping the RFC is uncontroversial. It's mostly to establish what the use cases are for needing the extension. The feature is conforming as an extension to both languages, and I don't know of any breakage that would come from enabling it by default. I'm not certain whether we want to remove the feature flag immediately or whether we'd like to give one release of warning about it being removed (I'll defer to whatever @MaskRay thinks is reasonable) -- that search is compelling for why it's safe to remove the option, but there's plenty of proprietary code which we don't know about, so it's possible the option is still used. I'd be especially curious to know if anyone is using `-fno-double-square-bracket-attributes` to disable the feature in a mode where it would otherwise be enabled. I'm adding the `clang-vendors` group as a subscriber as an early warning that removing the command line option could be a potentially breaking change.
>
> In terms of implementation work, there's still some minor stuff to address. Also, please be sure to also add a release note about the changes, and a potentially breaking entry for removing the command line option (assuming we elect to go that route).

If allowing the extension in older language modes deems good, removing `-fno-double-square-bracket-attributes` seems fine if (and thanks for CCing the `clang-vendors` group).
If we want to play safely, we can default `-fdouble-square-bracket-attributes` to true in this patch and remove the option in a follow-up change possibly after some time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151683/new/

https://reviews.llvm.org/D151683



More information about the cfe-commits mailing list