[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
Mon Jul 10 14:10:37 PDT 2023


MaskRay added a comment.

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

> Aside from the failing precommit CI test case in C, I think this LGTM. I've added @MaskRay as the code owner for the command line option changes in case he's got concerns regarding the deprecation/removal plans.



  - ``-fdouble-square-bracket-attributes`` has been deprecated. It is ignored now
    and will be removed in CLang 18.

sounds good. (Minor case typo in `CLang`). As you said in

https://discourse.llvm.org/t/rfc-enable-c-11-c2x-attributes-in-all-standard-modes-as-an-extension-and-remove-fdouble-square-bracket-attributes/71268/2

> Iā€™m in support of this idea. I think we should enable the extension unconditionally for Clang 17 with a release note mentioning that -fdouble-square-bracket-attributes will be removed in Clang 18 just as a kindness to users with proprietary code bases that might be using it.

I think a clear summary/commit message should mention that this patch makes `[[...]]`` available to C++03 and C17 with no warning by default.

It's also worth calling out that GCC since 10 supports `[[]]` in all C language modes (AFAICT there is no warning even with `gcc -std=c89 -c a.c`) (there is a warning `-pedantic`).

  % g++ -c a.cc -std=c++03
  a.cc:2:1: error: expected unqualified-id before ā€˜[ā€™ token
      2 | [[nodiscard]] int without_underscores(void);
        | ^
  % myclang++ -c a.cc -std=c++03  # no warning with this patch


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