Fixed bug 4159 - Windows headers are included after packing alignment change
authorSam Lantinga <slouken@libsdl.org>
Mon, 07 May 2018 19:26:02 -0700
changeset 11957eba3a7c4ba16
parent 11956 f162f5d7798d
child 11958 d7582d7286aa
Fixed bug 4159 - Windows headers are included after packing alignment change

lectem

The SDL_syswm.h header includes the windows.h header after including begin_code.h which changes the structure packing alignment.

It seems this is not safe as suggested by the following warning :
warning C4121: 'JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2': alignment of a member was sensitive to packing
include/SDL_syswm.h
     1.1 --- a/include/SDL_syswm.h	Sat May 05 10:31:03 2018 -0700
     1.2 +++ b/include/SDL_syswm.h	Mon May 07 19:26:02 2018 -0700
     1.3 @@ -33,12 +33,6 @@
     1.4  #include "SDL_video.h"
     1.5  #include "SDL_version.h"
     1.6  
     1.7 -#include "begin_code.h"
     1.8 -/* Set up for C function definitions, even when using C++ */
     1.9 -#ifdef __cplusplus
    1.10 -extern "C" {
    1.11 -#endif
    1.12 -
    1.13  /**
    1.14   *  \file SDL_syswm.h
    1.15   *
    1.16 @@ -110,6 +104,12 @@
    1.17  #include "SDL_egl.h"
    1.18  #endif
    1.19  
    1.20 +#include "begin_code.h"
    1.21 +/* Set up for C function definitions, even when using C++ */
    1.22 +#ifdef __cplusplus
    1.23 +extern "C" {
    1.24 +#endif
    1.25 +
    1.26  /**
    1.27   *  These are the various supported windowing subsystems
    1.28   */