Browse Source

Fixed compiler warnings when building with CORRADE_NO_ASSERT.

pull/132/head
Vladimír Vondruš 11 years ago
parent
commit
d36f45ac98
  1. 9
      src/Magnum/MeshTools/Interleave.h
  2. 2
      src/Magnum/SceneGraph/Object.hpp
  3. 3
      src/Magnum/Text/Renderer.cpp

9
src/Magnum/MeshTools/Interleave.h

@ -44,11 +44,12 @@ namespace Implementation {
resolution (the functions would otherwise need to be de-inlined to break resolution (the functions would otherwise need to be de-inlined to break
cyclic dependencies) */ cyclic dependencies) */
struct AttributeCount { struct AttributeCount {
template<class T, class ...U> typename std::enable_if<!std::is_convertible<T, std::size_t>::value, std::size_t>::type operator()(const T& first, const U&... next) const { template<class T, class ...U> typename std::enable_if<!std::is_convertible<T, std::size_t>::value, std::size_t>::type operator()(const T& first, const U&...
CORRADE_ASSERT(sizeof...(next) == 0 || AttributeCount{}(next...) == first.size() || AttributeCount{}(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << AttributeCount{}(next...), 0); #if !defined(CORRADE_NO_ASSERT) || defined(CORRADE_GRACEFUL_ASSERT)
#if defined(CORRADE_NO_ASSERT) && !defined(CORRADE_GRACEFUL_ASSERT) next
static_cast<void>(sizeof...(next));
#endif #endif
) const {
CORRADE_ASSERT(sizeof...(next) == 0 || AttributeCount{}(next...) == first.size() || AttributeCount{}(next...) == ~std::size_t(0), "MeshTools::interleave(): attribute arrays don't have the same length, expected" << first.size() << "but got" << AttributeCount{}(next...), 0);
return first.size(); return first.size();
} }

2
src/Magnum/SceneGraph/Object.hpp

@ -212,8 +212,10 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
} }
std::vector<std::reference_wrapper<Object<Transformation>>> jointObjects(objects); std::vector<std::reference_wrapper<Object<Transformation>>> jointObjects(objects);
#if !defined(CORRADE_NO_ASSERT) || defined(CORRADE_GRACEFUL_ASSERT)
/* Scene object */ /* Scene object */
const Scene<Transformation>* scene = this->scene(); const Scene<Transformation>* scene = this->scene();
#endif
/* Nearest common ancestor not yet implemented - assert this is done on scene */ /* Nearest common ancestor not yet implemented - assert this is done on scene */
CORRADE_ASSERT(scene == this, "SceneGraph::Object::transformationMatrices(): currently implemented only for Scene", {}); CORRADE_ASSERT(scene == this, "SceneGraph::Object::transformationMatrices(): currently implemented only for Scene", {});

3
src/Magnum/Text/Renderer.cpp

@ -93,13 +93,12 @@ std::tuple<std::vector<Vertex>, Range2D> renderVerticesInternal(AbstractFont& fo
/* Layout the line */ /* Layout the line */
const auto layouter = font.layout(cache, size, line); const auto layouter = font.layout(cache, size, line);
const UnsignedInt vertexCount = layouter->glyphCount()*4;
/* Verify that we don't reallocate anything. The only problem might /* Verify that we don't reallocate anything. The only problem might
arise when the layouter decides to compose one character from more arise when the layouter decides to compose one character from more
than one glyph (i.e. accents). Will remove the assert when this than one glyph (i.e. accents). Will remove the assert when this
issue arises. */ issue arises. */
CORRADE_INTERNAL_ASSERT(vertices.size()+vertexCount <= vertices.capacity()); CORRADE_INTERNAL_ASSERT(vertices.size() + layouter->glyphCount()*4 <= vertices.capacity());
/* Bounds of rendered line */ /* Bounds of rendered line */
Range2D lineRectangle; Range2D lineRectangle;

Loading…
Cancel
Save