[libcxx-commits] [PATCH] D117157: [libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 12 15:04:57 PST 2022


Quuxplusone added inline comments.


================
Comment at: libcxx/include/experimental/simd:773
   _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 31);                                       \
-  _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 32);
+  _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 32); _LIBCPP_FORCE_SEMICOLON
 
----------------
philnik wrote:
> Quuxplusone wrote:
> > 
> These semicolons aren't actually required either, so this won't work.
Based on the definition of the macro on line 734, either your solution or mine should work to suppress unnecessary-semicolon diagnostics.
However, it would be //even simpler// to make the semicolon part of the macro itself:
```
#define _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, _NUM_ELEMENT)                        \
  template <>                                                                  \
  struct __vec_ext_traits<_TYPE, sizeof(_TYPE) * _NUM_ELEMENT> {               \
    using type =                                                               \
        _TYPE __attribute__((vector_size(sizeof(_TYPE) * _NUM_ELEMENT)));      \
  };
```
and then
```
#define _LIBCPP_SPECIALIZE_VEC_EXT_32(_TYPE)                                   \
  _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 1)                                         \
  _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 2)                                         \
  _LIBCPP_SPECIALIZE_VEC_EXT(_TYPE, 3)                                         \
  ~~~

_LIBCPP_SPECIALIZE_VEC_EXT_32(char)
_LIBCPP_SPECIALIZE_VEC_EXT_32(char16_t)
_LIBCPP_SPECIALIZE_VEC_EXT_32(char32_t)
~~~
```
That should //definitely// satisfy whatever semicolon-checker is complaining.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117157/new/

https://reviews.llvm.org/D117157



More information about the libcxx-commits mailing list