Skip to content

Commit c08773f

Browse files
committed
Base: correct TLS handling on Windows x86
The FLS destructors are required to be `__stdcall` calling convention rather than `__cdecl`. Correct the definitions for them to repair the build on Windows x86 after a newer compiler identified this issue. This attribute is ignored on non-x86 architectures and thus is safe to apply unconditionally.
1 parent a1c25ff commit c08773f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ typedef struct __CFTSDTable {
731731
tsdDestructor destructors[CF_TSD_MAX_SLOTS];
732732
} __CFTSDTable;
733733

734+
#if TARGET_OS_WIN32
735+
__stdcall
736+
#endif
734737
static void __CFTSDFinalize(void *arg);
735738

736739
#if TARGET_OS_WIN32
@@ -792,6 +795,9 @@ static void *__CFTSDGetSpecific() {
792795

793796
_Atomic(bool) __CFMainThreadHasExited = false;
794797

798+
#if TARGET_OS_WIN32
799+
__stdcall
800+
#endif
795801
static void __CFTSDFinalize(void *arg) {
796802
#if TARGET_OS_WASI
797803
__CFMainThreadHasExited = true;
@@ -1574,6 +1580,9 @@ typedef struct _CFThreadSpecificData {
15741580
} _CFThreadSpecificData;
15751581
#endif
15761582

1583+
#if TARGET_OS_WIN32
1584+
__stdcall
1585+
#endif
15771586
static void _CFThreadSpecificDestructor(void *ctx) {
15781587
#if TARGET_OS_WIN32
15791588
_CFThreadSpecificData *data = (_CFThreadSpecificData *)ctx;

0 commit comments

Comments
 (0)