Browse Source

Prefer CORRADE_TARGET_* instead of __GNUC__, __clang__ and _MSVC_VER.

While branching on a compiler is rather common, checking a particular
compiler version should be needed only rarely. Thus minimize use of such
macros to make them easier to grep for.
pull/554/head
Vladimír Vondruš 4 years ago
parent
commit
cedc0d6eeb
  1. 6
      doc/platforms-html5.dox
  2. 4
      doc/snippets/MagnumSceneGraph.cpp
  3. 16
      doc/snippets/MagnumShaders-gl.cpp
  4. 2
      src/Magnum/Audio/Context.cpp
  5. 8
      src/Magnum/DebugTools/CompareImage.cpp
  6. 2
      src/Magnum/DebugTools/ResourceManager.h
  7. 8
      src/Magnum/GL/AbstractTexture.cpp
  8. 2
      src/Magnum/GL/Context.cpp
  9. 2
      src/Magnum/GL/Implementation/FramebufferState.h
  10. 2
      src/Magnum/GL/Implementation/QueryState.h
  11. 2
      src/Magnum/GL/Implementation/ShaderState.h
  12. 2
      src/Magnum/GL/Implementation/TextureState.h
  13. 2
      src/Magnum/GL/Implementation/TransformFeedbackState.h
  14. 20
      src/Magnum/GL/PixelFormat.cpp
  15. 4
      src/Magnum/GL/Test/AttributeTest.cpp
  16. 8
      src/Magnum/GL/Test/MeshTest.cpp
  17. 8
      src/Magnum/GL/Test/PixelFormatTest.cpp
  18. 4
      src/Magnum/GL/TextureFormat.cpp
  19. 4
      src/Magnum/Math/Functions.h
  20. 2
      src/Magnum/Math/Test/HalfTest.cpp
  21. 4
      src/Magnum/MeshTools/Interleave.h
  22. 4
      src/Magnum/PixelFormat.cpp
  23. 12
      src/Magnum/Platform/Implementation/DpiScaling.cpp
  24. 2
      src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp
  25. 8
      src/Magnum/Test/MeshTest.cpp
  26. 8
      src/Magnum/Test/PixelFormatTest.cpp
  27. 4
      src/Magnum/Test/VertexFormatTest.cpp
  28. 8
      src/Magnum/Trade/Test/MaterialDataTest.cpp
  29. 4
      src/Magnum/Vk/Test/DeviceFeaturesTest.cpp
  30. 4
      src/Magnum/Vk/Test/MeshLayoutTest.cpp
  31. 4
      src/Magnum/Vk/Test/PipelineTest.cpp
  32. 8
      src/Magnum/Vk/Test/PixelFormatTest.cpp
  33. 4
      src/Magnum/Vk/Test/VertexFormatTest.cpp

6
doc/platforms-html5.dox

@ -818,9 +818,9 @@ warning: '$' in identifier
@endcode
Solution is to disable the warning for the offending lines, below for example
when modifying a title element contents through DOM. No @cpp #ifdef __clang__ @ce
is necessary, as the code in question is only ever compiled by Emscripten's
Clang anyway:
when modifying a title element contents through DOM. No
@cpp #ifdef CORRADE_TARGET_CLANG @ce is necessary, as the code in question is
only ever compiled by Emscripten's Clang anyway:
@snippet platforms-html5.cpp emasm-dollar

4
doc/snippets/MagnumSceneGraph.cpp

@ -256,7 +256,7 @@ class MyObject: MyFeature, public Object3D {
/* [feature-construction-order-crash] */
}
{
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreorder"
#endif
@ -269,7 +269,7 @@ class MyObject: MyFeature, public Object3D {
};
/* [feature-construction-order-crash-destruction] */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

16
doc/snippets/MagnumShaders-gl.cpp

@ -74,7 +74,7 @@ int main() {
/* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
on GCC 4.8 in the [60] array */
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [shaders-setup] */
struct Vertex {
@ -343,7 +343,7 @@ shader
/* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
on GCC 4.8 in the [60] array */
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [DistanceFieldVectorGL-usage1] */
struct Vertex {
@ -420,7 +420,7 @@ shader
/* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
on GCC 4.8 in the [60] array */
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [FlatGL-usage-colored1] */
struct Vertex {
@ -633,7 +633,7 @@ mesh.setInstanceCount(Containers::arraySize(instancedTransformations))
/* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
on GCC 4.8 in the [60] array */
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [MeshVisualizerGL3D-usage-geom1] */
struct Vertex {
@ -679,7 +679,7 @@ mesh.addVertexBuffer(vertexIndices, 0, Shaders::MeshVisualizerGL3D::VertexIndex{
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
on GCC 4.8 in the [60] array */
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [MeshVisualizerGL3D-usage-tbn1] */
struct Vertex {
@ -841,7 +841,7 @@ mesh.setInstanceCount(Containers::arraySize(instanceData))
}
#endif
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [PhongGL-usage-colored1] */
struct Vertex {
@ -1000,7 +1000,7 @@ shader
}
#endif
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [VectorGL-usage1] */
struct Vertex {
@ -1064,7 +1064,7 @@ shader
}
#endif
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__*100 + __GNUC_MINOR__ >= 500
#if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5
{
/* [VertexColorGL-usage1] */
struct Vertex {

2
src/Magnum/Audio/Context.cpp

@ -134,7 +134,7 @@ namespace {
Windows not handled yet, as it needs a workaround using DllMain() and
GetProcAddress(). */
CORRADE_VISIBILITY_EXPORT
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
__attribute__((weak))
#else
/* uh oh? the test will fail, probably */

8
src/Magnum/DebugTools/CompareImage.cpp

@ -109,7 +109,7 @@ std::tuple<Containers::Array<Float>, Float, Float> calculateImageDelta(const Pix
CORRADE_ASSERT(!isPixelFormatImplementationSpecific(expected.format()),
"DebugTools::CompareImage: can't compare implementation-specific pixel formats", {});
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -189,7 +189,7 @@ std::tuple<Containers::Array<Float>, Float, Float> calculateImageDelta(const Pix
case PixelFormat::Depth32FStencil8UI:
CORRADE_ASSERT_UNREACHABLE("DebugTools::CompareImage: packed depth/stencil formats are not supported yet", {});
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -261,7 +261,7 @@ namespace {
void printPixelAt(Debug& out, const Containers::StridedArrayView3D<const char>& pixels, const Vector2i& pos, const PixelFormat format) {
const char* const pixel = &pixels[pos.y()][pos.x()][0];
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -344,7 +344,7 @@ void printPixelAt(Debug& out, const Containers::StridedArrayView3D<const char>&
/* Already handled by a printing assert before */
CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

2
src/Magnum/DebugTools/ResourceManager.h

@ -40,7 +40,7 @@
#include "Magnum/SceneGraph/SceneGraph.h"
/** @todo fix this better */
#ifdef _MSC_VER /* This is not a bug, this is a feature :( Not even /permissive- helps. */
#ifdef CORRADE_TARGET_MSVC /* This is not a bug, this is a feature :( Not even /permissive- helps. */
#include "Magnum/DebugTools/ForceRenderer.h"
#include "Magnum/DebugTools/ObjectRenderer.h"
#include "Magnum/GL/AbstractShaderProgram.h"

8
src/Magnum/GL/AbstractTexture.cpp

@ -551,7 +551,7 @@ void AbstractTexture::bindInternal() {
namespace {
PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -888,7 +888,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#endif
return PixelFormat::DepthStencil;
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -896,7 +896,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
}
PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) {
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -1183,7 +1183,7 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) {
return PixelType::Float32UnsignedInt248Rev;
#endif
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

2
src/Magnum/GL/Context.cpp

@ -631,7 +631,7 @@ CORRADE_THREAD_LOCAL
it's apparently enough to just export, macOS needs the weak attribute.
Windows handled differently below. */
CORRADE_VISIBILITY_EXPORT
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
__attribute__((weak))
#else
/* uh oh? the test will fail, probably */

2
src/Magnum/GL/Implementation/FramebufferState.h

@ -27,7 +27,7 @@
#include "Magnum/GL/Framebuffer.h"
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */

2
src/Magnum/GL/Implementation/QueryState.h

@ -28,7 +28,7 @@
#include "Magnum/Magnum.h"
#include "Magnum/GL/GL.h"
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */

2
src/Magnum/GL/Implementation/ShaderState.h

@ -31,7 +31,7 @@
#include "Magnum/GL/GL.h"
#include "Magnum/GL/OpenGL.h"
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */

2
src/Magnum/GL/Implementation/TextureState.h

@ -32,7 +32,7 @@
#include "Magnum/GL/GL.h"
#include "Magnum/GL/OpenGL.h"
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
#include "Magnum/GL/AbstractTexture.h"
#ifndef MAGNUM_TARGET_GLES2

2
src/Magnum/GL/Implementation/TransformFeedbackState.h

@ -32,7 +32,7 @@
#include "Magnum/GL/GL.h"
#include "Magnum/GL/OpenGL.h"
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */

20
src/Magnum/GL/PixelFormat.cpp

@ -124,7 +124,7 @@ TextureFormat textureFormat(const Magnum::PixelFormat format) {
UnsignedInt pixelSize(const PixelFormat format, const PixelType type) {
std::size_t size = 0;
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -184,11 +184,11 @@ UnsignedInt pixelSize(const PixelFormat format, const PixelType type) {
return 8;
#endif
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -254,7 +254,7 @@ UnsignedInt pixelSize(const PixelFormat format, const PixelType type) {
case PixelFormat::DepthStencil:
CORRADE_ASSERT_UNREACHABLE("GL::pixelSize(): invalid" << type << "specified for" << format, 0);
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -265,7 +265,7 @@ UnsignedInt pixelSize(const PixelFormat format, const PixelType type) {
Debug& operator<<(Debug& debug, const PixelFormat value) {
debug << "GL::PixelFormat" << Debug::nospace;
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -322,7 +322,7 @@ Debug& operator<<(Debug& debug, const PixelFormat value) {
#undef _c
/* LCOV_EXCL_STOP */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -332,7 +332,7 @@ Debug& operator<<(Debug& debug, const PixelFormat value) {
Debug& operator<<(Debug& debug, const PixelType value) {
debug << "GL::PixelType" << Debug::nospace;
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -388,7 +388,7 @@ Debug& operator<<(Debug& debug, const PixelType value) {
#undef _c
/* LCOV_EXCL_STOP */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -458,7 +458,7 @@ TextureFormat textureFormat(const Magnum::CompressedPixelFormat format) {
Debug& operator<<(Debug& debug, const CompressedPixelFormat value) {
debug << "GL::CompressedPixelFormat" << Debug::nospace;
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -570,7 +570,7 @@ Debug& operator<<(Debug& debug, const CompressedPixelFormat value) {
#undef _c
/* LCOV_EXCL_STOP */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/GL/Test/AttributeTest.cpp

@ -877,7 +877,7 @@ void AttributeTest::hasVertexFormat() {
const auto format = Magnum::VertexFormat(i);
/* Each case only verifies that hasVertexFormat() handles the format
and doesn't fall into unreachable code */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -889,7 +889,7 @@ void AttributeTest::hasVertexFormat() {
#include "Magnum/Implementation/vertexFormatMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

8
src/Magnum/GL/Test/MeshTest.cpp

@ -175,7 +175,7 @@ void MeshTest::mapPrimitive() {
too much. */
for(UnsignedInt i = 1; i <= 0xffff; ++i) {
const auto primitive = Magnum::MeshPrimitive(i);
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -188,7 +188,7 @@ void MeshTest::mapPrimitive() {
#include "Magnum/Implementation/meshPrimitiveMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}
@ -236,7 +236,7 @@ void MeshTest::mapIndexType() {
too much. */
for(UnsignedInt i = 1; i <= 0xffff; ++i) {
const auto type = Magnum::MeshIndexType(i);
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -248,7 +248,7 @@ void MeshTest::mapIndexType() {
#include "Magnum/Implementation/meshIndexTypeMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

8
src/Magnum/GL/Test/PixelFormatTest.cpp

@ -122,7 +122,7 @@ void PixelFormatTest::mapFormatTypeTextureFormat() {
- that there was no gap (unhandled value inside the range)
- that a particular pixel format maps to a particular GL format
- that a particular pixel type maps to a particular GL type */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -177,7 +177,7 @@ void PixelFormatTest::mapFormatTypeTextureFormat() {
#undef _n
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -381,7 +381,7 @@ void PixelFormatTest::mapCompressedFormatTextureFormat() {
- that there was no gap (unhandled value inside the range)
- that a particular pixel format maps to a particular GL format
- that a particular pixel type maps to a particular GL type */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -416,7 +416,7 @@ void PixelFormatTest::mapCompressedFormatTextureFormat() {
#undef _s
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/GL/TextureFormat.cpp

@ -42,7 +42,7 @@ namespace Magnum { namespace GL {
Debug& operator<<(Debug& debug, const TextureFormat value) {
debug << "GL::TextureFormat" << Debug::nospace;
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -293,7 +293,7 @@ Debug& operator<<(Debug& debug, const TextureFormat value) {
#undef _c
/* LCOV_EXCL_STOP */
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/Math/Functions.h

@ -161,7 +161,7 @@ template<class T> inline T cos(Unit<Rad, T> angle) { return std::cos(T(angle));
template<class T> inline T cos(Unit<Deg, T> angle) { return cos(Rad<T>(angle)); }
#endif
#if defined(__GNUC__) && !defined(__clang__)
#if defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG)
namespace Implementation {
/* GCC builtin since 3.4 (https://stackoverflow.com/a/2742861),
unfortunately either Clang nor MSVC have any alternative which wouldn't
@ -192,7 +192,7 @@ instruction as well.
template<class T> inline std::pair<T, T> sincos(Rad<T> angle);
#else
template<class T> inline std::pair<T, T> sincos(Unit<Rad, T> angle) {
#if defined(__GNUC__) && !defined(__clang__)
#if defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG)
std::pair<T, T> out;
Implementation::sincos(T(angle), out.first, out.second);
return out;

2
src/Magnum/Math/Test/HalfTest.cpp

@ -625,7 +625,7 @@ void HalfTest::debug() {
Debug{&out} << -36.41_h << Half{Constants::inf()}
<< Math::Vector3<Half>{3.14159_h, -1.4142_h, 1.618_h};
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
CORRADE_COMPARE(out.str(), "-36.41 inf Vector(3.141, -1.414, 1.618)\n");
#else
CORRADE_COMPARE(out.str(), "-36.41 inf Vector(3.141, -1.414, 1.618)\n");

4
src/Magnum/MeshTools/Interleave.h

@ -54,12 +54,12 @@ struct AttributeCount {
next
#endif
) const {
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
#pragma warning(push)
#pragma warning(disable:4127) /* conditional expression is constant (of course) */
#endif
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);
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
#pragma warning(pop)
#endif

4
src/Magnum/PixelFormat.cpp

@ -38,7 +38,7 @@ UnsignedInt pixelSize(const PixelFormat format) {
CORRADE_ASSERT(!isPixelFormatImplementationSpecific(format),
"pixelSize(): can't determine size of an implementation-specific format" << reinterpret_cast<void*>(pixelFormatUnwrap(format)), {});
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -111,7 +111,7 @@ UnsignedInt pixelSize(const PixelFormat format) {
case PixelFormat::RGBA32F:
return 16;
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

12
src/Magnum/Platform/Implementation/DpiScaling.cpp

@ -81,27 +81,27 @@ Float x11DpiScaling() {
won't be and that's okay -- it may be using Wayland or something else. */
void* xlib = dlopen(nullptr, RTLD_NOW|RTLD_GLOBAL);
Containers::ScopeGuard closeXlib{xlib, dlclose};
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xOpenDisplay = reinterpret_cast<Display*(*)(char*)>(dlsym(xlib, "XOpenDisplay"));
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xCloseDisplay = reinterpret_cast<int(*)(Display*)>(dlsym(xlib, "XCloseDisplay"));
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xResourceManagerString = reinterpret_cast<char*(*)(Display*)>(dlsym(xlib, "XResourceManagerString"));
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xrmGetStringDatabase = reinterpret_cast<XrmDatabase(*)(const char*)>(dlsym(xlib, "XrmGetStringDatabase"));
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xrmGetResource = reinterpret_cast<int(*)(XrmDatabase, const char*, const char*, char**, XrmValue*)>(dlsym(xlib, "XrmGetResource"));
#ifdef __GNUC__ /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
#ifdef CORRADE_TARGET_GCC /* http://www.mr-edd.co.uk/blog/supressing_gcc_warnings */
__extension__
#endif
auto xrmDestroyDatabase = reinterpret_cast<void(*)(XrmDatabase)>(dlsym(xlib, "XrmDestroyDatabase"));

2
src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp

@ -37,7 +37,7 @@
/* WGL-specific stuff */
#elif defined(CORRADE_TARGET_WINDOWS)
#ifdef _MSC_VER
#ifdef CORRADE_TARGET_MSVC
#pragma warning(disable: 4055)
#pragma warning(disable: 4054)
#endif

8
src/Magnum/Test/MeshTest.cpp

@ -107,7 +107,7 @@ void MeshTest::primitiveMapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -122,7 +122,7 @@ void MeshTest::primitiveMapping() {
#include "Magnum/Implementation/meshPrimitiveMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -188,7 +188,7 @@ void MeshTest::indexTypeMapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -203,7 +203,7 @@ void MeshTest::indexTypeMapping() {
#include "Magnum/Implementation/meshIndexTypeMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

8
src/Magnum/Test/PixelFormatTest.cpp

@ -123,7 +123,7 @@ void PixelFormatTest::mapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -138,7 +138,7 @@ void PixelFormatTest::mapping() {
#include "Magnum/Implementation/pixelFormatMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -162,7 +162,7 @@ void PixelFormatTest::compressedMapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -184,7 +184,7 @@ void PixelFormatTest::compressedMapping() {
#include "Magnum/Implementation/compressedPixelFormatMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/Test/VertexFormatTest.cpp

@ -190,7 +190,7 @@ void VertexFormatTest::mapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -205,7 +205,7 @@ void VertexFormatTest::mapping() {
#include "Magnum/Implementation/vertexFormatMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

8
src/Magnum/Trade/Test/MaterialDataTest.cpp

@ -374,7 +374,7 @@ void MaterialDataTest::attributeMap() {
/* Attribute 0 reserved for an invalid value */
const auto attribute = MaterialAttribute(i);
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -400,7 +400,7 @@ void MaterialDataTest::attributeMap() {
#undef _ct
#undef _cnt
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}
@ -417,7 +417,7 @@ void MaterialDataTest::layerMap() {
/* Attribute 0 reserved for an invalid value */
const auto attribute = MaterialLayer(i);
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -429,7 +429,7 @@ void MaterialDataTest::layerMap() {
#include "Magnum/Trade/Implementation/materialLayerProperties.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

4
src/Magnum/Vk/Test/DeviceFeaturesTest.cpp

@ -58,7 +58,7 @@ void DeviceFeaturesTest::mapping() {
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range)
- that the Debug output is equivalent to the name */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -80,7 +80,7 @@ void DeviceFeaturesTest::mapping() {
#undef _cver
#undef _cext
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/Vk/Test/MeshLayoutTest.cpp

@ -126,7 +126,7 @@ void MeshLayoutTest::mapMeshPrimitive() {
too much. */
for(UnsignedInt i = 1; i <= 0xffff; ++i) {
const auto primitive = Magnum::MeshPrimitive(i);
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -139,7 +139,7 @@ void MeshLayoutTest::mapMeshPrimitive() {
#include "Magnum/Implementation/meshPrimitiveMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
}

4
src/Magnum/Vk/Test/PipelineTest.cpp

@ -151,7 +151,7 @@ void PipelineTest::dynamicRasterizationStateMapping() {
- that the entries are ordered by number by comparing a function to
expected result (so insertion here is done in proper place)
- that there was no gap (unhandled value inside the range) */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -168,7 +168,7 @@ void PipelineTest::dynamicRasterizationStateMapping() {
#include "Magnum/Vk/Implementation/dynamicRasterizationStateMapping.hpp"
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

8
src/Magnum/Vk/Test/PixelFormatTest.cpp

@ -80,7 +80,7 @@ void PixelFormatTest::map() {
- that there was no gap (unhandled value inside the range)
- that a particular generic format maps to a particular format
- that the debug output matches what was converted */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -116,7 +116,7 @@ void PixelFormatTest::map() {
#undef _s
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif
@ -188,7 +188,7 @@ void PixelFormatTest::mapCompressed() {
- that there was no gap (unhandled value inside the range)
- that a particular generic format maps to a particular format
- that the debug output matches what was converted */
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -224,7 +224,7 @@ void PixelFormatTest::mapCompressed() {
#undef _s
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

4
src/Magnum/Vk/Test/VertexFormatTest.cpp

@ -71,7 +71,7 @@ void VertexFormatTest::map() {
- that a particular generic format maps to a particular format
- that the debug output matches what was converted
*/
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wswitch"
#endif
@ -107,7 +107,7 @@ void VertexFormatTest::map() {
#undef _s
#undef _c
}
#ifdef __GNUC__
#ifdef CORRADE_TARGET_GCC
#pragma GCC diagnostic pop
#endif

Loading…
Cancel
Save