From 32eb99890e713c97f2ae0fd42bd7c6e9b532350b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 18 Dec 2019 19:43:58 +0100 Subject: [PATCH] Platform: silence clang-cl warnings from internal SDL headers. --- src/Magnum/Platform/Sdl2Application.cpp | 10 ++++++++++ src/Magnum/Platform/Sdl2Application.h | 11 +++++++++++ src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 1f5ae7e24..527b292b5 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -26,7 +26,17 @@ #include "Sdl2Application.h" #include +#ifdef CORRADE_TARGET_CLANG_CL +/* SDL does #pragma pack(push,8) and #pragma pack(pop,8) in different headers + (begin_code.h and end_code.h) and clang-cl doesn't like that, even though it + is completely fine. Silence the warning. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpragma-pack" +#endif #include +#ifdef CORRADE_TARGET_CLANG_CL +#pragma clang diagnostic pop +#endif #ifndef CORRADE_TARGET_EMSCRIPTEN #include #else diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 2dae1f491..6ac7dcb9a 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -46,6 +46,14 @@ #ifdef CORRADE_TARGET_WINDOWS /* Windows version of SDL2 redefines main(), we don't want that */ #define SDL_MAIN_HANDLED #endif + +#ifdef CORRADE_TARGET_CLANG_CL +/* SDL does #pragma pack(push,8) and #pragma pack(pop,8) in different headers + (begin_code.h and end_code.h) and clang-cl doesn't like that, even though it + is completely fine. Silence the warning. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpragma-pack" +#endif /* SDL.h includes the world, adding 50k LOC. We don't want that either. */ #include #include @@ -57,6 +65,9 @@ #include /* For SDL_WinRTRunApp */ #include /* For the WinMain entrypoint */ #endif +#ifdef CORRADE_TARGET_CLANG_CL +#pragma clang diagnostic pop +#endif #ifndef DOXYGEN_GENERATING_OUTPUT union SDL_Event; /* for anyEvent() */ diff --git a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp index accd868c8..f81605217 100644 --- a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp +++ b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp @@ -33,7 +33,17 @@ #include "Magnum/Trade/AbstractImporter.h" #include "Magnum/Trade/ImageData.h" +#ifdef CORRADE_TARGET_CLANG_CL +/* SDL does #pragma pack(push,8) and #pragma pack(pop,8) in different headers + (begin_code.h and end_code.h) and clang-cl doesn't like that, even though it + is completely fine. Silence the warning. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpragma-pack" +#endif #include +#ifdef CORRADE_TARGET_CLANG_CL +#pragma clang diagnostic pop +#endif namespace Magnum { namespace Platform { namespace Test { namespace {