From ffd69754f9d6d37fcd01fe1ec58a9e7f9365e5e6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 13 Oct 2024 10:05:04 +0200 Subject: [PATCH] [UCRT] Fix non-standard extern "C" usage --- sdk/lib/ucrt/conio/cgets.cpp | 6 +-- sdk/lib/ucrt/conio/cgetws.cpp | 4 +- sdk/lib/ucrt/conio/getch.cpp | 2 +- sdk/lib/ucrt/conio/getwch.cpp | 2 +- sdk/lib/ucrt/convert/_wctype.cpp | 62 +++++++++++------------ sdk/lib/ucrt/convert/fp_flags.cpp | 2 +- sdk/lib/ucrt/heap/debug_heap.cpp | 8 +-- sdk/lib/ucrt/heap/debug_heap_hook.cpp | 2 +- sdk/lib/ucrt/heap/heap_handle.cpp | 2 +- sdk/lib/ucrt/inc/corecrt_internal_stdio.h | 4 +- sdk/lib/ucrt/locale/ctype.cpp | 18 +++---- sdk/lib/ucrt/locale/glstatus.cpp | 2 +- sdk/lib/ucrt/locale/localeconv.cpp | 14 ++--- sdk/lib/ucrt/locale/nlsdata.cpp | 16 +++--- sdk/lib/ucrt/lowio/ioinit.cpp | 8 +-- sdk/lib/ucrt/lowio/read.cpp | 4 +- sdk/lib/ucrt/lowio/umask.cpp | 2 +- sdk/lib/ucrt/misc/dbgrpt.cpp | 6 +-- sdk/lib/ucrt/misc/exception_filter.cpp | 12 ++--- sdk/lib/ucrt/startup/abort.cpp | 2 +- sdk/lib/ucrt/startup/exit.cpp | 4 +- sdk/lib/ucrt/startup/onexit.cpp | 4 +- sdk/lib/ucrt/stdio/_file.cpp | 6 +-- sdk/lib/ucrt/stdio/_sftbuf.cpp | 4 +- sdk/lib/ucrt/stdio/ncommode.cpp | 2 +- sdk/lib/ucrt/stdio/rmtmp.cpp | 6 +-- sdk/lib/ucrt/stdio/tmpfile.cpp | 2 +- 27 files changed, 104 insertions(+), 102 deletions(-) diff --git a/sdk/lib/ucrt/conio/cgets.cpp b/sdk/lib/ucrt/conio/cgets.cpp index b116cdf8ae2..fe3fffea718 100644 --- a/sdk/lib/ucrt/conio/cgets.cpp +++ b/sdk/lib/ucrt/conio/cgets.cpp @@ -11,7 +11,7 @@ -extern "C" extern intptr_t __dcrt_lowio_console_input_handle; +extern "C" { extern intptr_t __dcrt_lowio_console_input_handle; } @@ -20,8 +20,8 @@ extern "C" extern intptr_t __dcrt_lowio_console_input_handle; // character buffer and the unicode character is not converted to single byte // MBC, then _cget_s should buffer that character so that next call to // _cgetws_s can return the same character. -extern "C" extern wchar_t __console_wchar_buffer; -extern "C" extern int __console_wchar_buffer_used; +extern "C" { extern wchar_t __console_wchar_buffer; } +extern "C" { extern int __console_wchar_buffer_used; } diff --git a/sdk/lib/ucrt/conio/cgetws.cpp b/sdk/lib/ucrt/conio/cgetws.cpp index 7dc4a25afbb..0149e82b2b4 100644 --- a/sdk/lib/ucrt/conio/cgetws.cpp +++ b/sdk/lib/ucrt/conio/cgetws.cpp @@ -15,8 +15,8 @@ // character buffer and the unicode character is not converted to single byte // MBC, then _cget_s should buffer that character so that next call to // _cgetws_s can return the same character. -extern "C" wchar_t __console_wchar_buffer = 0; -extern "C" int __console_wchar_buffer_used = 0; +extern "C" { wchar_t __console_wchar_buffer = 0; } +extern "C" { int __console_wchar_buffer_used = 0; } diff --git a/sdk/lib/ucrt/conio/getch.cpp b/sdk/lib/ucrt/conio/getch.cpp index 2d1dba3720e..0a8699b8053 100644 --- a/sdk/lib/ucrt/conio/getch.cpp +++ b/sdk/lib/ucrt/conio/getch.cpp @@ -229,7 +229,7 @@ static int get_next_getch_pushback_buffer() return ret_val; } -extern "C" extern intptr_t __dcrt_lowio_console_input_handle; +extern "C" intptr_t __dcrt_lowio_console_input_handle; extern "C" CharPair const* __cdecl _getextendedkeycode(KEY_EVENT_RECORD*); extern "C" int __cdecl _kbhit_nolock(); diff --git a/sdk/lib/ucrt/conio/getwch.cpp b/sdk/lib/ucrt/conio/getwch.cpp index df8902e6c1e..cfc0a8ab7ac 100644 --- a/sdk/lib/ucrt/conio/getwch.cpp +++ b/sdk/lib/ucrt/conio/getwch.cpp @@ -27,7 +27,7 @@ namespace static wint_t wchbuf = WEOF; // The push-back buffer -extern "C" extern intptr_t __dcrt_lowio_console_input_handle; +extern "C" intptr_t __dcrt_lowio_console_input_handle; extern "C" CharPair const* __cdecl _getextendedkeycode(KEY_EVENT_RECORD*); diff --git a/sdk/lib/ucrt/convert/_wctype.cpp b/sdk/lib/ucrt/convert/_wctype.cpp index f82d766357f..e1a64516a5b 100644 --- a/sdk/lib/ucrt/convert/_wctype.cpp +++ b/sdk/lib/ucrt/convert/_wctype.cpp @@ -14,158 +14,158 @@ -extern "C" extern __inline int (__cdecl _isleadbyte_l)(int const c, _locale_t const locale) +extern "C" __inline int (__cdecl _isleadbyte_l)(int const c, _locale_t const locale) { _LocaleUpdate locale_update(locale); return __acrt_locale_get_ctype_array_value(locale_update.GetLocaleT()->locinfo->_public._locale_pctype, c, _LEADBYTE); } -extern "C" extern __inline int (__cdecl isleadbyte)(int const c) +extern "C" __inline int (__cdecl isleadbyte)(int const c) { return (_isleadbyte_l)(c, nullptr); } -extern "C" extern __inline int (__cdecl _iswalpha_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswalpha_l)(wint_t const c, _locale_t) { return iswalpha(c); } -extern "C" extern __inline int (__cdecl iswalpha)(wint_t const c) +extern "C" __inline int (__cdecl iswalpha)(wint_t const c) { return iswalpha(c); } -extern "C" extern __inline int (__cdecl _iswupper_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswupper_l)(wint_t const c, _locale_t) { return iswupper(c); } -extern "C" extern __inline int (__cdecl iswupper)(wint_t const c) +extern "C" __inline int (__cdecl iswupper)(wint_t const c) { return iswupper(c); } -extern "C" extern __inline int (__cdecl _iswlower_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswlower_l)(wint_t const c, _locale_t) { return iswlower(c); } -extern "C" extern __inline int (__cdecl iswlower)(wint_t const c) +extern "C" __inline int (__cdecl iswlower)(wint_t const c) { return iswlower(c); } -extern "C" extern __inline int (__cdecl _iswdigit_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswdigit_l)(wint_t const c, _locale_t) { return iswdigit(c); } -extern "C" extern __inline int (__cdecl iswdigit)(wint_t const c) +extern "C" __inline int (__cdecl iswdigit)(wint_t const c) { return iswdigit(c); } -extern "C" extern __inline int (__cdecl _iswxdigit_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswxdigit_l)(wint_t const c, _locale_t) { return iswxdigit(c); } -extern "C" extern __inline int (__cdecl iswxdigit)(wint_t const c) +extern "C" __inline int (__cdecl iswxdigit)(wint_t const c) { return iswxdigit(c); } -extern "C" extern __inline int (__cdecl _iswspace_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswspace_l)(wint_t const c, _locale_t) { return iswspace(c); } -extern "C" extern __inline int (__cdecl iswspace)(wint_t const c) +extern "C" __inline int (__cdecl iswspace)(wint_t const c) { return iswspace(c); } -extern "C" extern __inline int (__cdecl _iswpunct_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswpunct_l)(wint_t const c, _locale_t) { return iswpunct(c); } -extern "C" extern __inline int (__cdecl iswpunct)(wint_t const c) +extern "C" __inline int (__cdecl iswpunct)(wint_t const c) { return iswpunct(c); } -extern "C" extern __inline int (__cdecl _iswblank_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswblank_l)(wint_t const c, _locale_t) { return iswblank(c); } -extern "C" extern __inline int (__cdecl iswblank)(wint_t const c) +extern "C" __inline int (__cdecl iswblank)(wint_t const c) { return iswblank(c); } -extern "C" extern __inline int (__cdecl _iswalnum_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswalnum_l)(wint_t const c, _locale_t) { return iswalnum(c); } -extern "C" extern __inline int (__cdecl iswalnum)(wint_t const c) +extern "C" __inline int (__cdecl iswalnum)(wint_t const c) { return iswalnum(c); } -extern "C" extern __inline int (__cdecl _iswprint_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswprint_l)(wint_t const c, _locale_t) { return iswprint(c); } -extern "C" extern __inline int (__cdecl iswprint)(wint_t const c) +extern "C" __inline int (__cdecl iswprint)(wint_t const c) { return iswprint(c); } -extern "C" extern __inline int (__cdecl _iswgraph_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswgraph_l)(wint_t const c, _locale_t) { return iswgraph(c); } -extern "C" extern __inline int (__cdecl iswgraph)(wint_t const c) +extern "C" __inline int (__cdecl iswgraph)(wint_t const c) { return iswgraph(c); } -extern "C" extern __inline int (__cdecl _iswcntrl_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswcntrl_l)(wint_t const c, _locale_t) { return iswcntrl(c); } -extern "C" extern __inline int (__cdecl iswcntrl)(wint_t const c) +extern "C" __inline int (__cdecl iswcntrl)(wint_t const c) { return iswcntrl(c); } -extern "C" extern __inline int (__cdecl iswascii)(wint_t const c) +extern "C" __inline int (__cdecl iswascii)(wint_t const c) { return iswascii(c); } -extern "C" extern __inline int (__cdecl _iswcsym_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswcsym_l)(wint_t const c, _locale_t) { return __iswcsym(c); } -extern "C" extern __inline int (__cdecl __iswcsym)(wint_t const c) +extern "C" __inline int (__cdecl __iswcsym)(wint_t const c) { return __iswcsym(c); } -extern "C" extern __inline int (__cdecl _iswcsymf_l)(wint_t const c, _locale_t) +extern "C" __inline int (__cdecl _iswcsymf_l)(wint_t const c, _locale_t) { return __iswcsymf(c); } -extern "C" extern __inline int (__cdecl __iswcsymf)(wint_t const c) +extern "C" __inline int (__cdecl __iswcsymf)(wint_t const c) { return __iswcsymf(c); } diff --git a/sdk/lib/ucrt/convert/fp_flags.cpp b/sdk/lib/ucrt/convert/fp_flags.cpp index 011050b2f77..d7a5f4f1b9b 100644 --- a/sdk/lib/ucrt/convert/fp_flags.cpp +++ b/sdk/lib/ucrt/convert/fp_flags.cpp @@ -6,7 +6,7 @@ // Public data used by the floating point library // -extern "C" int __fastflag{0}; +extern "C" { int __fastflag{0}; } diff --git a/sdk/lib/ucrt/heap/debug_heap.cpp b/sdk/lib/ucrt/heap/debug_heap.cpp index 9d838bc24e0..0a8841e0c5e 100644 --- a/sdk/lib/ucrt/heap/debug_heap.cpp +++ b/sdk/lib/ucrt/heap/debug_heap.cpp @@ -141,9 +141,11 @@ static long __acrt_current_request_number{1}; #undef _crtDbgFlag #undef _crtBreakAlloc -extern "C" int _crtDbgFlag{_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_DEFAULT_DF}; -extern "C" long _crtBreakAlloc{-1}; -extern "C" _CRT_DUMP_CLIENT _pfnDumpClient{nullptr}; +extern "C" { + int _crtDbgFlag{_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_DEFAULT_DF}; + long _crtBreakAlloc{-1}; + _CRT_DUMP_CLIENT _pfnDumpClient{nullptr}; +} extern "C" int* __p__crtDbgFlag() { diff --git a/sdk/lib/ucrt/heap/debug_heap_hook.cpp b/sdk/lib/ucrt/heap/debug_heap_hook.cpp index d20dc27225f..475bc72ada9 100644 --- a/sdk/lib/ucrt/heap/debug_heap_hook.cpp +++ b/sdk/lib/ucrt/heap/debug_heap_hook.cpp @@ -37,4 +37,4 @@ extern "C" int __cdecl _CrtDefaultAllocHook( return 1; // Allow all heap operations } -extern "C" _CRT_ALLOC_HOOK _pfnAllocHook = _CrtDefaultAllocHook; +extern "C" { _CRT_ALLOC_HOOK _pfnAllocHook = _CrtDefaultAllocHook; } diff --git a/sdk/lib/ucrt/heap/heap_handle.cpp b/sdk/lib/ucrt/heap/heap_handle.cpp index 7a7a2cf54bd..1d942d930b5 100644 --- a/sdk/lib/ucrt/heap/heap_handle.cpp +++ b/sdk/lib/ucrt/heap/heap_handle.cpp @@ -12,7 +12,7 @@ // The CRT heap handle. This global variable is modified only during CRT // startup and CRT shutdown. -extern "C" HANDLE __acrt_heap = nullptr; +extern "C" { HANDLE __acrt_heap = nullptr; } diff --git a/sdk/lib/ucrt/inc/corecrt_internal_stdio.h b/sdk/lib/ucrt/inc/corecrt_internal_stdio.h index 0a8ab478893..5a493e7acbe 100644 --- a/sdk/lib/ucrt/inc/corecrt_internal_stdio.h +++ b/sdk/lib/ucrt/inc/corecrt_internal_stdio.h @@ -307,13 +307,13 @@ auto __acrt_lock_stream_and_call(FILE* const stream, Action&& action) throw() * the number of stdio-level files which may be open simultaneously. This * is normally set to _NSTREAM_ by the stdio initialization code. */ -extern "C" extern int _nstream; +extern "C" int _nstream; /* * Pointer to the array of pointers to FILE structures that are used * to manage stdio-level files. */ -extern "C" extern __crt_stdio_stream_data** __piob; +extern "C" __crt_stdio_stream_data** __piob; // __acrt_stdio_is_initialized cannot be with the rest of // stdio initialization logic since referencing those symbols diff --git a/sdk/lib/ucrt/locale/ctype.cpp b/sdk/lib/ucrt/locale/ctype.cpp index 12d546214eb..023c711415f 100644 --- a/sdk/lib/ucrt/locale/ctype.cpp +++ b/sdk/lib/ucrt/locale/ctype.cpp @@ -35,7 +35,7 @@ extern "C" unsigned short const* __cdecl __pctype_func() // implement this lookup table for consistency with GetStringTypeW, rather than // try to implement something completely different. We expect this is sufficient, // as C character classification does not map well to Unicode. -extern "C" extern unsigned short const _wctype[] +extern "C" unsigned short const _wctype[] { 0, // -1 EOF _CONTROL , // 00 (NUL) @@ -133,7 +133,7 @@ extern "C" extern unsigned short const _wctype[] _UPPER | C1_ALPHA , // 59 Y _UPPER | C1_ALPHA , // 5A Z _PUNCT , // 5B [ - _PUNCT , // 5C \ + _PUNCT , // 5C '\' _PUNCT , // 5D ] _PUNCT , // 5E ^ _PUNCT , // 5F _ @@ -300,7 +300,7 @@ extern "C" extern unsigned short const _wctype[] _UPPER | C1_ALPHA , //100 (LATIN CAPITAL LETTER A WITH MACRON) }; -extern "C" extern unsigned short const __newctype[384] +extern "C" unsigned short const __newctype[384] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -443,7 +443,7 @@ extern "C" extern unsigned short const __newctype[384] // and the rest are 0... }; -extern "C" extern unsigned char const __newclmap[384] +extern "C" unsigned char const __newclmap[384] { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, @@ -545,7 +545,7 @@ extern "C" extern unsigned char const __newclmap[384] 0x79, // 59 Y 0x7A, // 5A Z 0x5B, // 5B [ - 0x5C, // 5C \ + 0x5C, // 5C '\' 0x5D, // 5D ] 0x5E, // 5E ^ 0x5F, // 5F _ @@ -591,7 +591,7 @@ extern "C" extern unsigned char const __newclmap[384] 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; -extern "C" extern unsigned char const __newcumap[384] +extern "C" unsigned char const __newcumap[384] { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, @@ -693,7 +693,7 @@ extern "C" extern unsigned char const __newcumap[384] 0x59, // 59 Y 0x5A, // 5A Z 0x5B, // 5B [ - 0x5C, // 5C \ + 0x5C, // 5C '\' 0x5D, // 5D ] 0x5E, // 5E ^ 0x5F, // 5F _ @@ -741,5 +741,5 @@ extern "C" extern unsigned char const __newcumap[384] -extern "C" unsigned short const* _pctype {__newctype + 128}; // Pointer to table for char's -extern "C" unsigned short const* _pwctype{_wctype + 1 }; // Pointer to table for wchar_t's +extern "C" { unsigned short const* _pctype {__newctype + 128}; } // Pointer to table for char's +extern "C" { unsigned short const* _pwctype{_wctype + 1 }; } // Pointer to table for wchar_t's diff --git a/sdk/lib/ucrt/locale/glstatus.cpp b/sdk/lib/ucrt/locale/glstatus.cpp index 4f24c0f2fa8..0cf74dc108c 100644 --- a/sdk/lib/ucrt/locale/glstatus.cpp +++ b/sdk/lib/ucrt/locale/glstatus.cpp @@ -10,4 +10,4 @@ #include -extern "C" int __globallocalestatus = (~_GLOBAL_LOCALE_BIT); +extern "C" { int __globallocalestatus = (~_GLOBAL_LOCALE_BIT); } diff --git a/sdk/lib/ucrt/locale/localeconv.cpp b/sdk/lib/ucrt/locale/localeconv.cpp index c5a48bfb199..6aa6242f971 100644 --- a/sdk/lib/ucrt/locale/localeconv.cpp +++ b/sdk/lib/ucrt/locale/localeconv.cpp @@ -14,13 +14,13 @@ /* pointer to original static to avoid freeing */ -extern "C" char __acrt_lconv_static_decimal []{"."}; -extern "C" char __acrt_lconv_static_null []{""}; -extern "C" wchar_t __acrt_lconv_static_W_decimal[]{L"."}; -extern "C" wchar_t __acrt_lconv_static_W_null []{L""}; +extern "C" { char __acrt_lconv_static_decimal []{"."}; } +extern "C" { char __acrt_lconv_static_null []{""}; } +extern "C" { wchar_t __acrt_lconv_static_W_decimal[]{L"."}; } +extern "C" { wchar_t __acrt_lconv_static_W_null []{L""}; } /* lconv settings for "C" locale */ -extern "C" struct lconv __acrt_lconv_c +extern "C" { struct lconv __acrt_lconv_c { __acrt_lconv_static_decimal, // decimal_point __acrt_lconv_static_null, // thousands_sep @@ -48,12 +48,12 @@ extern "C" struct lconv __acrt_lconv_c __acrt_lconv_static_W_null, // _W_mon_thousands_sep __acrt_lconv_static_W_null, // _W_positive_sign __acrt_lconv_static_W_null, // _W_negative_sign -}; +}; } /* pointer to current lconv structure */ -extern "C" struct lconv* __acrt_lconv{&__acrt_lconv_c}; +extern "C" { struct lconv* __acrt_lconv{&__acrt_lconv_c}; } /*** *struct lconv *localeconv(void) - Return the numeric formatting convention diff --git a/sdk/lib/ucrt/locale/nlsdata.cpp b/sdk/lib/ucrt/locale/nlsdata.cpp index bdd4995463c..7783896cb43 100644 --- a/sdk/lib/ucrt/locale/nlsdata.cpp +++ b/sdk/lib/ucrt/locale/nlsdata.cpp @@ -10,7 +10,7 @@ -extern "C" int __mb_cur_max{1}; +extern "C" { int __mb_cur_max{1}; } @@ -25,11 +25,11 @@ extern "C" int* __cdecl __p___mb_cur_max() -extern "C" wchar_t __acrt_wide_c_locale_string[]{L"C"}; +extern "C" { wchar_t __acrt_wide_c_locale_string[]{L"C"}; } -extern "C" __crt_lc_time_data const __lc_time_c +extern "C" { __crt_lc_time_data const __lc_time_c { { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }, @@ -82,13 +82,13 @@ extern "C" __crt_lc_time_data const __lc_time_c L"dddd, MMMM dd, yyyy", L"HH:mm:ss", L"en-US" -}; +}; } // The initial locale information structure, containing the C locale data. It // is used until the first call to setlocale(). -extern "C" __crt_locale_data __acrt_initial_locale_data +extern "C" { __crt_locale_data __acrt_initial_locale_data { { __newctype + 128, // _locale_pctype @@ -124,7 +124,7 @@ extern "C" __crt_locale_data __acrt_initial_locale_data nullptr, // locale_name[LC_NUMERIC] nullptr // locale_name[LC_TIME] } -}; +}; } @@ -133,8 +133,8 @@ __crt_state_management::dual_state_global<__crt_locale_data*> __acrt_current_loc -extern "C" __crt_locale_pointers __acrt_initial_locale_pointers +extern "C" { __crt_locale_pointers __acrt_initial_locale_pointers { &__acrt_initial_locale_data, &__acrt_initial_multibyte_data -}; +}; } diff --git a/sdk/lib/ucrt/lowio/ioinit.cpp b/sdk/lib/ucrt/lowio/ioinit.cpp index 4fc83a2d929..5a3e858607c 100644 --- a/sdk/lib/ucrt/lowio/ioinit.cpp +++ b/sdk/lib/ucrt/lowio/ioinit.cpp @@ -14,7 +14,7 @@ // This is a special static lowio file object referenced only by the safe access // functionality in the internal headers. It is used in certain stdio-level // functions to more gracefully handle a FILE with -1 as its lowio file id. -extern "C" __crt_lowio_handle_data __badioinfo = +extern "C" { __crt_lowio_handle_data __badioinfo = { { }, // lock static_cast(-1), // osfhnd @@ -22,7 +22,7 @@ extern "C" __crt_lowio_handle_data __badioinfo = FTEXT, // osfile __crt_lowio_text_mode::ansi, // textmode { LF, LF, LF }, // _pipe_lookahead -}; +}; } @@ -31,12 +31,12 @@ extern "C" __crt_lowio_handle_data __badioinfo = // are necessarily in use at any given time. // // This number is in the range of [IOINFO_ARRAY_ELTS, _NHANDLE_] -extern "C" int _nhandle = 0; +extern "C" { int _nhandle = 0; } // This is the global array of file object arrays: -extern "C" __crt_lowio_handle_data* __pioinfo[IOINFO_ARRAYS] = { 0 }; +extern "C" { __crt_lowio_handle_data* __pioinfo[IOINFO_ARRAYS] = { 0 }; } diff --git a/sdk/lib/ucrt/lowio/read.cpp b/sdk/lib/ucrt/lowio/read.cpp index 17580ec8af1..ee5a3cf2256 100644 --- a/sdk/lib/ucrt/lowio/read.cpp +++ b/sdk/lib/ucrt/lowio/read.cpp @@ -17,7 +17,7 @@ // 0 for everything else, including invalid patterns. // We return 0 for invalid patterns because we rely on MultiByteToWideChar to // do the validations. -extern "C" char _lookuptrailbytes[256] = +extern "C" { char _lookuptrailbytes[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -32,7 +32,7 @@ extern "C" char _lookuptrailbytes[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0 -}; +}; } static void store_lookahead(int const fh, char const c) throw() diff --git a/sdk/lib/ucrt/lowio/umask.cpp b/sdk/lib/ucrt/lowio/umask.cpp index ffd770dc7b3..ad0de502ccc 100644 --- a/sdk/lib/ucrt/lowio/umask.cpp +++ b/sdk/lib/ucrt/lowio/umask.cpp @@ -12,7 +12,7 @@ #include #include -extern "C" int _umaskval = 0; +extern "C" { int _umaskval = 0; } /*** *errno_t _umask(mode, poldmode) - set the file mode mask diff --git a/sdk/lib/ucrt/misc/dbgrpt.cpp b/sdk/lib/ucrt/misc/dbgrpt.cpp index 76ac26fbec3..12c7e444072 100644 --- a/sdk/lib/ucrt/misc/dbgrpt.cpp +++ b/sdk/lib/ucrt/misc/dbgrpt.cpp @@ -27,9 +27,9 @@ * --------------------------------------------------------------------------*/ -extern "C" extern _CRT_REPORT_HOOK _pfnReportHook; -extern "C" extern __crt_report_hook_node* _pReportHookList; -extern "C" extern __crt_report_hook_node* _pReportHookListW; +extern "C" _CRT_REPORT_HOOK _pfnReportHook; +extern "C" __crt_report_hook_node* _pReportHookList; +extern "C" __crt_report_hook_node* _pReportHookListW; static __crt_report_hook_node*& __cdecl get_report_hook_list(char) throw() { return _pReportHookList; } static __crt_report_hook_node*& __cdecl get_report_hook_list(wchar_t) throw() { return _pReportHookListW; } diff --git a/sdk/lib/ucrt/misc/exception_filter.cpp b/sdk/lib/ucrt/misc/exception_filter.cpp index 87d863ed590..221e29605cb 100644 --- a/sdk/lib/ucrt/misc/exception_filter.cpp +++ b/sdk/lib/ucrt/misc/exception_filter.cpp @@ -17,7 +17,7 @@ // signal (e.g. SIGFPE) must be grouped together. If any _action field is // changed in this table, that field must be initialized with an encoded // function pointer during CRT startup. -extern "C" extern struct __crt_signal_action_t const __acrt_exception_action_table[] = +extern "C" struct __crt_signal_action_t const __acrt_exception_action_table[] = { // _exception_number _signal_number _action // -------------------------------------------------------- @@ -38,16 +38,16 @@ extern "C" extern struct __crt_signal_action_t const __acrt_exception_action_tab // WARNING!!! This constant must be the integer value for which // __acrt_exception_action_table[__acrt_signal_action_first_fpe_index] is the very FIRST entry in the table // corresponding to a floating point exception. -extern "C" extern size_t const __acrt_signal_action_first_fpe_index = 3; +extern "C" { size_t const __acrt_signal_action_first_fpe_index = 3; } // There are __acrt_signal_action_fpe_count entries in XcptActTab for floating point exceptions: -extern "C" extern size_t const __acrt_signal_action_fpe_count = 9; +extern "C" { size_t const __acrt_signal_action_fpe_count = 9; } // Size of the exception-action table in bytes -extern "C" extern size_t const __acrt_signal_action_table_size = sizeof(__acrt_exception_action_table); +extern "C" { size_t const __acrt_signal_action_table_size = sizeof(__acrt_exception_action_table); } // Number of entries in the exception-action table -extern "C" extern size_t const __acrt_signal_action_table_count = sizeof(__acrt_exception_action_table) / sizeof(__acrt_exception_action_table[0]); +extern "C" { size_t const __acrt_signal_action_table_count = sizeof(__acrt_exception_action_table) / sizeof(__acrt_exception_action_table[0]); } @@ -218,5 +218,5 @@ extern "C" int __cdecl _seh_filter_exe( // Restore the stored value of _pxcptinfoptrs: ptd->_tpxcptinfoptrs = old_pxcptinfoptrs; - return EXCEPTION_CONTINUE_EXECUTION; + return EXCEPTION_CONTINUE_EXECUTION; } diff --git a/sdk/lib/ucrt/startup/abort.cpp b/sdk/lib/ucrt/startup/abort.cpp index fb4ba55df38..781588df33a 100644 --- a/sdk/lib/ucrt/startup/abort.cpp +++ b/sdk/lib/ucrt/startup/abort.cpp @@ -18,7 +18,7 @@ #define _INIT_ABORT_BEHAVIOR _CALL_REPORTFAULT #endif -extern "C" unsigned int __abort_behavior = _INIT_ABORT_BEHAVIOR; +extern "C" { unsigned int __abort_behavior = _INIT_ABORT_BEHAVIOR; } /*** *void abort() - abort the current program by raising SIGABRT diff --git a/sdk/lib/ucrt/startup/exit.cpp b/sdk/lib/ucrt/startup/exit.cpp index 55ed89be74b..e46e0395d01 100644 --- a/sdk/lib/ucrt/startup/exit.cpp +++ b/sdk/lib/ucrt/startup/exit.cpp @@ -11,8 +11,8 @@ static long c_termination_complete = FALSE; -extern "C" extern _onexit_table_t __acrt_atexit_table; -extern "C" extern _onexit_table_t __acrt_at_quick_exit_table; +extern "C" _onexit_table_t __acrt_atexit_table; +extern "C" _onexit_table_t __acrt_at_quick_exit_table; // thread_local atexit dtor handling. The APPCRT exports a function to set the // callback function. The exe main function will call this to set the callback diff --git a/sdk/lib/ucrt/startup/onexit.cpp b/sdk/lib/ucrt/startup/onexit.cpp index d7d77a40841..1fc7e15e64f 100644 --- a/sdk/lib/ucrt/startup/onexit.cpp +++ b/sdk/lib/ucrt/startup/onexit.cpp @@ -22,8 +22,8 @@ // The global atexit and at_quick_exit registries -extern "C" _onexit_table_t __acrt_atexit_table{}; -extern "C" _onexit_table_t __acrt_at_quick_exit_table{}; +extern "C" { _onexit_table_t __acrt_atexit_table{}; } +extern "C" { _onexit_table_t __acrt_at_quick_exit_table{}; } diff --git a/sdk/lib/ucrt/stdio/_file.cpp b/sdk/lib/ucrt/stdio/_file.cpp index 153ccf57b1c..d564e6969b3 100644 --- a/sdk/lib/ucrt/stdio/_file.cpp +++ b/sdk/lib/ucrt/stdio/_file.cpp @@ -11,13 +11,13 @@ // FILE descriptors for stdin, stdout, and stderr -extern "C" __crt_stdio_stream_data _iob[_IOB_ENTRIES] = +extern "C" { __crt_stdio_stream_data _iob[_IOB_ENTRIES] = { // ptr _base, _cnt, _flag, _file, _charbuf, _bufsiz { nullptr, nullptr, 0, _IOALLOCATED | _IOREAD, 0, 0, 0}, // stdin { nullptr, nullptr, 0, _IOALLOCATED | _IOWRITE, 1, 0, 0}, // stdout { nullptr, nullptr, 0, _IOALLOCATED | _IOWRITE, 2, 0, 0}, // stderr -}; +}; } extern "C" FILE* __cdecl __acrt_iob_func(unsigned const id) { @@ -50,7 +50,7 @@ _CRT_LINKER_FORCE_INCLUDE(__acrt_stdio_terminator); // This variable is used by the statically linked CRT to ensure that if any // stdio functionality is used, the terminate_stdio() function will be // registered for call during CRT termination. - extern "C" int _cflush = 0; + extern "C" { int _cflush = 0; } #endif diff --git a/sdk/lib/ucrt/stdio/_sftbuf.cpp b/sdk/lib/ucrt/stdio/_sftbuf.cpp index dbbb61bd642..b2601a8e1f2 100644 --- a/sdk/lib/ucrt/stdio/_sftbuf.cpp +++ b/sdk/lib/ucrt/stdio/_sftbuf.cpp @@ -23,8 +23,8 @@ // Buffer pointers for stdout and stderr -extern "C" void* __acrt_stdout_buffer = nullptr; -extern "C" void* __acrt_stderr_buffer = nullptr; +extern "C" { void* __acrt_stdout_buffer = nullptr; } +extern "C" { void* __acrt_stderr_buffer = nullptr; } // The temporary buffer has the data of one stdio call. Stderr and Stdout use a // temporary buffer for the duration of stdio output calls instead of having a diff --git a/sdk/lib/ucrt/stdio/ncommode.cpp b/sdk/lib/ucrt/stdio/ncommode.cpp index ddf270008b7..9d8923d4779 100644 --- a/sdk/lib/ucrt/stdio/ncommode.cpp +++ b/sdk/lib/ucrt/stdio/ncommode.cpp @@ -10,7 +10,7 @@ // Set default file commit mode to nocommit -extern "C" int _commode = 0; +extern "C" { int _commode = 0; } diff --git a/sdk/lib/ucrt/stdio/rmtmp.cpp b/sdk/lib/ucrt/stdio/rmtmp.cpp index 0d120e21eed..8a3a2229bbd 100644 --- a/sdk/lib/ucrt/stdio/rmtmp.cpp +++ b/sdk/lib/ucrt/stdio/rmtmp.cpp @@ -17,11 +17,11 @@ _CRT_LINKER_FORCE_INCLUDE(__acrt_tmpfile_terminator); // These definitions will cause this object to be linked in whenever the // termination code requires it. #ifndef CRTDLL - extern "C" unsigned __acrt_tmpfile_used = 1; + extern "C" { unsigned __acrt_tmpfile_used = 1; } #endif -extern "C" unsigned _tempoff = 1; -extern "C" unsigned _old_pfxlen = 0; +extern "C" { unsigned _tempoff = 1; } +extern "C" { unsigned _old_pfxlen = 0; } diff --git a/sdk/lib/ucrt/stdio/tmpfile.cpp b/sdk/lib/ucrt/stdio/tmpfile.cpp index ecd8d2e471a..a58a8e48bfe 100644 --- a/sdk/lib/ucrt/stdio/tmpfile.cpp +++ b/sdk/lib/ucrt/stdio/tmpfile.cpp @@ -499,7 +499,7 @@ extern "C" errno_t __cdecl tmpfile_s(FILE** const stream) // Ensure that _rmtmp is called during static CRT termination: #ifndef CRTDLL - extern "C" extern unsigned __acrt_tmpfile_used; + extern "C" unsigned __acrt_tmpfile_used; extern "C" void __acrt_force_use_of_tmpfile() {