[clang] 874217f - [clang] Enable C++11-style attributes in all language modes

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 22 09:34:22 PDT 2023


Author: Nikolas Klauser
Date: 2023-07-22T09:34:15-07:00
New Revision: 874217f99b99ab3c9026dc3b7bd84cd2beebde6e

URL: https://github.com/llvm/llvm-project/commit/874217f99b99ab3c9026dc3b7bd84cd2beebde6e
DIFF: https://github.com/llvm/llvm-project/commit/874217f99b99ab3c9026dc3b7bd84cd2beebde6e.diff

LOG: [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

Added: 
    clang/test/Sema/c2x-attr.c

Modified: 
    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-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/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

Removed: 
    clang/test/SemaCXX/attr-cxx-disabled.cpp


################################################################################
diff  --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 38a73f31064874..6705ee176196cc 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1429,15 +1429,15 @@ More information could be found `here <https://clang.llvm.org/docs/Modules.html>
 Language Extensions Back-ported to Previous Standards
 =====================================================
 
-====================================== ================================ ============= ============= ==================================
-Feature                                Feature Test Macro               Introduced In Backported To Required Flags
-====================================== ================================ ============= ============= ==================================
+====================================== ================================ ============= =============
+Feature                                Feature Test Macro               Introduced In Backported To
+====================================== ================================ ============= =============
 variadic templates                     __cpp_variadic_templates         C++11         C++03
 Alias templates                        __cpp_alias_templates            C++11         C++03
 Non-static data member initializers    __cpp_nsdmi                      C++11         C++03
 Range-based ``for`` loop               __cpp_range_based_for            C++11         C++03
 RValue references                      __cpp_rvalue_references          C++11         C++03
-Attributes                             __cpp_attributes                 C++11         C++03         -fdouble-square-bracket-attributes
+Attributes                             __cpp_attributes                 C++11         C++03
 variable templates                     __cpp_variable_templates         C++14         C++03
 Binary literals                        __cpp_binary_literals            C++14         C++03
 Relaxed constexpr                      __cpp_constexpr                  C++14         C++11
@@ -1457,10 +1457,11 @@ Conditional ``explicit``               __cpp_conditional_explicit       C++20
 ``using enum``                         __cpp_using_enum                 C++20         C++03
 ``if consteval``                       __cpp_if_consteval               C++23         C++20
 ``static operator()``                  __cpp_static_call_operator       C++23         C++03
--------------------------------------- -------------------------------- ------------- ------------- ----------------------------------
+-------------------------------------- -------------------------------- ------------- -------------
 Designated initializers (N494)                                          C99           C89
 Array & element qualification (N2607)                                   C2x           C89
-====================================== ================================ ============= ============= ==================================
+Attributes (N2335)                                                      C2x           C89
+====================================== ================================ ============= =============
 
 Type Trait Primitives
 =====================

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f412e790d88b8a..1944605f09a25f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -277,6 +277,9 @@ New Compiler Flags
 Deprecated Compiler Flags
 -------------------------
 
+- ``-fdouble-square-bracket-attributes`` has been deprecated. It is ignored now
+  and will be removed in Clang 18.
+
 Modified Compiler Flags
 -----------------------
 

diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 4b1dcc89e7cae8..8d729c31641ed8 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -719,8 +719,17 @@ def warn_cxx14_compat_ns_enum_attribute : Warning<
 def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
 def warn_cxx98_compat_attribute : Warning<
-  "C++11 attribute syntax is incompatible with C++98">,
+  "[[]] attributes are incompatible with C++ standards before C++11">,
   InGroup<CXX98Compat>, DefaultIgnore;
+def warn_ext_cxx11_attributes : Extension<
+  "[[]] attributes are a C++11 extension">,
+  InGroup<CXX11>;
+def warn_pre_c2x_compat_attributes : Warning<
+  "[[]] attributes are incompatible with C standards before C2x">,
+  DefaultIgnore, InGroup<CPre2xCompat>;
+def warn_ext_c2x_attributes : Extension<
+  "[[]] attributes are a C2x extension">,
+  InGroup<C2x>;
 def err_cxx11_attribute_forbids_arguments : Error<
   "attribute %0 cannot have an argument list">;
 def err_attribute_requires_arguments : Error<

diff  --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index 1eb4573a8f7fef..e05ac46258272c 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -245,6 +245,8 @@ EXTENSION(c_generic_selections, true)
 EXTENSION(c_generic_selection_with_controlling_type, true)
 EXTENSION(c_static_assert, true)
 EXTENSION(c_thread_local, PP.getTargetInfo().isTLSSupported())
+// C2x features supported by other languages as extensions
+EXTENSION(c_attributes, true)
 // C++11 features supported by other languages as extensions.
 EXTENSION(cxx_atomic, LangOpts.CPlusPlus)
 EXTENSION(cxx_default_function_template_args, LangOpts.CPlusPlus)

diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index d60f66377a7a50..229f6141c750fe 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1267,9 +1267,7 @@ def fast : Flag<["-"], "fast">, Group<f_Group>;
 def fasynchronous_unwind_tables : Flag<["-"], "fasynchronous-unwind-tables">, Group<f_Group>;
 
 defm double_square_bracket_attributes : BoolFOption<"double-square-bracket-attributes",
-  LangOpts<"DoubleSquareBracketAttributes">, Default<!strconcat(cpp11.KeyPath, "||", c2x.KeyPath)>,
-  PosFlag<SetTrue, [], "Enable">, NegFlag<SetFalse, [], "Disable">,
-  BothFlags<[NoXarchOption, CC1Option], " '[[]]' attributes in all C and C++ language modes">>;
+  LangOpts<"DoubleSquareBracketAttributes">, DefaultTrue, PosFlag<SetTrue>, NegFlag<SetFalse>>;
 
 defm autolink : BoolFOption<"autolink",
   CodeGenOpts<"Autolink">, DefaultTrue,

diff  --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 077ebf4e5d8656..475dfe845528d9 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -2712,12 +2712,6 @@ class Parser : public CodeCompletionHandler {
 private:
   void ParseBlockId(SourceLocation CaretLoc);
 
-  /// Are [[]] attributes enabled?
-  bool standardAttributesAllowed() const {
-    const LangOptions &LO = getLangOpts();
-    return LO.DoubleSquareBracketAttributes;
-  }
-
   /// Return true if the next token should be treated as a [[]] attribute,
   /// or as a keyword that behaves like one.  The former is only true if
   /// [[]] attributes are enabled, whereas the latter is true whenever
@@ -2726,15 +2720,14 @@ class Parser : public CodeCompletionHandler {
   bool isAllowedCXX11AttributeSpecifier(bool Disambiguate = false,
                                         bool OuterMightBeMessageSend = false) {
     return (Tok.isRegularKeywordAttribute() ||
-            (standardAttributesAllowed() &&
-             isCXX11AttributeSpecifier(Disambiguate, OuterMightBeMessageSend)));
+            isCXX11AttributeSpecifier(Disambiguate, OuterMightBeMessageSend));
   }
 
   // Check for the start of an attribute-specifier-seq in a context where an
   // attribute is not allowed.
   bool CheckProhibitedCXX11Attribute() {
     assert(Tok.is(tok::l_square));
-    if (!standardAttributesAllowed() || NextToken().isNot(tok::l_square))
+    if (NextToken().isNot(tok::l_square))
       return false;
     return DiagnoseProhibitedCXX11Attribute();
   }
@@ -2742,13 +2735,10 @@ class Parser : public CodeCompletionHandler {
   bool DiagnoseProhibitedCXX11Attribute();
   void CheckMisplacedCXX11Attribute(ParsedAttributes &Attrs,
                                     SourceLocation CorrectLocation) {
-    if (!Tok.isRegularKeywordAttribute()) {
-      if (!standardAttributesAllowed())
-        return;
-      if ((Tok.isNot(tok::l_square) || NextToken().isNot(tok::l_square)) &&
-          Tok.isNot(tok::kw_alignas))
-        return;
-    }
+    if (!Tok.isRegularKeywordAttribute() &&
+        (Tok.isNot(tok::l_square) || NextToken().isNot(tok::l_square)) &&
+        Tok.isNot(tok::kw_alignas))
+      return;
     DiagnoseMisplacedCXX11Attribute(Attrs, CorrectLocation);
   }
   void DiagnoseMisplacedCXX11Attribute(ParsedAttributes &Attrs,

diff  --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index da339d5b1bab6a..6c0cc87430eede 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -33,8 +33,7 @@ int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
   // attributes. We support those, but not through the typical attribute
   // machinery that goes through TableGen. We support this in all OpenMP modes
   // so long as double square brackets are enabled.
-  if (LangOpts.OpenMP && LangOpts.DoubleSquareBracketAttributes &&
-      ScopeName == "omp")
+  if (LangOpts.OpenMP && ScopeName == "omp")
     return (Name == "directive" || Name == "sequence") ? 1 : 0;
 
   int res = hasAttributeImpl(Syntax, Name, ScopeName, Target, LangOpts);

diff  --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 3070407997b2c5..3637f842046223 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -4224,9 +4224,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
     if (LangOpts.Digraphs && Char == '>') {
       Kind = tok::r_square; // ':>' -> ']'
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
-    } else if ((LangOpts.CPlusPlus ||
-                LangOpts.DoubleSquareBracketAttributes) &&
-               Char == ':') {
+    } else if (Char == ':') {
       Kind = tok::coloncolon;
       CurPtr = ConsumeChar(CurPtr, SizeTmp, Result);
     } else {
@@ -4443,8 +4441,7 @@ bool Lexer::LexDependencyDirectiveToken(Token &Result) {
     Result.setLiteralData(TokPtr);
     return true;
   }
-  if (Result.is(tok::colon) &&
-      (LangOpts.CPlusPlus || LangOpts.DoubleSquareBracketAttributes)) {
+  if (Result.is(tok::colon)) {
     // Convert consecutive colons to 'tok::coloncolon'.
     if (*BufferPtr == ':') {
       assert(DepDirectives.front().Tokens[NextDepDirectiveTokenIndex].is(

diff  --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 742f3ac0b6f64a..c1e09db2b3eeff 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -4506,7 +4506,13 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
          "Not a double square bracket attribute list");
 
   SourceLocation OpenLoc = Tok.getLocation();
-  Diag(OpenLoc, diag::warn_cxx98_compat_attribute);
+  if (getLangOpts().CPlusPlus) {
+    Diag(OpenLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_attribute
+                                            : diag::warn_ext_cxx11_attributes);
+  } else {
+    Diag(OpenLoc, getLangOpts().C2x ? diag::warn_pre_c2x_compat_attributes
+                                    : diag::warn_ext_c2x_attributes);
+  }
 
   ConsumeBracket();
   checkCompoundToken(OpenLoc, tok::l_square, CompoundToken::AttrBegin);
@@ -4621,8 +4627,6 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
 /// attribute-specifier-seq:
 ///       attribute-specifier-seq[opt] attribute-specifier
 void Parser::ParseCXX11Attributes(ParsedAttributes &Attrs) {
-  assert(standardAttributesAllowed() || Tok.isRegularKeywordAttribute());
-
   SourceLocation StartLoc = Tok.getLocation();
   SourceLocation EndLoc = StartLoc;
 

diff  --git a/clang/test/AST/ast-dump-attr.m b/clang/test/AST/ast-dump-attr.m
index c4a769d85e55c9..eef07384b84faa 100644
--- a/clang/test/AST/ast-dump-attr.m
+++ b/clang/test/AST/ast-dump-attr.m
@@ -1,12 +1,12 @@
 // Test without serialization:
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 \
 // RUN: -ast-dump -ast-dump-filter Test %s \
 // RUN: | FileCheck --strict-whitespace %s
 //
 // Test with serialization:
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 \
 // RUN: -emit-pch -o %t %s
-// RUN: %clang_cc1 -x objective-c -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: %clang_cc1 -x objective-c -triple x86_64-apple-macosx10.10.0 \
 // RUN: -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN: | FileCheck --strict-whitespace %s

diff  --git a/clang/test/AST/ast-dump-c-attr.c b/clang/test/AST/ast-dump-c-attr.c
index f1d76deeb472da..c8e0d89827f802 100644
--- a/clang/test/AST/ast-dump-c-attr.c
+++ b/clang/test/AST/ast-dump-c-attr.c
@@ -1,12 +1,12 @@
 // Test without serialization:
-// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
+// RUN: %clang_cc1 -triple x86_64-pc-linux \
 // RUN: -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s \
 // RUN: | FileCheck --strict-whitespace %s
 //
 // Test with serialization:
-// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
+// RUN: %clang_cc1 -triple x86_64-pc-linux \
 // RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
+// RUN: %clang_cc1 -x c -triple x86_64-pc-linux \
 // RUN: -Wno-deprecated-declarations -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN: | FileCheck --strict-whitespace %s

diff  --git a/clang/test/AST/attr-annotate-type.c b/clang/test/AST/attr-annotate-type.c
index 115fd5912d75b9..4aa0b1618b719d 100644
--- a/clang/test/AST/attr-annotate-type.c
+++ b/clang/test/AST/attr-annotate-type.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -ast-dump -fdouble-square-bracket-attributes | FileCheck %s
+// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
 
 // Verify that we print the [[clang::annotate_type]] attribute.
 // FIXME: The arguments are currently not printed -- see also comments in

diff  --git a/clang/test/CodeGen/attr-btf_type_tag-func.c b/clang/test/CodeGen/attr-btf_type_tag-func.c
index a4a22f36c1bb96..c573d1147ccd7e 100644
--- a/clang/test/CodeGen/attr-btf_type_tag-func.c
+++ b/clang/test/CodeGen/attr-btf_type_tag-func.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple %itanium_abi_triple -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -DDOUBLE_BRACKET_ATTRS=1 -fdouble-square-bracket-attributes -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -DDOUBLE_BRACKET_ATTRS=1 -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
 
 #if DOUBLE_BRACKET_ATTRS
 #define __tag1 [[clang::btf_type_tag("tag1")]]

diff  --git a/clang/test/CodeGen/attr-btf_type_tag-var.c b/clang/test/CodeGen/attr-btf_type_tag-var.c
index 0bb0a617281092..ccc4edd22c1ccb 100644
--- a/clang/test/CodeGen/attr-btf_type_tag-var.c
+++ b/clang/test/CodeGen/attr-btf_type_tag-var.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple %itanium_abi_triple -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -DDOUBLE_BRACKET_ATTRS=1 -fdouble-square-bracket-attributes -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -DDOUBLE_BRACKET_ATTRS=1 -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck %s
 
 #if DOUBLE_BRACKET_ATTRS
 #define __tag1 [[clang::btf_type_tag("tag1")]]

diff  --git a/clang/test/Frontend/noderef.c b/clang/test/Frontend/noderef.c
index daf2d6006b2d75..a376f2d68d91b8 100644
--- a/clang/test/Frontend/noderef.c
+++ b/clang/test/Frontend/noderef.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-unused-value -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -Wno-unused-value -verify %s
 
 #define NODEREF __attribute__((noderef))
 

diff  --git a/clang/test/OpenMP/assumes_messages_attr.c b/clang/test/OpenMP/assumes_messages_attr.c
index 227f32b9abc75d..c9fc68ce65d35d 100644
--- a/clang/test/OpenMP/assumes_messages_attr.c
+++ b/clang/test/OpenMP/assumes_messages_attr.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -std=c99 -fms-extensions -fdouble-square-bracket-attributes -Wno-pragma-pack %s
-// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -std=c99 -fms-extensions -fdouble-square-bracket-attributes -Wno-pragma-pack %s
+// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -std=c99 -fms-extensions -Wno-pragma-pack %s
+// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -std=c99 -fms-extensions -Wno-pragma-pack %s
 
 [[omp::directive(assumes)]]; // expected-error {{expected at least one 'ext_', 'absent', 'contains', 'holds', 'no_openmp', 'no_openmp_routines', 'no_parallelism' clause for '#pragma omp assumes'}}
 [[omp::directive(begin)]]; // expected-error {{expected an OpenMP directive}}

diff  --git a/clang/test/OpenMP/openmp_attribute_compat.cpp b/clang/test/OpenMP/openmp_attribute_compat.cpp
index 332fc2c6c23657..69b809d45b43c6 100644
--- a/clang/test/OpenMP/openmp_attribute_compat.cpp
+++ b/clang/test/OpenMP/openmp_attribute_compat.cpp
@@ -7,13 +7,12 @@
 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fsyntax-only -verify=off -Wno-openmp %s
 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fsyntax-only -verify=off -Wno-openmp-51-extensions %s
 
-// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify=pre -Wpre-openmp-51-compat -x c -fdouble-square-bracket-attributes %s
-// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify=off -x c -std=c2x %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fsyntax-only -verify=ext -Wopenmp -x c -std=c2x %s
+// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify=pre -Wpre-openmp-51-compat -x c -std=c2x %s
+// RUN-: %clang_cc1 -fopenmp -fsyntax-only -verify=off -x c -std=c2x %s
+// RUN-: %clang_cc1 -fopenmp -fopenmp-version=50 -fsyntax-only -verify=ext -Wopenmp -x c -std=c2x %s
 
 // off-no-diagnostics
 
 int x;
 [[omp::directive(threadprivate(x))]]; // pre-warning {{specifying OpenMP directives with [[]] is incompatible with OpenMP standards before OpenMP 5.1}} \
                                       // ext-warning {{specifying OpenMP directives with [[]] is an OpenMP 5.1 extension}}
-

diff  --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c
index 480acb7b6ffd9e..0b36363d9beb74 100644
--- a/clang/test/Parser/asm.c
+++ b/clang/test/Parser/asm.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 
 #if !__has_extension(gnu_asm)
 #error Extension 'gnu_asm' should be available by default

diff  --git a/clang/test/Parser/c2x-attributes.c b/clang/test/Parser/c2x-attributes.c
index e3201e2315d2f9..3e9469f8fa8b5f 100644
--- a/clang/test/Parser/c2x-attributes.c
+++ b/clang/test/Parser/c2x-attributes.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify=expected,notc2x -Wno-strict-prototypes %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,notc2x -Wno-strict-prototypes %s
 // RUN: %clang_cc1 -fsyntax-only -std=gnu2x -verify=expected,c2x %s
 
 enum [[]] E {

diff  --git a/clang/test/Parser/c2x-attributes.m b/clang/test/Parser/c2x-attributes.m
index f4610416cddc74..2cce8990d2a2cf 100644
--- a/clang/test/Parser/c2x-attributes.m
+++ b/clang/test/Parser/c2x-attributes.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 // expected-no-diagnostics
 
 enum __attribute__((deprecated)) E1 : int; // ok

diff  --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
index 725141d138fd64..a7852da97fdd4a 100644
--- a/clang/test/Parser/cxx-decl.cpp
+++ b/clang/test/Parser/cxx-decl.cpp
@@ -196,12 +196,9 @@ namespace PR15017 {
 }
 
 // Ensure we produce at least some diagnostic for attributes in C++98.
-[[]] struct S;
-#if __cplusplus <= 199711L
-// expected-error at -2 {{expected expression}}
-// expected-error at -3 {{expected unqualified-id}}
-#else
-// expected-error at -5 {{misplaced attributes}}
+[[]] struct S; // expected-error {{misplaced attributes}}
+#if __cplusplus < 201103L
+// expected-error at -2 {{[[]] attributes are a C++11 extension}}
 #endif
 
 namespace test7 {

diff  --git a/clang/test/Parser/objc-attr.m b/clang/test/Parser/objc-attr.m
index 7e65eff745da67..e214cf574a4a7a 100644
--- a/clang/test/Parser/objc-attr.m
+++ b/clang/test/Parser/objc-attr.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify %s
 // expected-no-diagnostics
 
 @interface NSObject

diff  --git a/clang/test/ParserHLSL/group_shared.hlsl b/clang/test/ParserHLSL/group_shared.hlsl
index d516f700860776..0b9f28395ee486 100644
--- a/clang/test/ParserHLSL/group_shared.hlsl
+++ b/clang/test/ParserHLSL/group_shared.hlsl
@@ -8,9 +8,6 @@ extern float groupshared f; // Ok, redeclaration?
 // expected-warning at +1 {{'auto' type specifier is a C++11 extension}}
 auto l = []() groupshared  {};
 
-
-// NOTE: remove this error once [[]] attribute is supported except for hlsl202x.
-// expected-error at +1 {{expected expression}}
 float groupshared [[]] i = 12;
 
 float groupshared const i2 = 12;

diff  --git a/clang/test/Preprocessor/has_c_attribute.c b/clang/test/Preprocessor/has_c_attribute.c
index 1da4d0541e6e0d..2f4fdf1679485f 100644
--- a/clang/test/Preprocessor/has_c_attribute.c
+++ b/clang/test/Preprocessor/has_c_attribute.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -std=c11 -E -P %s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c11 -E -P %s -o - | FileCheck %s
 // RUN: %clang_cc1 -std=c2x -E -P %s -o - | FileCheck %s
 
 #define C2x(x) x: __has_c_attribute(x)

diff  --git a/clang/test/Sema/annotate-type.c b/clang/test/Sema/annotate-type.c
index 266e13885389c2..9fd95f953c5d48 100644
--- a/clang/test/Sema/annotate-type.c
+++ b/clang/test/Sema/annotate-type.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -fdouble-square-bracket-attributes -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
 
 const char *some_function();
 

diff  --git a/clang/test/Sema/annotate.c b/clang/test/Sema/annotate.c
index 2eb051267590a8..2e7a37936fedec 100644
--- a/clang/test/Sema/annotate.c
+++ b/clang/test/Sema/annotate.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -fdouble-square-bracket-attributes -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
 
 void __attribute__((annotate("foo"))) foo(float *a) {
   __attribute__((annotate("bar"))) int x;

diff  --git a/clang/test/Sema/attr-availability-square-brackets.c b/clang/test/Sema/attr-availability-square-brackets.c
index 26166b5c62ef53..04059cf1ba825e 100644
--- a/clang/test/Sema/attr-availability-square-brackets.c
+++ b/clang/test/Sema/attr-availability-square-brackets.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify %s
 
 [[clang::availability(macosx,introduced=10.4,deprecated=10.2)]] void f0(void); // expected-warning{{feature cannot be deprecated in macOS version 10.2 before it was introduced in version 10.4; attribute ignored}}
 [[clang::availability(ios,obsoleted=2.1,deprecated=3.0)]] void f1(void);  // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}

diff  --git a/clang/test/Sema/attr-external-source-symbol-cxx.cpp b/clang/test/Sema/attr-external-source-symbol-cxx.cpp
index af5da4909b3997..91cb219206add5 100644
--- a/clang/test/Sema/attr-external-source-symbol-cxx.cpp
+++ b/clang/test/Sema/attr-external-source-symbol-cxx.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -fdouble-square-bracket-attributes %s
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
 
 template<class T>
 class Class {

diff  --git a/clang/test/Sema/attr-external-source-symbol.c b/clang/test/Sema/attr-external-source-symbol.c
index 7301b83ebfdeb0..8ecd790f33c8f3 100644
--- a/clang/test/Sema/attr-external-source-symbol.c
+++ b/clang/test/Sema/attr-external-source-symbol.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -fdouble-square-bracket-attributes %s
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
 
 void threeClauses(void) __attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
 

diff  --git a/clang/test/Sema/attr-likelihood.c b/clang/test/Sema/attr-likelihood.c
index 2c34d29002268f..955216f8fd215f 100644
--- a/clang/test/Sema/attr-likelihood.c
+++ b/clang/test/Sema/attr-likelihood.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -fdouble-square-bracket-attributes -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify
 
 void g(void) {
   if (1)

diff  --git a/clang/test/Sema/attr-objc-bridge-related.m b/clang/test/Sema/attr-objc-bridge-related.m
index bf059ba018607a..7b2e3e5df3fe54 100644
--- a/clang/test/Sema/attr-objc-bridge-related.m
+++ b/clang/test/Sema/attr-objc-bridge-related.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -fdouble-square-bracket-attributes %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
 
 struct [[clang::objc_bridge_related(NSParagraphStyle,,)]] TestBridgedRef;
 

diff  --git a/clang/test/Sema/attr-regparm.c b/clang/test/Sema/attr-regparm.c
index c18367993d65e2..1fd54a5b6656e9 100644
--- a/clang/test/Sema/attr-regparm.c
+++ b/clang/test/Sema/attr-regparm.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
 
 __attribute((regparm(2))) int x0(void);
 __attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires an integer constant}}

diff  --git a/clang/test/Sema/attr-type-safety.c b/clang/test/Sema/attr-type-safety.c
index d7dab5d30760e9..f1027738f6083e 100644
--- a/clang/test/Sema/attr-type-safety.c
+++ b/clang/test/Sema/attr-type-safety.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 
 struct A {};
 

diff  --git a/clang/test/Sema/c2x-attr.c b/clang/test/Sema/c2x-attr.c
new file mode 100644
index 00000000000000..dbeafb24c64b68
--- /dev/null
+++ b/clang/test/Sema/c2x-attr.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c2x -Wpre-c2x-compat -verify=pre-c2x %s
+// RUN: %clang_cc1 -fsyntax-only -std=c17 -Wc2x-extensions -verify=c2x-ext %s
+
+[[]] void func(); // pre-c2x-warning {{[[]] attributes are incompatible with C standards before C2x}}
+                  // c2x-ext-warning at -1 {{[[]] attributes are a C2x extension}}

diff  --git a/clang/test/Sema/c2x-noreturn.c b/clang/test/Sema/c2x-noreturn.c
index cc276877c28603..18b630de50e2c0 100644
--- a/clang/test/Sema/c2x-noreturn.c
+++ b/clang/test/Sema/c2x-noreturn.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -verify=all,c2x -std=c2x -fsyntax-only %s
-// RUN: %clang_cc1 -verify=all -std=c17 -fdouble-square-bracket-attributes -fsyntax-only %s
+// RUN: %clang_cc1 -verify=all -std=c17 -fsyntax-only %s
 // RUN: %clang_cc1 -verify=none -Wno-deprecated-attributes -D_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS -std=c2x -fsyntax-only %s
-// RUN: %clang_cc1 -verify=none -Wno-deprecated-attributes -D_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS -std=c17 -fdouble-square-bracket-attributes -fsyntax-only %s
+// RUN: %clang_cc1 -verify=none -Wno-deprecated-attributes -D_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS -std=c17 -fsyntax-only %s
 // none-no-diagnostics
 
 // Test preprocessor functionality.

diff  --git a/clang/test/Sema/internal_linkage.c b/clang/test/Sema/internal_linkage.c
index 79e04885b97774..a0c421527e801f 100644
--- a/clang/test/Sema/internal_linkage.c
+++ b/clang/test/Sema/internal_linkage.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fdouble-square-bracket-attributes %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 
 int var __attribute__((internal_linkage));
 int var2 __attribute__((internal_linkage,common)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \

diff  --git a/clang/test/Sema/matrix-type-builtins.c b/clang/test/Sema/matrix-type-builtins.c
index d684f765aa1a57..43f39f26568e14 100644
--- a/clang/test/Sema/matrix-type-builtins.c
+++ b/clang/test/Sema/matrix-type-builtins.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fenable-matrix -fdouble-square-bracket-attributes -pedantic -verify -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 %s -fenable-matrix -pedantic -verify -triple=x86_64-apple-darwin9
 
 typedef float sx5x10_t __attribute__((matrix_type(5, 10)));
 typedef int ix3x2_t __attribute__((matrix_type(3, 2)));
@@ -8,17 +8,17 @@ typedef unsigned ix3x3 __attribute__((matrix_type(3, 3)));
 // Verify that we can use the [[]] spelling of the attribute.
 // We intentionally use the same type alias name to check that both versions
 // define the same type.
-typedef float [[clang::matrix_type(5, 10)]] sx5x10_t;
-typedef int [[clang::matrix_type(3, 2)]] ix3x2_t;
-[[clang::matrix_type(5, 10)]] typedef float sx5x10_t;
+typedef float [[clang::matrix_type(5, 10)]] sx5x10_t; // expected-warning {{[[]] attributes are a C2x extension}}
+typedef int [[clang::matrix_type(3, 2)]] ix3x2_t; // expected-warning {{[[]] attributes are a C2x extension}}
+[[clang::matrix_type(5, 10)]] typedef float sx5x10_t; // expected-warning {{[[]] attributes are a C2x extension}}
 // expected-warning at -1 {{applying attribute 'matrix_type' to a declaration is deprecated; apply it to the type instead}}
-[[clang::matrix_type(3, 2)]] typedef int ix3x2_t;
+[[clang::matrix_type(3, 2)]] typedef int ix3x2_t; // expected-warning {{[[]] attributes are a C2x extension}}
 // expected-warning at -1 {{applying attribute 'matrix_type' to a declaration is deprecated; apply it to the type instead}}
 
 // Attribute may not be used outside typedefs.
-[[clang::matrix_type(3, 2)]] int ix3x2_var;
+[[clang::matrix_type(3, 2)]] int ix3x2_var; // expected-warning {{[[]] attributes are a C2x extension}}
 // expected-error at -1 {{'matrix_type' attribute only applies to typedefs}}
-int [[clang::matrix_type(3, 2)]] ix3x2_var;
+int [[clang::matrix_type(3, 2)]] ix3x2_var; // expected-warning {{[[]] attributes are a C2x extension}}
 // expected-error at -1 {{'matrix_type' attribute only applies to typedefs}}
 
 void transpose(sx5x10_t a, ix3x2_t b, dx3x3 c, int *d, int e) {

diff  --git a/clang/test/Sema/neon-vector-types.c b/clang/test/Sema/neon-vector-types.c
index c79c73919a927f..fbe7d854dfd7d8 100644
--- a/clang/test/Sema/neon-vector-types.c
+++ b/clang/test/Sema/neon-vector-types.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -triple armv7 -target-feature +neon -fsyntax-only -fdouble-square-bracket-attributes -verify
-// RUN: %clang_cc1 %s -triple armv8 -target-feature +neon -fsyntax-only -fdouble-square-bracket-attributes -verify
+// RUN: %clang_cc1 %s -triple armv7 -target-feature +neon -fsyntax-only -verify
+// RUN: %clang_cc1 %s -triple armv8 -target-feature +neon -fsyntax-only -verify
 
 typedef float float32_t;
 typedef signed char poly8_t;

diff  --git a/clang/test/Sema/overload-arm-mve.c b/clang/test/Sema/overload-arm-mve.c
index 9ad1bfcc882f76..b419ba3c3203e3 100644
--- a/clang/test/Sema/overload-arm-mve.c
+++ b/clang/test/Sema/overload-arm-mve.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -flax-vector-conversions=all -fdouble-square-bracket-attributes -Werror -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -flax-vector-conversions=all -fdouble-square-bracket-attributes -verify -fsyntax-only -DERROR_CHECK %s
+// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -flax-vector-conversions=all -Werror -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -flax-vector-conversions=all -verify -fsyntax-only -DERROR_CHECK %s
 
 typedef   signed short      int16_t;
 typedef   signed int        int32_t;

diff  --git a/clang/test/Sema/overloadable.c b/clang/test/Sema/overloadable.c
index 42d04a52f8c7cf..9eecad18064e21 100644
--- a/clang/test/Sema/overloadable.c
+++ b/clang/test/Sema/overloadable.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s -Wincompatible-pointer-types -Wno-strict-prototypes
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wincompatible-pointer-types -Wno-strict-prototypes
 
 int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute only applies to functions}}
 void bad_attr_target(int) [[clang::overloadable]]; // expected-error{{'overloadable' attribute cannot be applied to types}}

diff  --git a/clang/test/Sema/vector-gcc-compat.c b/clang/test/Sema/vector-gcc-compat.c
index 36feb7fd1422c9..a3107945c1f5b3 100644
--- a/clang/test/Sema/vector-gcc-compat.c
+++ b/clang/test/Sema/vector-gcc-compat.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only -fdouble-square-bracket-attributes -Weverything -Wno-unused-but-set-variable -triple x86_64-apple-darwin10
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Weverything -Wno-unused-but-set-variable -triple x86_64-apple-darwin10
 
 // Test the compatibility of clang's vector extensions with gcc's vector
 // extensions for C. Notably &&, ||, ?: and ! are not available.
@@ -20,17 +20,14 @@ typedef int v4i32 __attribute((vector_size(16)));
 // Verify that we can use the [[]] spelling of the attribute.
 // We intentionally use the same type alias name to check that both versions
 // define the same type.
-// FIXME: Warnings are nuisance warnings due to the `-Weverything` flag, but
-// we shouldn't really be emitting them in C mode with the
-// `-fdouble-square-bracket-attributes` flag.
-typedef long long v2i64 [[gnu::vector_size(16)]]; // expected-warning{{C++11 attribute syntax is incompatible with C++98}}
-typedef int v2i32 [[gnu::vector_size(8)]]; // expected-warning{{C++11 attribute syntax is incompatible with C++98}}
+typedef long long v2i64 [[gnu::vector_size(16)]]; // expected-warning{{[[]] attributes are a C2x extension}}
+typedef int v2i32 [[gnu::vector_size(8)]]; // expected-warning{{[[]] attributes are a C2x extension}}
 
 // Check various positions where the [[]] spelling can or cannot be used.
-[[gnu::vector_size(16)]] typedef long long v2i64; // expected-warning{{C++11 attribute syntax is incompatible with C++98}}
+[[gnu::vector_size(16)]] typedef long long v2i64; // expected-warning{{[[]] attributes are a C2x extension}}
 typedef long long [[gnu::vector_size(16)]] v2i64_ignored;
   // expected-warning at -1{{'vector_size' attribute ignored}}
-  // expected-warning at -2{{C++11 attribute syntax is incompatible with C++98}}
+  // expected-warning at -2{{[[]] attributes are a C2x extension}}
 // FIXME: Contrary to the error message that we emit, GCC does actually allow
 // the attribute in the following position. Somewhat surprisingly, the attribute
 // is applied not to the pointer but to the base type, i.e. this declaration has
@@ -38,10 +35,10 @@ typedef long long [[gnu::vector_size(16)]] v2i64_ignored;
 typedef long long *[[gnu::vector_size(16)]] v2i64_doesnt_work;
   // expected-error at -1{{invalid vector element type 'long long *'}}
   // expected-warning at -2{{GCC does not allow the 'vector_size' attribute to be written on a type}}
-  // expected-warning at -3{{C++11 attribute syntax is incompatible with C++98}}
+  // expected-warning at -3{{[[]] attributes are a C2x extension}}
 
 // Verify that we can use the attribute outside of a typedef.
-static int v2i32_var [[gnu::vector_size(8)]]; // expected-warning{{C++11 attribute syntax is incompatible with C++98}}
+static int v2i32_var [[gnu::vector_size(8)]]; // expected-warning{{[[]] attributes are a C2x extension}}
 
 void arithmeticTest(void);
 void logicTest(void);

diff  --git a/clang/test/SemaCXX/attr-cxx-disabled.cpp b/clang/test/SemaCXX/attr-cxx-disabled.cpp
deleted file mode 100644
index a1a7533bd854a6..00000000000000
--- a/clang/test/SemaCXX/attr-cxx-disabled.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -fno-double-square-bracket-attributes -verify -pedantic -std=c++11 -DERRORS %s
-// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify -pedantic -std=c++11 %s
-
-struct [[]] S {};
-
-#ifdef ERRORS
-// expected-error at -3 {{declaration of anonymous struct must be a definition}}
-// expected-warning at -4 {{declaration does not declare anything}}
-#else
-// expected-no-diagnostics
-#endif
-

diff  --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp
index f12d7c2d3f0512..d26e3a1e684d54 100644
--- a/clang/test/SemaCXX/cxx98-compat.cpp
+++ b/clang/test/SemaCXX/cxx98-compat.cpp
@@ -24,7 +24,7 @@ template<int ...I>  // expected-warning {{variadic templates are incompatible wi
 class Variadic3 {};
 
 alignas(8) int with_alignas; // expected-warning {{'alignas' is incompatible with C++98}}
-int with_attribute [[ ]]; // expected-warning {{C++11 attribute syntax is incompatible with C++98}}
+int with_attribute [[ ]]; // expected-warning {{[[]] attributes are incompatible with C++ standards before C++11}}
 
 void Literals() {
   (void)u8"str"; // expected-warning {{unicode literals are incompatible with C++98}}
@@ -104,7 +104,7 @@ struct RefQualifier {
 
 auto f() -> int; // expected-warning {{trailing return types are incompatible with C++98}}
 #ifdef CXX14COMPAT
-auto ff() { return 5; } // expected-warning {{'auto' type specifier is incompatible with C++98}} 
+auto ff() { return 5; } // expected-warning {{'auto' type specifier is incompatible with C++98}}
 // expected-warning at -1 {{return type deduction is incompatible with C++ standards before C++14}}
 #endif
 

diff  --git a/clang/test/SemaCXX/warn-c++11-extensions.cpp b/clang/test/SemaCXX/warn-c++11-extensions.cpp
index bf8612aa398ade..1670e1187aa909 100644
--- a/clang/test/SemaCXX/warn-c++11-extensions.cpp
+++ b/clang/test/SemaCXX/warn-c++11-extensions.cpp
@@ -7,3 +7,5 @@ unsigned long long ull1 = // expected-warning {{'long long' is a C++11 extension
 
 enum struct E1 { A, B }; // expected-warning {{scoped enumerations are a C++11 extension}}
 enum class E2 { C, D }; // expected-warning {{scoped enumerations are a C++11 extension}}
+
+[[]] void func(); // expected-warning {{[[]] attributes are a C++11 extension}}

diff  --git a/clang/test/SemaObjC/attr-objc-gc.m b/clang/test/SemaObjC/attr-objc-gc.m
index e9dcbd993cb36f..547e87cfe56700 100644
--- a/clang/test/SemaObjC/attr-objc-gc.m
+++ b/clang/test/SemaObjC/attr-objc-gc.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fdouble-square-bracket-attributes -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
 static id __attribute((objc_gc(weak))) a;
 static id __attribute((objc_gc(strong))) b;
 

diff  --git a/clang/unittests/AST/AttrTest.cpp b/clang/unittests/AST/AttrTest.cpp
index fac77ff461924a..46c3f5729021ec 100644
--- a/clang/unittests/AST/AttrTest.cpp
+++ b/clang/unittests/AST/AttrTest.cpp
@@ -157,7 +157,7 @@ TEST(Attr, AnnotateType) {
   AST = buildASTFromCodeWithArgs(R"c(
     __auto_type [[clang::annotate_type("auto")]] auto_var = 1;
   )c",
-                                 {"-fdouble-square-bracket-attributes"},
+                                 {},
                                  "input.c");
 
   {

diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index dc3434d61d329f..8ef728f86c6b85 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -3394,14 +3394,10 @@ static void GenerateHasAttrSpellingStringSwitch(
       // If this is the C++11 variety, also add in the LangOpts test.
       if (Variety == "CXX11")
         Test += " && LangOpts.CPlusPlus11";
-      else if (Variety == "C2x")
-        Test += " && LangOpts.DoubleSquareBracketAttributes";
     } else if (Variety == "CXX11")
       // C++11 mode should be checked against LangOpts, which is presumed to be
       // present in the caller.
       Test = "LangOpts.CPlusPlus11";
-    else if (Variety == "C2x")
-      Test = "LangOpts.DoubleSquareBracketAttributes";
 
     std::string TestStr = !Test.empty()
                               ? Test + " ? " + llvm::itostr(Version) + " : 0"

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 7b74129f848e29..f3d6ea26b30d3c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -575,7 +575,6 @@ ClangExpressionParser::ClangExpressionParser(
     // FIXME: We should ask the driver for the appropriate default flags.
     lang_opts.GNUMode = true;
     lang_opts.GNUKeywords = true;
-    lang_opts.DoubleSquareBracketAttributes = true;
     lang_opts.CPlusPlus11 = true;
 
     // The Darwin libc expects this macro to be set.


        


More information about the cfe-commits mailing list