0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-13 17:37:58 +08:00

Adjust the workaround for -pedantic mode and fix tests

This commit is contained in:
Arseny Kapoulkine 2022-11-06 10:21:35 -08:00
parent 8be081fbbe
commit b6b747244e
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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++);

View File

@ -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());