Skip to content

Commit 3d58df3

Browse files
committed
Pick up WinMain with proper CC
1 parent ad77e93 commit 3d58df3

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/analyze.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,8 +3358,25 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
33583358
}
33593359

33603360
if (fn_proto->is_export) {
3361-
bool ccc = (fn_proto->cc == CallingConventionUnspecified || fn_proto->cc == CallingConventionC);
3362-
add_fn_export(g, fn_table_entry, buf_ptr(&fn_table_entry->symbol_name), GlobalLinkageIdStrong, ccc);
3361+
bool ccc = false;
3362+
3363+
switch (fn_proto->cc) {
3364+
case CallingConventionC:
3365+
case CallingConventionCold:
3366+
case CallingConventionNaked:
3367+
case CallingConventionStdcall:
3368+
// Unspecified means no convention is explicitly given, we
3369+
// default to C
3370+
case CallingConventionUnspecified:
3371+
ccc = true;
3372+
break;
3373+
case CallingConventionAsync:
3374+
ccc = false;
3375+
break;
3376+
}
3377+
3378+
add_fn_export(g, fn_table_entry, buf_ptr(&fn_table_entry->symbol_name),
3379+
GlobalLinkageIdStrong, ccc);
33633380
}
33643381

33653382
if (!is_extern) {

0 commit comments

Comments
 (0)