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

Max Coplan via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 10 13:41:49 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
+      [[__fallthrough__]];
----------------
vegerot wrote:

This doesn't work for me.  I made this change and ran 

```sh
time (mkdir build_runtimes && cd build_runtimes && set -x && CC=../build/bin/clang CXX=../build/bin/clang++ cmake -G Ninja ../runtimes -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind'  && ninja && bin/llvm-lit -sv ../libcxx/test/std/re )
```

and it errored with

```cpp
/home/max/workspace/github.com/llvm/llvm-project/build_runtimes/include/c++/v1/regex:3924:9: warning: unknown attribute '_LIBCPP_FALLTHROUGH' ignored [-Wunknown-attributes]
 3924 |       [[_LIBCPP_FALLTHROUGH]];
      |         ^~~~~~~~~~~~~~~~~~~
1 warning generated.
```

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


More information about the libcxx-commits mailing list