Skip to content

Commit 4ca68ff

Browse files
committed
[UCRT] Make __local_stdio_printf/scanf_options GCC compatible
1 parent bb9392e commit 4ca68ff

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

sdk/include/ucrt/corecrt_stdio_config.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,20 @@ _CRT_BEGIN_C_HEADER
8282
#endif
8383

8484
#if _CRT_FUNCTIONS_REQUIRED
85-
// This function must not be inlined into callers to avoid ODR violations. The
86-
// static local variable has different names in C and in C++ translation units.
85+
__declspec(selectany) unsigned __int64 __local_stdio_printf_options_storage;
8786
_Check_return_ _Ret_notnull_
8887
_CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE
89-
__declspec(noinline) __inline unsigned __int64* __CRTDECL __local_stdio_printf_options(void)
88+
__inline unsigned __int64* __CRTDECL __local_stdio_printf_options(void)
9089
{
91-
static unsigned __int64 _OptionsStorage;
92-
return &_OptionsStorage;
90+
return &__local_stdio_printf_options_storage;
9391
}
9492

95-
// This function must not be inlined into callers to avoid ODR violations. The
96-
// static local variable has different names in C and in C++ translation units.
93+
__declspec(selectany) unsigned __int64 __local_stdio_scanf_options_storage;
9794
_Check_return_ _Ret_notnull_
9895
_CRT_INLINE_PURE_SECURITYCRITICAL_ATTRIBUTE
99-
__declspec(noinline) __inline unsigned __int64* __CRTDECL __local_stdio_scanf_options(void)
96+
__inline unsigned __int64* __CRTDECL __local_stdio_scanf_options(void)
10097
{
101-
static unsigned __int64 _OptionsStorage;
102-
return &_OptionsStorage;
98+
return &__local_stdio_scanf_options_storage;
10399
}
104100
#endif
105101

0 commit comments

Comments
 (0)