https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9dc185ede4a0a3c9bda1…
commit f9dc185ede4a0a3c9bda1a4a77d034ceebda8d41
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Oct 13 17:02:51 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Jan 16 14:18:53 2025 +0200
[UCRT] Use a C cast instead of const_cast for GCC
This is because GCC will generate errors for both const_cast and static_cast depending on the template parameter:
- With const_cast: error: invalid 'const_cast' from type 'std::nullptr_t' to type 'const wchar_t**'
- With static_cast: error: invalid 'static_cast' from type 'wchar_t** const' to type 'const wchar_t**'
---
sdk/lib/ucrt/inc/corecrt_internal_strtox.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/lib/ucrt/inc/corecrt_internal_strtox.h b/sdk/lib/ucrt/inc/corecrt_internal_strtox.h
index 102724dda7d..d3c4a0c0fb7 100644
--- a/sdk/lib/ucrt/inc/corecrt_internal_strtox.h
+++ b/sdk/lib/ucrt/inc/corecrt_internal_strtox.h
@@ -1870,7 +1870,7 @@ c_string_character_source<Character> __cdecl make_c_string_character_source(
EndPointer const end
) throw()
{
- return c_string_character_source<Character>(string, const_cast<Character const**>(end));
+ return c_string_character_source<Character>(string, (Character const**)(end));
}
template <typename Integer, typename Character, typename EndPointer>
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=47e3f49e5266ce9e4668b…
commit 47e3f49e5266ce9e4668bc96140161877ed0ba41
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Oct 14 00:08:12 2024 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Jan 16 14:18:53 2025 +0200
[UCRT] No __declspec(spectre(nomitigation)) for GCC/Clang
---
sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h b/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h
index bb4d545d88c..6f9878a52cc 100644
--- a/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h
+++ b/sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h
@@ -576,7 +576,10 @@ public:
// Instead of using an lfence mitigation, we can fill the table to a power of two,
// then bitwise-and all values used to index into the array.
- __declspec(spectre(nomitigation)) T const& operator[](size_t const index) const
+ #if defined(_MSC_VER) && !defined(__clang__)
+ __declspec(spectre(nomitigation))
+ #endif
+ T const& operator[](size_t const index) const
{
return m_array[index & mask];
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a21a206c89409c3d1418e…
commit a21a206c89409c3d1418e1e69e0562f621517dcf
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Oct 14 00:03:54 2024 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)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
}