Browse Source

Platform: silence clang-cl warnings from internal SDL headers.

pull/405/head
Vladimír Vondruš 6 years ago
parent
commit
32eb99890e
  1. 10
      src/Magnum/Platform/Sdl2Application.cpp
  2. 11
      src/Magnum/Platform/Sdl2Application.h
  3. 10
      src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp

10
src/Magnum/Platform/Sdl2Application.cpp

@ -26,7 +26,17 @@
#include "Sdl2Application.h"
#include <cstring>
#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 <SDL.h>
#ifdef CORRADE_TARGET_CLANG_CL
#pragma clang diagnostic pop
#endif
#ifndef CORRADE_TARGET_EMSCRIPTEN
#include <tuple>
#else

11
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 <SDL_keycode.h>
#include <SDL_mouse.h>
@ -57,6 +65,9 @@
#include <SDL_main.h> /* For SDL_WinRTRunApp */
#include <wrl.h> /* For the WinMain entrypoint */
#endif
#ifdef CORRADE_TARGET_CLANG_CL
#pragma clang diagnostic pop
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT
union SDL_Event; /* for anyEvent() */

10
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 <SDL_events.h>
#ifdef CORRADE_TARGET_CLANG_CL
#pragma clang diagnostic pop
#endif
namespace Magnum { namespace Platform { namespace Test { namespace {

Loading…
Cancel
Save