diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-08-16 21:01:59 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-08-16 21:01:59 +0100 |
| commit | 9e61e3beee6ca5ae48db68fd03ed0c73604e7279 (patch) | |
| tree | 937d3130c4a68e2b36a3af5380b7d19f2e54aafd /src/main.cpp | |
| parent | e8530ca883edd79c188443ced54cea2c5d3ad4ed (diff) | |
field = value, for structure literals
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1eb4b92b8..c7f7ce764 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,7 @@ #include "checker/checker.cpp" #include "codegen/codegen.cpp" -void win32_exec_command_line_app(char *fmt, ...) { +i32 win32_exec_command_line_app(char *fmt, ...) { STARTUPINFOA start_info = {gb_size_of(STARTUPINFOA)}; PROCESS_INFORMATION pi = {}; start_info.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; @@ -25,12 +25,19 @@ void win32_exec_command_line_app(char *fmt, ...) { NULL, NULL, true, 0, NULL, NULL, &start_info, &pi)) { WaitForSingleObject(pi.hProcess, INFINITE); + + DWORD exit_code = 0; + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + + return cast(i32)exit_code; } else { // NOTE(bill): failed to create process } + return 0; } int main(int argc, char **argv) { @@ -71,21 +78,20 @@ int main(int argc, char **argv) { char const *output_name = ssa.output_file.filename; isize base_name_len = gb_path_extension(output_name)-1 - output_name; - win32_exec_command_line_app( + i32 exit_code = win32_exec_command_line_app( "opt -mem2reg %s -o %.*s.bc", output_name, cast(int)base_name_len, output_name); - win32_exec_command_line_app( - "clang %.*s.bc -o %.*s.exe -Wno-override-module " - "-lkernel32.lib -luser32.lib -lgdi32.lib -lopengl32.lib", - cast(int)base_name_len, output_name, - cast(int)base_name_len, output_name); - - - if (run_output) { - win32_exec_command_line_app("%.*s.exe", cast(int)base_name_len, output_name); + if (exit_code == 0) { + win32_exec_command_line_app( + "clang %.*s.bc -o %.*s.exe -Wno-override-module " + "-lkernel32.lib -luser32.lib -lgdi32.lib -lopengl32.lib", + cast(int)base_name_len, output_name, + cast(int)base_name_len, output_name); + if (run_output) { + win32_exec_command_line_app("%.*s.exe", cast(int)base_name_len, output_name); + } } - return 0; } } |