felixguendling/cista

Silence clang specific #pragma directives for other compilers ?

Closed this issue · 2 comments

AdelKS commented

Hello !

The latest version of cista introduced some compile time warnings on GCC

cista/containers/mutable_fws_multimap.h:55: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
   55 | #pragma clang diagnostic ignored "-Wclass-conversion"

Do you think there's a way to not make it complain?

Does it help to wrap it with #ifdef __clang__ like here?

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
template <typename Aggregate, std::size_t... Indices>
struct arity_impl<Aggregate, std::index_sequence<Indices...>,
std::void_t<decltype(Aggregate{
(static_cast<void>(Indices), std::declval<instance>())...,
std::declval<instance>()})>>
: arity_impl<Aggregate,
std::index_sequence<Indices..., sizeof...(Indices)>> {};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

AdelKS commented

I haven't used clang yet to see if it complains but I think that should work for gcc. You can't reproduce the warnings locally? I get them with with -Wall -Wextra flags, I wonder how different the actual set of flags that get activated differ from the ones cista activates 🤔