Browse Source

Fix Clang's -Wunused-template warning better.

As was the case in Corrade, this was due to an extra `static`. Except
for the warning in the snippet file, where I don't see any other way how
to suppress it.

This partially reverts commit b8bddc438c.
master
Vladimír Vondruš 5 days ago
parent
commit
59b893b176
  1. 3
      doc/snippets/SceneGraph.cpp
  2. 18
      src/Magnum/Math/FunctionsBatch.h

3
doc/snippets/SceneGraph.cpp

@ -147,7 +147,8 @@ class CachingObject: public Object3D, SceneGraph::AbstractFeature3D {
namespace { namespace {
/* Clang 23 adds -Wunused-template to -Wall and then warns about the unused /* Clang 23 adds -Wunused-template to -Wall and then warns about the unused
constructor. Well, this is a doc snippet, so what am I supposed to do? */ (template) constructor. Well, this is a doc snippet, so what am I supposed
to do? */
#ifdef CORRADE_TARGET_CLANG #ifdef CORRADE_TARGET_CLANG
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-template" #pragma clang diagnostic ignored "-Wunused-template"

18
src/Magnum/Math/FunctionsBatch.h

@ -49,21 +49,9 @@ namespace Implementation {
/** @todo Utility/Algorithms.h has a similar (but different) variant of this, /** @todo Utility/Algorithms.h has a similar (but different) variant of this,
maybe turn that into some public utility once we have one more use case? */ maybe turn that into some public utility once we have one more use case? */
/* Clang since version 23 includes -Wunused-template in -Wall, and warns for template<class T, class View = decltype(Containers::Implementation::ErasedArrayViewConverter<typename std::remove_reference<T&&>::type>::from(std::declval<T&&>()))> auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const<typename View::Type>::type;
those declarations. The templates are used inside a decltype() expression template<class T> typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::ArrayView<T>&);
below (and commenting them out obviously makes the test fail to compile) so template<class T> typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::StridedArrayView1D<T>&);
this is yet another completely pointless warning that just wastes my
time. */
#ifdef CORRADE_TARGET_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-template"
#endif
template<class T, class View = decltype(Containers::Implementation::ErasedArrayViewConverter<typename std::remove_reference<T&&>::type>::from(std::declval<T&&>()))> static auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const<typename View::Type>::type;
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::ArrayView<T>&);
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::StridedArrayView1D<T>&);
#ifdef CORRADE_TARGET_CLANG
#pragma clang diagnostic pop
#endif
} }

Loading…
Cancel
Save