set subsystem to null if not on windows or uefi

This commit is contained in:
emekoi 2019-05-10 09:57:02 -05:00 committed by Andrew Kelley
parent 6bc5b07e3e
commit b461e600e2
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -7919,13 +7919,13 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
"EfiRuntimeDriver",
};
if (g->subsystem == TargetSubsystemAuto) {
if (g->zig_target->os != OsWindows || g->zig_target->os != OsUefi || g->have_dllmain_crt_startup || g->out_type == OutTypeLib) {
buf_appendf(contents, "pub const subsystem = null;\n");
} else if (g->subsystem == TargetSubsystemAuto) {
if (g->have_c_main || g->have_pub_main) {
buf_appendf(contents, "pub const subsystem = SubSystem.%s;\n", subsystem_strings[TargetSubsystemConsole - 1]);
} else if (g->have_winmain || g->have_winmain_crt_startup) {
buf_appendf(contents, "pub const subsystem = SubSystem.%s;\n", subsystem_strings[TargetSubsystemWindows - 1]);
} else if (g->have_dllmain_crt_startup || g->out_type == OutTypeLib) {
buf_appendf(contents, "pub const subsystem = null;\n");
}
} else {
buf_appendf(contents, "pub const subsystem = SubSystem.%s;\n", subsystem_strings[g->subsystem - 1]);