From b3e80f5aecea6855ffea52a26daa89a75286c990 Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Sun, 11 Mar 2018 19:48:48 +0000 Subject: [PATCH] include/Common.h: reorder includes to avoid redefinition on some platforms On some systems sstream defines snprintf, this leads to the a redefinition of sprintf_s if snprintf is defined before checking if it exists in sstream. --- glslang/Include/Common.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index f7448fa0..f2fb10bf 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -37,21 +37,8 @@ #ifndef _COMMON_INCLUDED_ #define _COMMON_INCLUDED_ -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API - #include - #define snprintf sprintf_s - #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) -#elif defined (solaris) - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#else - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#endif -#if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) +#if defined(__ANDROID__) || _MSC_VER < 1700 #include namespace std { template @@ -63,6 +50,22 @@ std::string to_string(const T& val) { } #endif +#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)) +#elif defined (solaris) + #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) + #include + #define UINT_PTR uintptr_t +#else + #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) + #include + #define UINT_PTR uintptr_t +#endif + #if defined(_MSC_VER) && _MSC_VER < 1800 inline long long int strtoll (const char* str, char** endptr, int base) {