1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-22 19:52:59 +04:00

Compare commits

...

5 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] a77e6a9e3f Initial plan 2025-11-22 23:56:12 +00:00
Lee Thomason 888bbb912a Merge branch 'MattHuangGarmin-master' into leethomason/fallthrough 2025-11-22 15:47:41 -08:00
Lee Thomason 9c09e46619 move to cpp file 2025-11-22 15:46:45 -08:00
Lee Thomason 6d6285b18a Merge branch 'master' of github.com:MattHuangGarmin/tinyxml2 into MattHuangGarmin-master 2025-11-22 15:44:05 -08:00
MattHuangGarmin be7b5a107f Fix GCC 4.9.3 Build Errors
Since GCC version 4.9.3 does not support the -Wimplicit-fallthrough warning option or the __attribute__((fallthrough)) annotation,
introduce the corresponding fixes to prevent build errors.
2025-11-04 14:40:21 +08:00
+42 -3
View File
@@ -32,6 +32,45 @@ distribution.
# include <cstdarg>
#endif
// Handle fallthrough attribute for different compilers
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#ifdef __cplusplus
# ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
# endif
#else
# ifndef __has_c_attribute
# define __has_c_attribute(x) 0
# endif
#endif
#ifdef __cplusplus
# if defined(_MSC_VER)
# define TIXML_FALLTHROUGH (void(0))
# elif (__cplusplus >= 201703L && __has_cpp_attribute(fallthrough))
# define TIXML_FALLTHROUGH [[fallthrough]]
# elif __has_cpp_attribute(clang::fallthrough)
# define TIXML_FALLTHROUGH [[clang::fallthrough]]
# elif __has_attribute(fallthrough)
# define TIXML_FALLTHROUGH __attribute__((fallthrough))
# else
# define TIXML_FALLTHROUGH (void(0))
# endif
#else
# if defined(_MSC_VER)
# define TIXML_FALLTHROUGH (void(0))
# elif __has_c_attribute(fallthrough)
# define TIXML_FALLTHROUGH [[fallthrough]]
# elif __has_attribute(fallthrough)
# define TIXML_FALLTHROUGH __attribute__((fallthrough))
# else
# define TIXML_FALLTHROUGH (void(0))
# endif
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE)
// Microsoft Visual Studio, version 2005 and higher. Not WinCE.
/*int _snprintf_s(
@@ -446,17 +485,17 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length
--output;
*output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
TIXML_FALLTHROUGH;
case 3:
--output;
*output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
TIXML_FALLTHROUGH;
case 2:
--output;
*output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
//fall through
TIXML_FALLTHROUGH;
case 1:
--output;
*output = static_cast<char>(input | FIRST_BYTE_MARK[*length]);