[libcxx-commits] [libcxx] [libcxx] [regex] add `[[clang::fallthrough]]` to suppress fallthrough warning (PR #100821)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 26 23:43:57 PDT 2024


================
@@ -3921,7 +3921,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
       if (__hd == -1)
         __throw_regex_error<regex_constants::error_escape>();
       __sum = 16 * __sum + static_cast<unsigned>(__hd);
-      // fallthrough
+    [[clang::fallthrough]];
----------------
frederick-vs-ja wrote:

It seems to me that we should spell the attribute as `[[_Clang::__fallthrough__]]` to defend against user-defined macros. (As `clang` is never reserved and `fallthrough` is reserved only since C++17.)
Or can we use `[[__fallthrough__]]`?

https://github.com/llvm/llvm-project/pull/100821


More information about the libcxx-commits mailing list