Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Guillaume_G:WSL
mingw64-wxWidgets-3_0
16984-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 16984-2.patch of Package mingw64-wxWidgets-3_0
commit 6d54c49b2a672ab503ddfaae4174cbd5dfec2ce0 Author: Vadim Zeitlin <vadim@wxwidgets.org> Date: Thu May 26 23:37:28 2016 +0200 Fix build with classic MinGW in strict ANSI mode when using PCH The hack used in cc774bb3016813e67591c019d716f8e0861f8bb9 to include some standard headers after undefining __STRICT_ANSI__ doesn't work when precompiled headers are used because the headers had been already included from wx/wxprec.h then. So instead bite the bullet and just reproduce MinGW stdlib.h declarations to define "environ" ourselves, it's not that bad and hopefully won't need much maintenance as later versions won't need the strict ANSI workarounds at all. As for tzset(), wxDECL_FOR_STRICT_MINGW32() can be used for it without any problems at all, not sure why hasn't it been done like this since the beginning. See #16984. diff --git a/src/common/time.cpp b/src/common/time.cpp index b9ccf39..6c42da5 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -22,23 +22,6 @@ #pragma hdrstop #endif -// This is a horrible hack which only works because we don't currently include -// <time.h> from wx/wxprec.h. It is needed because we need timezone-related -// stuff from MinGW time.h, but it is not compiled in strict ANSI mode and it -// is too complicated to be dealt with using wxDECL_FOR_STRICT_MINGW32(). So we -// just include the header after undefining __STRICT_ANSI__ to get all the -// declarations we need -- and then define it back to avoid inconsistencies in -// all our other headers. -// -// Note that the same hack is used for "environ" in utilscmn.cpp, so if the -// code here is modified because this hack becomes unnecessary or a better -// solution is found, the code there should be updated as well. -#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS - #undef __STRICT_ANSI__ - #include <time.h> - #define __STRICT_ANSI__ -#endif - #include "wx/time.h" #ifndef WX_PRECOMP @@ -71,6 +54,7 @@ #include "wx/msw/wince/time.h" #endif +wxDECL_FOR_STRICT_MINGW32(void, tzset, (void)); #if !defined(__WXMAC__) && !defined(__WXWINCE__) #include <sys/types.h> // for time_t diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index fbf933f..7394fe3 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -23,12 +23,27 @@ #pragma hdrstop #endif -// See comment about this hack in time.cpp: here we do it for environ external -// variable which can't be easily declared when using MinGW in strict ANSI mode. +// This is a needed to get the declaration of the global "environ" variable +// from MinGW headers which don't declare it there when in strict ANSI mode. We +// can't use the usual wxDECL_FOR_STRICT_MINGW32() hack for it because it's not +// even a variable, but a macro expanding to a function or a variable depending +// on the build and this is horribly brittle but there just doesn't seem to be +// any other alternative. #ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS - #undef __STRICT_ANSI__ + // Notice that undefining __STRICT_ANSI__ and including it here doesn't + // work because it could have been already included, e.g. when using PCH. #include <stdlib.h> - #define __STRICT_ANSI__ + + #ifndef environ + // This just reproduces what stdlib.h does in MinGW 4.8.1. + #ifdef __MSVCRT__ + wxDECL_FOR_STRICT_MINGW32(char ***, __p__environ, (void)); + #define environ (*__p__environ()) + #else + extern char *** _imp___environ_dll; + #define environ (*_imp___environ_dll) + #endif + #endif // defined(environ) #endif #ifndef WX_PRECOMP
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor