From 8486b2e0db150a3e0761db6930a7b41cc7a8c83f Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Sun, 12 Jul 2020 00:02:20 +0000 Subject: [PATCH] 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 #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 https://github.com/google/shaderc/issues/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 --- glslang/Include/Common.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index 733a790c..b628cdc2 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -37,6 +37,17 @@ #ifndef _COMMON_INCLUDED_ #define _COMMON_INCLUDED_ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) #include @@ -93,18 +104,6 @@ std::string to_string(const T& val) { #pragma warning(disable : 4201) // nameless union #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "PoolAlloc.h" //