Browse Source

Fix unused variable warnings on a no-assert build.

pull/482/merge
Vladimír Vondruš 3 weeks ago
parent
commit
7d95c55eaf
  1. 3
      src/Magnum/GL/Implementation/RendererState.cpp
  2. 6
      src/Magnum/Platform/Sdl2Application.cpp
  3. 6
      src/Magnum/Trade/MaterialData.cpp

3
src/Magnum/GL/Implementation/RendererState.cpp

@ -380,6 +380,9 @@ void RendererState::applyPixelStorageInternal(const Magnum::PixelStorage& storag
void RendererState::applyCompressedPixelStorageInternal(const CompressedPixelStorage& storage, const Vector3i& blockSize, const Int blockDataSize, const bool isUnpack) {
#ifdef MAGNUM_TARGET_GLES
#ifdef CORRADE_NO_ASSERT
static_cast<void>(storage);
#endif
CORRADE_ASSERT(storage == CompressedPixelStorage{},
"GL: non-default CompressedPixelStorage parameters are not supported in OpenGL ES or WebGL", );
static_cast<void>(blockSize);

6
src/Magnum/Platform/Sdl2Application.cpp

@ -378,6 +378,12 @@ Vector2 Sdl2Application::dpiScalingInternal(const Implementation::Sdl2DpiScaling
CORRADE_INTERNAL_ASSERT(dpiScalingPolicy == Implementation::Sdl2DpiScalingPolicy::Virtual || dpiScalingPolicy == Implementation::Sdl2DpiScalingPolicy::Physical);
#else
CORRADE_INTERNAL_ASSERT(dpiScalingPolicy == Implementation::Sdl2DpiScalingPolicy::Physical);
/* On Emscripten the DPI scaling policy is only used in the above
assertion, otherwise it's unused. Suppressing an unused variable warning
instead of adding even more ifdefs to make the code easier to read. */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(CORRADE_NO_ASSERT)
static_cast<void>(dpiScalingPolicy);
#endif
#endif
/* Take device pixel ratio on Emscripten */

6
src/Magnum/Trade/MaterialData.cpp

@ -299,7 +299,11 @@ MaterialData::MaterialData(const MaterialTypes types, Containers::Array<Material
if(end - begin > 1) for(std::size_t j = begin + 1; j != end; ++j) {
if(_data[j - 1].name() < _data[j].name()) continue;
std::sort(_data + begin, _data + end, [i](const MaterialAttributeData& a, const MaterialAttributeData& b) {
std::sort(_data + begin, _data + end, [
#ifndef CORRADE_NO_ASSERT
i
#endif
](const MaterialAttributeData& a, const MaterialAttributeData& b) {
/* Need to check here (instead of in the outer for loop) as we
exit the loop right after the sort and thus duplicates that
occur after the first non-sorted pair wouldn't get detected.

Loading…
Cancel
Save