authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-10-26 18:15:28-06:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-11-19 14:18:35+02:00
log51b362c350fa3b8d69f2f141a42e2efe11ea1ecc
tree06107e5c4e3d1c4d06adcf563efe97a1e5e7cba3
parentc002a5026ae5a04f9cf4344a3d62dfa8b664561a
signature Commit is signed but in an unrecognized format.

stage1: Check calling convention correctly for subsystem detection


1 files changed, 6 insertions(+), 2 deletions(-)

src/stage1/analyze.cpp+6-2
......@@ -1896,7 +1896,7 @@ static Error emit_error_unless_callconv_allowed_for_target(CodeGen *g, AstNode *
18961896 && g->zig_target->arch != ZigLLVM_avr
18971897 && g->zig_target->arch != ZigLLVM_msp430)
18981898 {
1899 allowed_platforms = "x86, x86_64, AVR, and MS430";
1899 allowed_platforms = "x86, x86_64, AVR, and MSP430";
19001900 }
19011901 break;
19021902 case CallingConventionSignal:
......@@ -3632,9 +3632,13 @@ void add_var_export(CodeGen *g, ZigVar *var, const char *symbol_name, GlobalLink
36323632}
36333633
36343634void add_fn_export(CodeGen *g, ZigFn *fn_table_entry, const char *symbol_name, GlobalLinkageId linkage, CallingConvention cc) {
3635 CallingConvention winapi_cc = g->zig_target->arch == ZigLLVM_x86
3636 ? CallingConventionStdcall
3637 : CallingConventionC;
3638
36353639 if (cc == CallingConventionC && strcmp(symbol_name, "main") == 0 && g->link_libc) {
36363640 g->stage1.have_c_main = true;
3637 } else if (cc == CallingConventionStdcall && g->zig_target->os == OsWindows) {
3641 } else if (cc == winapi_cc && g->zig_target->os == OsWindows) {
36383642 if (strcmp(symbol_name, "WinMain") == 0) {
36393643 g->stage1.have_winmain = true;
36403644 } else if (strcmp(symbol_name, "wWinMain") == 0) {