Skip to content

Commit 8486b2e

Browse files
committed
Common: include standard headers before doing any defines
currently, due to ```c++ \#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API #include <basetsd.h> #ifndef snprintf #define snprintf sprintf_s #endif #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) ``` defining `snprintf` to `sprintf_s` essentially unconditionally, this will break the stdio.h+cstdio system header for mingw-w64 g++ in msys2 with shaderc google/shaderc#1065 an alternative change would be https://raw.githubusercontent.com/shinchiro/mpv-winbuild-cmake/master/packages/glslang-0001-fix-gcc-10.1-error.patch in which the `|| defined MINGW_HAS_SECURE_API` part is removed Signed-off-by: Christopher Degawa <[email protected]>
1 parent 1ee5d1c commit 8486b2e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

glslang/Include/Common.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
#ifndef _COMMON_INCLUDED_
3838
#define _COMMON_INCLUDED_
3939

40+
#include <algorithm>
41+
#include <cassert>
42+
#include <cstdio>
43+
#include <cstdlib>
44+
#include <list>
45+
#include <map>
46+
#include <set>
47+
#include <string>
48+
#include <unordered_map>
49+
#include <unordered_set>
50+
#include <vector>
4051

4152
#if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700)
4253
#include <sstream>
@@ -93,18 +104,6 @@ std::string to_string(const T& val) {
93104
#pragma warning(disable : 4201) // nameless union
94105
#endif
95106

96-
#include <set>
97-
#include <unordered_set>
98-
#include <vector>
99-
#include <map>
100-
#include <unordered_map>
101-
#include <list>
102-
#include <algorithm>
103-
#include <string>
104-
#include <cstdio>
105-
#include <cstdlib>
106-
#include <cassert>
107-
108107
#include "PoolAlloc.h"
109108

110109
//

0 commit comments

Comments
 (0)