From b3e80f5aecea6855ffea52a26daa89a75286c990 Mon Sep 17 00:00:00 2001 From: Josh de Kock <josh@itanimul.li> 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 | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index f7448fa00..f2fb10bf3 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -37,9 +37,24 @@ #ifndef _COMMON_INCLUDED_ #define _COMMON_INCLUDED_ + +#if defined(__ANDROID__) || _MSC_VER < 1700 +#include <sstream> +namespace std { +template<typename T> +std::string to_string(const T& val) { + std::ostringstream os; + os << val; + return os.str(); +} +} +#endif + #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)) #elif defined (solaris) #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) @@ -51,18 +66,6 @@ #define UINT_PTR uintptr_t #endif -#if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) -#include <sstream> -namespace std { -template<typename T> -std::string to_string(const T& val) { - std::ostringstream os; - os << val; - return os.str(); -} -} -#endif - #if defined(_MSC_VER) && _MSC_VER < 1800 inline long long int strtoll (const char* str, char** endptr, int base) { -- GitLab