From aa408ccfecedb60bf920cd22861cfc27a80550cf Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 10 Oct 2016 15:21:15 -1000 Subject: [PATCH] Move LTO-problematic definitions out of header --- hecl/extern/boo | 2 +- hecl/include/hecl/hecl.hpp | 34 +++----------------------------- hecl/lib/hecl.cpp | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/hecl/extern/boo b/hecl/extern/boo index 51a097da6..1877c546a 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 51a097da6bf0c2b3f101aa922e2597eaed239c54 +Subproject commit 1877c546acfe472a7220c4d26c28d74377d77146 diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index fea64cccd..77979f4d6 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -415,42 +415,14 @@ static inline unsigned long StrToUl(const SystemChar* str, SystemChar** endPtr, #if __GNUC__ __attribute__((__format__ (__printf__, 1, 2))) #endif -static inline SystemString SysFormat(const SystemChar* format, ...) -{ - SystemChar resultBuf[FORMAT_BUF_SZ]; - va_list va; - va_start(va, format); -#if HECL_UCS2 - int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va); -#else - int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va); -#endif - va_end(va); - return SystemString(resultBuf, printSz); -} +SystemString SysFormat(const SystemChar* format, ...); #if __GNUC__ __attribute__((__format__ (__printf__, 1, 2))) #endif -static inline std::string Format(const char* format, ...) -{ - char resultBuf[FORMAT_BUF_SZ]; - va_list va; - va_start(va, format); - int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va); - va_end(va); - return std::string(resultBuf, printSz); -} +std::string Format(const char* format, ...); -static inline std::wstring WideFormat(const wchar_t* format, ...) -{ - wchar_t resultBuf[FORMAT_BUF_SZ]; - va_list va; - va_start(va, format); - int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va); - va_end(va); - return std::wstring(resultBuf, printSz); -} +std::wstring WideFormat(const wchar_t* format, ...); static inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz) diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index 3e093e513..5405bd1ec 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -25,6 +25,46 @@ unsigned VerbosityLevel = 0; logvisor::Module LogModule("hecl"); static const std::string Illegals {"<>?\"|"}; +#if __GNUC__ +__attribute__((__format__ (__printf__, 1, 2))) +#endif +SystemString SysFormat(const SystemChar* format, ...) +{ + SystemChar resultBuf[FORMAT_BUF_SZ]; + va_list va; + va_start(va, format); +#if HECL_UCS2 + int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va); +#else + int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va); +#endif + va_end(va); + return SystemString(resultBuf, printSz); +} + +#if __GNUC__ +__attribute__((__format__ (__printf__, 1, 2))) +#endif +std::string Format(const char* format, ...) +{ + char resultBuf[FORMAT_BUF_SZ]; + va_list va; + va_start(va, format); + int printSz = vsnprintf(resultBuf, FORMAT_BUF_SZ, format, va); + va_end(va); + return std::string(resultBuf, printSz); +} + +std::wstring WideFormat(const wchar_t* format, ...) +{ + wchar_t resultBuf[FORMAT_BUF_SZ]; + va_list va; + va_start(va, format); + int printSz = vswprintf(resultBuf, FORMAT_BUF_SZ, format, va); + va_end(va); + return std::wstring(resultBuf, printSz); +} + void SanitizePath(std::string& path) { if (path.empty())