Correct the __has_c_attribute value for fallthrough

The original proposal was seen in Apr 2019 and we accidentally used
that date (201904L) as the feature testing value. However, WG14 N2408
was adopted at the Oct 2019 meeting and so that's the correct date for
the feature testing macro. The committee draft for C2x shows 201910L
for this value, so this changes brings us in line with the standard.
This commit is contained in:
Aaron Ballman 2022-09-13 11:06:01 -04:00
parent 59a640a381
commit b8266f512a
4 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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.

View File

@ -3,7 +3,7 @@
#define C2x(x) x: __has_c_attribute(x)
// CHECK: fallthrough: 201904L
// CHECK: fallthrough: 201910L
C2x(fallthrough)
// CHECK: __nodiscard__: 202003L

View File

@ -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) {