This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Remove clang-diagnostic-c++98-compat-extra-semi warnings in experimental/simd
ClosedPublic

Authored by philnik on Jan 12 2022, 2:15 PM.

Details

Summary

Force semicolons or remove them in experimental/simd

Diff Detail

Event Timeline

philnik created this revision.Jan 12 2022, 2:15 PM
philnik requested review of this revision.Jan 12 2022, 2:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2022, 2:15 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

LGTM mod important alteration. Let's not introduce _LIBCPP_FORCE_SEMICOLON since it's trivial to avoid.

libcxx/include/experimental/simd
773
philnik added inline comments.Jan 12 2022, 2:59 PM
libcxx/include/experimental/simd
773

These semicolons aren't actually required either, so this won't work.

libcxx/include/experimental/simd
773

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.

philnik updated this revision to Diff 399486.Jan 12 2022, 3:12 PM
philnik marked 2 inline comments as done.
  • Remove _LIBCPP_FORCE_SEMICOLON
libcxx/include/experimental/simd
773

Sorry, I missed that it's a struct and not a template function.

Mordante accepted this revision.Jan 13 2022, 8:49 AM

LGTM!

This revision is now accepted and ready to land.Jan 13 2022, 8:49 AM
ldionne requested changes to this revision.Jan 13 2022, 11:28 AM

Why are we not adding or removing any flag in this patch?

This revision now requires changes to proceed.Jan 13 2022, 11:28 AM

Why are we not adding or removing any flag in this patch?

This is a clang-tidy check which is already enabled. We just don't run clang-tidy yet.

ldionne accepted this revision.Jan 14 2022, 8:37 AM

Why are we not adding or removing any flag in this patch?

This is a clang-tidy check which is already enabled. We just don't run clang-tidy yet.

Thanks for explaining.

This revision is now accepted and ready to land.Jan 14 2022, 8:37 AM