Reactos

[UCRT] Fix GCC/Clang build of enum_system_locales_ex_nolock

Add static function for Clang.
Add missing __stdcall in a lambda for GCC.
MSVC does this automagically. See https://devblogs.microsoft.com/oldnewthing/20150220-00/?p=44623.

+20 -2
+20 -2
sdk/lib/ucrt/internal/winapi_thunks.cpp
··· 438 438 return CompareStringW(__acrt_LocaleNameToLCID(locale_name, 0), flags, string1, string1_count, string2, string2_count); 439 439 } 440 440 441 + #ifdef __clang__ 442 + static LOCALE_ENUMPROCEX static_enum_proc; 443 + static BOOL CALLBACK LocaleEnumProcW(LPWSTR locale_string) 444 + { 445 + return __crt_fast_decode_pointer(static_enum_proc)(locale_string, 0, 0); 446 + } 447 + #endif 448 + 441 449 // This has been split into its own function to work around a bug in the Dev12 442 450 // C++ compiler where nested captureless lambdas are not convertible to the 443 451 // required function pointer type. ··· 445 453 LOCALE_ENUMPROCEX const enum_proc 446 454 ) throw() 447 455 { 456 + #ifndef __clang__ 448 457 static LOCALE_ENUMPROCEX static_enum_proc; 458 + #endif 449 459 450 460 static_enum_proc = __crt_fast_encode_pointer(enum_proc); 451 - BOOL const result = EnumSystemLocalesW( 452 - [](LPWSTR locale_string) { return __crt_fast_decode_pointer(static_enum_proc)(locale_string, 0, 0); }, 461 + BOOL const result = EnumSystemLocalesW((LOCALE_ENUMPROCW) 462 + #ifdef __clang__ 463 + LocaleEnumProcW, 464 + #else 465 + [](LPWSTR locale_string) 466 + #if defined(__GNUC__) && !defined(__clang__) 467 + __stdcall 468 + #endif // __GNUC__ 469 + { return __crt_fast_decode_pointer(static_enum_proc)(locale_string, 0, 0); }, 470 + #endif 453 471 LCID_INSTALLED); 454 472 static_enum_proc = __crt_fast_encode_pointer(nullptr); 455 473