mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-26 12:41:06 +08:00
Fix Xcode 14 sprintf deprecation warning
We use snprintf when stdc is set to C++11, however in C++98 mode we can't use variadic macros, and Xcode 14 complains about the use of sprintf. It should be safe however to use variadic macros on any remotely recent version of clang on Apple, unless -pedantic is defined which warns against the use of variadic macros in C++98 mode... This change fixes the problem for the builds that don't specify -pedantic, which is a problem for another day.
This commit is contained in:
parent
a0e0643363
commit
8be081fbbe
@ -143,6 +143,8 @@ using std::memset;
|
||||
# define PUGI__SNPRINTF(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__)
|
||||
#elif defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400
|
||||
# define PUGI__SNPRINTF(buf, ...) _snprintf_s(buf, _countof(buf), _TRUNCATE, __VA_ARGS__)
|
||||
#elif defined(__APPLE__) && __clang_major__ >= 14 && !defined(__STRICT_ANSI__) // Xcode 14 marks snprintf as deprecated while still using C++98 by default
|
||||
# define PUGI__SNPRINTF(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__)
|
||||
#else
|
||||
# define PUGI__SNPRINTF sprintf
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user