https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a21a206c89409c3d1418e1e69e0562f621517dcf
commit a21a206c89409c3d1418e1e69e0562f621517dcf Author: Timo Kreuzer <timo.kreu...@reactos.org> AuthorDate: Mon Oct 14 00:03:54 2024 +0300 Commit: Timo Kreuzer <timo.kreu...@reactos.org> CommitDate: Thu Jan 16 14:18:53 2025 +0200 [UCRT] Add workaround for va_arg warning about type promotion --- sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h b/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h index cde4af0e080..bb4d545d88c 100644 --- a/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h +++ b/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h @@ -30,16 +30,33 @@ namespace __crt_stdio_output { // reads the next argument of type T from the varargs list and updates the // va_list, just like va_arg does. The 'peek' function returns the next argument // of type T, but does not modify the va_list. +#if defined(__GNUC__) || defined(__clang__) +template<typename T> struct _va_arg_promoted_tye { using type = T; }; +template<> struct _va_arg_promoted_tye<signed char> { using type = int; }; +template<> struct _va_arg_promoted_tye<unsigned char> { using type = int; }; +template<> struct _va_arg_promoted_tye<wchar_t> { using type = int; }; +template<> struct _va_arg_promoted_tye<short int> { using type = int; }; +template<> struct _va_arg_promoted_tye<short unsigned int> { using type = int; }; +#endif + template <typename T> T read_va_arg(va_list& arglist) throw() { +#if defined(__GNUC__) || defined(__clang__) + return (T)(va_arg(arglist, typename _va_arg_promoted_tye<T>::type)); +#else return va_arg(arglist, T); +#endif } template <typename T> T peek_va_arg(va_list arglist) throw() { +#if defined(__GNUC__) || defined(__clang__) + return (T)(va_arg(arglist, typename _va_arg_promoted_tye<T>::type)); +#else return va_arg(arglist, T); +#endif }