From 0373016da3dba954dfc07d5690100e01306d1224 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 17 Mar 2017 00:48:27 -0400 Subject: [PATCH] fixing things up for MSVC 2017 build --- build.bat | 2 +- meta/build.cpp | 36 +++++++++++++++++------------------- meta/meta_parser.cpp | 22 +++++++++++----------- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/build.bat b/build.bat index 386d1699..826c7e09 100644 --- a/build.bat +++ b/build.bat @@ -11,7 +11,7 @@ SET BUILD_MODE=%1 if "%BUILD_MODE%" == "" (SET BUILD_MODE="/DDEV_BUILD") pushd ..\build -cl %OPTS% ..\code\meta\build.cpp /Zi /Febuild %BUILD_MODE% +cl %OPTS% kernel32.lib ..\code\meta\build.cpp /Zi /Febuild %BUILD_MODE% if %ERRORLEVEL% neq 0 (set FirstError=1) if %ERRORLEVEL% neq 0 (goto END) popd diff --git a/meta/build.cpp b/meta/build.cpp index b2923460..36d4a98a 100644 --- a/meta/build.cpp +++ b/meta/build.cpp @@ -22,7 +22,7 @@ #define IS_64BIT #define BEGIN_TIME_SECTION() uint64_t start = get_time() -#define END_TIME_SECTION(n) uint64_t total = get_time() - start; printf("%-20s: %.2lu.%.6lu\n", (n), total/1000000, total%1000000); +#define END_TIME_SECTION(n) uint64_t total = get_time() - start; printf("%-20s: %.2llu.%.6llu\n", (n), total/1000000, total%1000000); // // 4coder specific @@ -230,7 +230,7 @@ build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_ swap_ptr(&line_prefix.build_options, &line_prefix.build_options_prev); Temp_Dir temp = pushdir(out_path); - systemf("%scl %s %s\\%s /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, code_path, code_file, out_file, link_line.build_options); + systemf("%scl %s \"%s\\%s\" /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, code_path, code_file, out_file, link_line.build_options); popdir(temp); } @@ -468,7 +468,7 @@ build_main(char *cdir, u32 flags){ { DECL_STR(file, "4ed_app_target.cpp"); BEGIN_TIME_SECTION(); - build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, file, dir, "4ed_app"DLL, "/EXPORT:app_get_functions"); + build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, file, dir, "4ed_app" DLL, "/EXPORT:app_get_functions"); END_TIME_SECTION("build 4ed_app"); } @@ -624,8 +624,8 @@ package(char *cdir){ clear_folder(par_dir); make_folder_if_missing(dir, "3rdparty"); make_folder_if_missing(pack_dir, zip_dir); - copy_file(build_dir, "4ed"EXE, dir, 0, 0); - copy_file(build_dir, "4ed_app"DLL, dir, 0, 0); + copy_file(build_dir, "4ed" EXE, dir, 0, 0); + copy_file(build_dir, "4ed_app" DLL, dir, 0, 0); copy_all (pack_data_dir, "*", dir); copy_file(0, "README.txt", dir, 0, 0); copy_file(0, "TODO.txt", dir, 0, 0); @@ -692,11 +692,9 @@ package(char *cdir){ make_folder_if_missing(dir, "3rdparty"); make_folder_if_missing(pack_dir, zip_dir); - copy_file(build_dir, "4ed"EXE, dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed"PDB, dir, 0, 0)); - copy_file(build_dir, "4ed_app"DLL, dir, 0, 0); - //ONLY_WINDOWS(copy_file(build_dir, "4ed_app"PDB, dir, 0, 0)); - copy_file(build_dir, "custom_4coder"DLL, dir, 0, 0); + copy_file(build_dir, "4ed" EXE, dir, 0, 0); + copy_file(build_dir, "4ed_app" DLL, dir, 0, 0); + copy_file(build_dir, "custom_4coder" DLL, dir, 0, 0); copy_all (pack_data_dir, "*", dir); copy_file(0, "README.txt", dir, 0, 0); @@ -705,7 +703,7 @@ package(char *cdir){ copy_all(0, "4coder_*", dir); - copy_file(0, "buildsuper"BAT, dir, 0, 0); + copy_file(0, "buildsuper" BAT, dir, 0, 0); DECL_STR(custom_dir, "4coder_API"); DECL_STR(custom_helper_dir, "4coder_helper"); @@ -720,18 +718,18 @@ package(char *cdir){ }; i32 dir_count = ArrayCount(dir_array); - for (i32 i = 0; i < dir_count; ++i){ - char *d = dir_array[i]; + for (i32 j = 0; j < dir_count; ++j){ + char *d = dir_array[j]; make_folder_if_missing(dir, d); char space[256]; - String str = make_fixed_width_string(space); - append_sc(&str, dir); - append_s_char(&str, platform_correct_slash); - append_sc(&str, d); - terminate_with_null(&str); + String copy_name = make_fixed_width_string(space); + append_sc(©_name, dir); + append_s_char(©_name, platform_correct_slash); + append_sc(©_name, d); + terminate_with_null(©_name); - copy_all(d, "*", str.str); + copy_all(d, "*", copy_name.str); } get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip"); diff --git a/meta/meta_parser.cpp b/meta/meta_parser.cpp index 70d70e26..ea56e336 100644 --- a/meta/meta_parser.cpp +++ b/meta/meta_parser.cpp @@ -284,7 +284,7 @@ typedef enum Doc_Note_Type{ } Doc_Note_Type; static String -doc_note_string[] = { +defined_doc_notes[] = { make_lit_string("DOC_PARAM"), make_lit_string("DOC_RETURN"), make_lit_string("DOC"), @@ -446,7 +446,7 @@ perform_doc_parse(Partition *part, String doc_string, Documentation *doc){ } else{ int32_t doc_note_type; - if (string_set_match(doc_note_string, ArrayCount(doc_note_string), doc_note, &doc_note_type)){ + if (string_set_match(defined_doc_notes, ArrayCount(defined_doc_notes), doc_note, &doc_note_type)){ doc_parse_note_string(doc_string, &pos); @@ -480,7 +480,7 @@ perform_doc_parse(Partition *part, String doc_string, Documentation *doc){ } else{ int32_t doc_note_type; - if (string_set_match(doc_note_string, ArrayCount(doc_note_string), doc_note, &doc_note_type)){ + if (string_set_match(defined_doc_notes, ArrayCount(defined_doc_notes), doc_note, &doc_note_type)){ String doc_note_string = doc_parse_note_string(doc_string, &pos); @@ -760,10 +760,10 @@ static int32_t enum_parse(Partition *part, Parse_Context *context, Item_Node *item){ int32_t result = false; - String doc_string = {0}; - get_doc_string_from_prev(context, &doc_string); + String parent_doc_string = {0}; + get_doc_string_from_prev(context, &parent_doc_string); - Cpp_Token *start_token = get_token(context); + Cpp_Token *parent_start_token = get_token(context); Cpp_Token *token = 0; for (; (token = get_token(context)) != 0; get_next_token(context)){ @@ -773,7 +773,7 @@ enum_parse(Partition *part, Parse_Context *context, Item_Node *item){ } if (token){ - String name = {0}; + String parent_name = {0}; Cpp_Token *token_j = 0; for (; (token_j = get_token(context)) != 0; get_prev_token(context)){ @@ -782,10 +782,10 @@ enum_parse(Partition *part, Parse_Context *context, Item_Node *item){ } } - name = get_lexeme(*token_j, context->data); + parent_name = get_lexeme(*token_j, context->data); set_token(context, token); - for (; (token = get_token(context)) > start_token; get_next_token(context)){ + for (; (token = get_token(context)) > parent_start_token; get_next_token(context)){ if (token->type == CPP_TOKEN_BRACE_OPEN){ break; } @@ -855,8 +855,8 @@ enum_parse(Partition *part, Parse_Context *context, Item_Node *item){ get_next_token(context); item->t = Item_Enum; - item->name = name; - item->doc_string = doc_string; + item->name = parent_name; + item->doc_string = parent_doc_string; item->first_child = first_member; result = true; }