[clang] Enable C++11-style attributes in all language modes
authorNikolas Klauser <nikolasklauser@berlin.de>
Sat, 22 Jul 2023 16:33:55 +0000 (09:33 -0700)
committerNikolas Klauser <nikolasklauser@berlin.de>
Sat, 22 Jul 2023 16:34:15 +0000 (09:34 -0700)
commit874217f99b99ab3c9026dc3b7bd84cd2beebde6e
treeb0720a4d0a56ba849139ee2723a81acbc89c99f5
parent1d0759e6c3c2eaa8cbacfd76d409ed80ffd9fe9d
[clang] Enable C++11-style attributes in all language modes

This also ignores and deprecates the `-fdouble-square-bracket-attributes` command line flag, which seems to not be used anywhere. At least a code search exclusively found mentions of it in documentation: https://sourcegraph.com/search?q=context:global+-fdouble-square-bracket-attributes+-file:clang/*+-file:test/Sema/*+-file:test/Parser/*+-file:test/AST/*+-file:test/Preprocessor/*+-file:test/Misc/*+archived:yes&patternType=standard&sm=0&groupBy=repo

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

This enables `[[]]` attributes in all C and C++ language modes without warning by default. `-Wc++-extensions` does warn. GCC has enabled this extension in all C modes since GCC 10.

Reviewed By: aaron.ballman, MaskRay

Spies: #clang-vendors, beanz, JDevlieghere, Michael137, MaskRay, sstefan1, jplehr, cfe-commits, lldb-commits, dmgreen, jdoerfert, wenlei, wlei

Differential Revision: https://reviews.llvm.org/D151683
48 files changed:
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/Features.def
clang/include/clang/Driver/Options.td
clang/include/clang/Parse/Parser.h
clang/lib/Basic/Attributes.cpp
clang/lib/Lex/Lexer.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/AST/ast-dump-attr.m
clang/test/AST/ast-dump-c-attr.c
clang/test/AST/attr-annotate-type.c
clang/test/CodeGen/attr-btf_type_tag-func.c
clang/test/CodeGen/attr-btf_type_tag-var.c
clang/test/Frontend/noderef.c
clang/test/OpenMP/assumes_messages_attr.c
clang/test/OpenMP/openmp_attribute_compat.cpp
clang/test/Parser/asm.c
clang/test/Parser/c2x-attributes.c
clang/test/Parser/c2x-attributes.m
clang/test/Parser/cxx-decl.cpp
clang/test/Parser/objc-attr.m
clang/test/ParserHLSL/group_shared.hlsl
clang/test/Preprocessor/has_c_attribute.c
clang/test/Sema/annotate-type.c
clang/test/Sema/annotate.c
clang/test/Sema/attr-availability-square-brackets.c
clang/test/Sema/attr-external-source-symbol-cxx.cpp
clang/test/Sema/attr-external-source-symbol.c
clang/test/Sema/attr-likelihood.c
clang/test/Sema/attr-objc-bridge-related.m
clang/test/Sema/attr-regparm.c
clang/test/Sema/attr-type-safety.c
clang/test/Sema/c2x-attr.c [new file with mode: 0644]
clang/test/Sema/c2x-noreturn.c
clang/test/Sema/internal_linkage.c
clang/test/Sema/matrix-type-builtins.c
clang/test/Sema/neon-vector-types.c
clang/test/Sema/overload-arm-mve.c
clang/test/Sema/overloadable.c
clang/test/Sema/vector-gcc-compat.c
clang/test/SemaCXX/attr-cxx-disabled.cpp [deleted file]
clang/test/SemaCXX/cxx98-compat.cpp
clang/test/SemaCXX/warn-c++11-extensions.cpp
clang/test/SemaObjC/attr-objc-gc.m
clang/unittests/AST/AttrTest.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp