https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a438d7c3b88d33bdb393e…
commit a438d7c3b88d33bdb393e3dc3eec3214d7acbf15
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Nov 9 19:19:52 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Jan 30 11:30:32 2025 +0200
[UCRT] Add GCC compatible definition of _CRT_STDIO_INLINE
In C99 mode GCC emits global symbols for inline functions, as soon as the compilation unit contains a declaration that marks the function as "extern". A number of functions like printf are implicitly declared as extern by GCC, which seemingly cannot be disabled. This would lead to the inline function being emitted as a global symbol in every compilation unit. Using static inline prevents duplicate symbol errors.
---
sdk/include/ucrt/corecrt_stdio_config.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sdk/include/ucrt/corecrt_stdio_config.h b/sdk/include/ucrt/corecrt_stdio_config.h
index 360a45824d6..cc4b410b525 100644
--- a/sdk/include/ucrt/corecrt_stdio_config.h
+++ b/sdk/include/ucrt/corecrt_stdio_config.h
@@ -23,7 +23,11 @@ _CRT_BEGIN_C_HEADER
#undef _CRT_STDIO_INLINE
#define _CRT_STDIO_INLINE
#elif !defined _CRT_STDIO_INLINE
+ #if defined(__GNUC__)
+ #define _CRT_STDIO_INLINE static __inline
+ #else
#define _CRT_STDIO_INLINE __inline
+ #endif
#endif
#if !defined RC_INVOKED // RC has no target architecture
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4ca68ffb1c8adef648400…
commit 4ca68ffb1c8adef6484005ce457bfed7db82b8c3
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Nov 9 19:21:11 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Jan 30 11:30:32 2025 +0200
[UCRT] Make __local_stdio_printf/scanf_options GCC compatible
---
sdk/include/ucrt/corecrt_stdio_config.h | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/sdk/include/ucrt/corecrt_stdio_config.h b/sdk/include/ucrt/corecrt_stdio_config.h
index 88e041260d5..360a45824d6 100644
--- a/sdk/include/ucrt/corecrt_stdio_config.h
+++ b/sdk/include/ucrt/corecrt_stdio_config.h
@@ -82,24 +82,20 @@ _CRT_BEGIN_C_HEADER
#endif
#if _CRT_FUNCTIONS_REQUIRED
- // This function must not be inlined into callers to avoid ODR violations. The
- // static local variable has different names in C and in C++ translation units.
+ __declspec(selectany) unsigned __int64 __local_stdio_printf_options_storage;
_Check_return_ _Ret_notnull_
_CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE
- __declspec(noinline) __inline unsigned __int64* __CRTDECL __local_stdio_printf_options(void)
+ __inline unsigned __int64* __CRTDECL __local_stdio_printf_options(void)
{
- static unsigned __int64 _OptionsStorage;
- return &_OptionsStorage;
+ return &__local_stdio_printf_options_storage;
}
- // This function must not be inlined into callers to avoid ODR violations. The
- // static local variable has different names in C and in C++ translation units.
+ __declspec(selectany) unsigned __int64 __local_stdio_scanf_options_storage;
_Check_return_ _Ret_notnull_
_CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE
- __declspec(noinline) __inline unsigned __int64* __CRTDECL __local_stdio_scanf_options(void)
+ __inline unsigned __int64* __CRTDECL __local_stdio_scanf_options(void)
{
- static unsigned __int64 _OptionsStorage;
- return &_OptionsStorage;
+ return &__local_stdio_scanf_options_storage;
}
#endif