File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,33 @@ namespace __crt_stdio_output {
3030// reads the next argument of type T from the varargs list and updates the
3131// va_list, just like va_arg does. The 'peek' function returns the next argument
3232// of type T, but does not modify the va_list.
33+ #if defined(__GNUC__) || defined(__clang__)
34+ template <typename T> struct _va_arg_promoted_tye { using type = T; };
35+ template <> struct _va_arg_promoted_tye <signed char > { using type = int ; };
36+ template <> struct _va_arg_promoted_tye <unsigned char > { using type = int ; };
37+ template <> struct _va_arg_promoted_tye <wchar_t > { using type = int ; };
38+ template <> struct _va_arg_promoted_tye <short int > { using type = int ; };
39+ template <> struct _va_arg_promoted_tye <short unsigned int > { using type = int ; };
40+ #endif
41+
3342template <typename T>
3443T read_va_arg (va_list& arglist) throw()
3544{
45+ #if defined(__GNUC__) || defined(__clang__)
46+ return (T)(va_arg (arglist, typename _va_arg_promoted_tye<T>::type));
47+ #else
3648 return va_arg (arglist, T);
49+ #endif
3750}
3851
3952template <typename T>
4053T peek_va_arg (va_list arglist) throw()
4154{
55+ #if defined(__GNUC__) || defined(__clang__)
56+ return (T)(va_arg (arglist, typename _va_arg_promoted_tye<T>::type));
57+ #else
4258 return va_arg (arglist, T);
59+ #endif
4360}
4461
4562
You can’t perform that action at this time.
0 commit comments