diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 9bc96f4dc1e961..dcc2eaf4b202f9 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -188,6 +188,11 @@ Attribute Changes in Clang supported the ability to specify a message in the attribute, so there were no changes to the attribute behavior. +- Updated the value returned by ``__has_c_attribute(fallthrough)`` to ``201910L`` + based on the final date specified by the C2x committee draft. We previously + used ``201904L`` (the date the proposal was seen by the committee) by mistake. + There were no other changes to the attribute behavior. + Windows Support --------------- - For the MinGW driver, added the options ``-mguard=none``, ``-mguard=cf`` and diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 48c7791ebe330e..2e3297b72a8cfb 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1412,7 +1412,7 @@ def ExtVectorType : Attr { def FallThrough : StmtAttr { let Spellings = [CXX11<"", "fallthrough", 201603>, - C2x<"", "fallthrough", 201904>, + C2x<"", "fallthrough", 201910>, CXX11<"clang", "fallthrough">, GCC<"fallthrough">]; // The attribute only applies to a NullStmt, but we have special fix-it // behavior if applied to a case label. diff --git a/clang/test/Preprocessor/has_c_attribute.c b/clang/test/Preprocessor/has_c_attribute.c index 401daa72b85b18..1da4d0541e6e0d 100644 --- a/clang/test/Preprocessor/has_c_attribute.c +++ b/clang/test/Preprocessor/has_c_attribute.c @@ -3,7 +3,7 @@ #define C2x(x) x: __has_c_attribute(x) -// CHECK: fallthrough: 201904L +// CHECK: fallthrough: 201910L C2x(fallthrough) // CHECK: __nodiscard__: 202003L diff --git a/clang/test/Sema/c2x-fallthrough.c b/clang/test/Sema/c2x-fallthrough.c index baa62aa8f14011..092d5285f80bac 100644 --- a/clang/test/Sema/c2x-fallthrough.c +++ b/clang/test/Sema/c2x-fallthrough.c @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c2x -verify %s + +// This is the latest version of fallthrough that we support. +_Static_assert(__has_c_attribute(fallthrough) == 201910L); void f(int n) { switch (n) {