diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 4e72afe..ab59c1e 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -143,8 +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__) +#elif defined(__APPLE__) && __clang_major__ >= 14 // Xcode 14 marks snprintf as deprecated while still using C++98 by default +# define PUGI__SNPRINTF(buf, fmt, arg1, arg2) snprintf(buf, sizeof(buf), fmt, arg1, arg2) #else # define PUGI__SNPRINTF sprintf #endif diff --git a/tests/test_document.cpp b/tests/test_document.cpp index fca6bd9..2e2904d 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -737,7 +737,7 @@ struct temp_file { static int index = 0; - #if __cplusplus >= 201103 + #if __cplusplus >= 201103 || defined(__APPLE__) // Xcode 14 warns about use of sprintf in C++98 builds snprintf(path, sizeof(path), "%stempfile%d", test_runner::_temp_path, index++); #else sprintf(path, "%stempfile%d", test_runner::_temp_path, index++); diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 29b4dfd..0c1e3af 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -796,7 +796,7 @@ struct test_walker: xml_tree_walker { char buf[32]; - #if __cplusplus >= 201103 + #if __cplusplus >= 201103 || defined(__APPLE__) // Xcode 14 warns about use of sprintf in C++98 builds snprintf(buf, sizeof(buf), "%d", depth()); #else sprintf(buf, "%d", depth());