| author | |
| committer | |
| log | 5f28a9d23851d94edc2b24e549b7c5abbbf23f68 |
| tree | 35900fc47e346ef3161279f3c38bb91079596eca |
| parent | 6764a4522391d82c40fc54bae448b32366e3e6d8 |
10 files changed, 171 insertions(+), 112 deletions(-)
src/all_types.hpp+4-1| ... | @@ -1515,9 +1515,12 @@ struct CodeGen { | ... | @@ -1515,9 +1515,12 @@ struct CodeGen { |
| 1515 | size_t version_major; | 1515 | size_t version_major; |
| 1516 | size_t version_minor; | 1516 | size_t version_minor; |
| 1517 | size_t version_patch; | 1517 | size_t version_patch; |
| 1518 | bool verbose; | 1518 | bool verbose_tokenize; |
| 1519 | bool verbose_ast; | ||
| 1519 | bool verbose_link; | 1520 | bool verbose_link; |
| 1520 | bool verbose_ir; | 1521 | bool verbose_ir; |
| 1522 | bool verbose_llvm_ir; | ||
| 1523 | bool verbose_cimport; | ||
| 1521 | ErrColor err_color; | 1524 | ErrColor err_color; |
| 1522 | ImportTableEntry *root_import; | 1525 | ImportTableEntry *root_import; |
| 1523 | ImportTableEntry *bootstrap_import; | 1526 | ImportTableEntry *bootstrap_import; |
src/analyze.cpp+5-5| ... | @@ -2982,7 +2982,7 @@ void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_typ | ... | @@ -2982,7 +2982,7 @@ void analyze_fn_ir(CodeGen *g, FnTableEntry *fn_table_entry, AstNode *return_typ |
| 2982 | return; | 2982 | return; |
| 2983 | } | 2983 | } |
| 2984 | 2984 | ||
| 2985 | if (g->verbose) { | 2985 | if (g->verbose_ir) { |
| 2986 | fprintf(stderr, "{ // (analyzed)\n"); | 2986 | fprintf(stderr, "{ // (analyzed)\n"); |
| 2987 | ir_print(g, stderr, &fn_table_entry->analyzed_executable, 4); | 2987 | ir_print(g, stderr, &fn_table_entry->analyzed_executable, 4); |
| 2988 | fprintf(stderr, "}\n"); | 2988 | fprintf(stderr, "}\n"); |
| ... | @@ -3015,7 +3015,7 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) { | ... | @@ -3015,7 +3015,7 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 3015 | fn_table_entry->anal_state = FnAnalStateInvalid; | 3015 | fn_table_entry->anal_state = FnAnalStateInvalid; |
| 3016 | return; | 3016 | return; |
| 3017 | } | 3017 | } |
| 3018 | if (g->verbose) { | 3018 | if (g->verbose_ir) { |
| 3019 | fprintf(stderr, "\n"); | 3019 | fprintf(stderr, "\n"); |
| 3020 | ast_render(g, stderr, fn_table_entry->body_node, 4); | 3020 | ast_render(g, stderr, fn_table_entry->body_node, 4); |
| 3021 | fprintf(stderr, "\n{ // (IR)\n"); | 3021 | fprintf(stderr, "\n{ // (IR)\n"); |
| ... | @@ -3115,7 +3115,7 @@ void preview_use_decl(CodeGen *g, AstNode *node) { | ... | @@ -3115,7 +3115,7 @@ void preview_use_decl(CodeGen *g, AstNode *node) { |
| 3115 | } | 3115 | } |
| 3116 | 3116 | ||
| 3117 | ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code) { | 3117 | ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code) { |
| 3118 | if (g->verbose) { | 3118 | if (g->verbose_tokenize) { |
| 3119 | fprintf(stderr, "\nOriginal Source (%s):\n", buf_ptr(abs_full_path)); | 3119 | fprintf(stderr, "\nOriginal Source (%s):\n", buf_ptr(abs_full_path)); |
| 3120 | fprintf(stderr, "----------------\n"); | 3120 | fprintf(stderr, "----------------\n"); |
| 3121 | fprintf(stderr, "%s\n", buf_ptr(source_code)); | 3121 | fprintf(stderr, "%s\n", buf_ptr(source_code)); |
| ... | @@ -3135,7 +3135,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a | ... | @@ -3135,7 +3135,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a |
| 3135 | exit(1); | 3135 | exit(1); |
| 3136 | } | 3136 | } |
| 3137 | 3137 | ||
| 3138 | if (g->verbose) { | 3138 | if (g->verbose_tokenize) { |
| 3139 | print_tokens(source_code, tokenization.tokens); | 3139 | print_tokens(source_code, tokenization.tokens); |
| 3140 | 3140 | ||
| 3141 | fprintf(stderr, "\nAST:\n"); | 3141 | fprintf(stderr, "\nAST:\n"); |
| ... | @@ -3150,7 +3150,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a | ... | @@ -3150,7 +3150,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a |
| 3150 | 3150 | ||
| 3151 | import_entry->root = ast_parse(source_code, tokenization.tokens, import_entry, g->err_color); | 3151 | import_entry->root = ast_parse(source_code, tokenization.tokens, import_entry, g->err_color); |
| 3152 | assert(import_entry->root); | 3152 | assert(import_entry->root); |
| 3153 | if (g->verbose) { | 3153 | if (g->verbose_ast) { |
| 3154 | ast_print(stderr, import_entry->root, 0); | 3154 | ast_print(stderr, import_entry->root, 0); |
| 3155 | } | 3155 | } |
| 3156 | 3156 |
src/codegen.cpp+2-16| ... | @@ -196,10 +196,6 @@ void codegen_set_is_static(CodeGen *g, bool is_static) { | ... | @@ -196,10 +196,6 @@ void codegen_set_is_static(CodeGen *g, bool is_static) { |
| 196 | g->is_static = is_static; | 196 | g->is_static = is_static; |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | void codegen_set_verbose(CodeGen *g, bool verbose) { | ||
| 200 | g->verbose = verbose; | ||
| 201 | } | ||
| 202 | |||
| 203 | void codegen_set_each_lib_rpath(CodeGen *g, bool each_lib_rpath) { | 199 | void codegen_set_each_lib_rpath(CodeGen *g, bool each_lib_rpath) { |
| 204 | g->each_lib_rpath = each_lib_rpath; | 200 | g->each_lib_rpath = each_lib_rpath; |
| 205 | } | 201 | } |
| ... | @@ -4163,10 +4159,6 @@ static void validate_inline_fns(CodeGen *g) { | ... | @@ -4163,10 +4159,6 @@ static void validate_inline_fns(CodeGen *g) { |
| 4163 | } | 4159 | } |
| 4164 | 4160 | ||
| 4165 | static void do_code_gen(CodeGen *g) { | 4161 | static void do_code_gen(CodeGen *g) { |
| 4166 | if (g->verbose) { | ||
| 4167 | fprintf(stderr, "\nCode Generation:\n"); | ||
| 4168 | fprintf(stderr, "------------------\n"); | ||
| 4169 | } | ||
| 4170 | assert(!g->errors.length); | 4162 | assert(!g->errors.length); |
| 4171 | 4163 | ||
| 4172 | codegen_add_time_event(g, "Code Generation"); | 4164 | codegen_add_time_event(g, "Code Generation"); |
| ... | @@ -4443,7 +4435,8 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -4443,7 +4435,8 @@ static void do_code_gen(CodeGen *g) { |
| 4443 | 4435 | ||
| 4444 | ZigLLVMDIBuilderFinalize(g->dbuilder); | 4436 | ZigLLVMDIBuilderFinalize(g->dbuilder); |
| 4445 | 4437 | ||
| 4446 | if (g->verbose || g->verbose_ir) { | 4438 | if (g->verbose_llvm_ir) { |
| 4439 | fflush(stderr); | ||
| 4447 | LLVMDumpModule(g->module); | 4440 | LLVMDumpModule(g->module); |
| 4448 | } | 4441 | } |
| 4449 | 4442 | ||
| ... | @@ -5273,10 +5266,6 @@ static void gen_root_source(CodeGen *g) { | ... | @@ -5273,10 +5266,6 @@ static void gen_root_source(CodeGen *g) { |
| 5273 | resolve_top_level_decl(g, panic_tld, false, nullptr); | 5266 | resolve_top_level_decl(g, panic_tld, false, nullptr); |
| 5274 | } | 5267 | } |
| 5275 | 5268 | ||
| 5276 | if (g->verbose) { | ||
| 5277 | fprintf(stderr, "\nIR Generation and Semantic Analysis:\n"); | ||
| 5278 | fprintf(stderr, "--------------------------------------\n"); | ||
| 5279 | } | ||
| 5280 | if (!g->error_during_imports) { | 5269 | if (!g->error_during_imports) { |
| 5281 | semantic_analyze(g); | 5270 | semantic_analyze(g); |
| 5282 | } | 5271 | } |
| ... | @@ -5290,9 +5279,6 @@ static void gen_root_source(CodeGen *g) { | ... | @@ -5290,9 +5279,6 @@ static void gen_root_source(CodeGen *g) { |
| 5290 | } | 5279 | } |
| 5291 | 5280 | ||
| 5292 | report_errors_and_maybe_exit(g); | 5281 | report_errors_and_maybe_exit(g); |
| 5293 | if (g->verbose) { | ||
| 5294 | fprintf(stderr, "OK\n"); | ||
| 5295 | } | ||
| 5296 | 5282 | ||
| 5297 | } | 5283 | } |
| 5298 | 5284 |
src/codegen.hpp-1| ... | @@ -25,7 +25,6 @@ void codegen_set_each_lib_rpath(CodeGen *codegen, bool each_lib_rpath); | ... | @@ -25,7 +25,6 @@ void codegen_set_each_lib_rpath(CodeGen *codegen, bool each_lib_rpath); |
| 25 | 25 | ||
| 26 | void codegen_set_is_static(CodeGen *codegen, bool is_static); | 26 | void codegen_set_is_static(CodeGen *codegen, bool is_static); |
| 27 | void codegen_set_strip(CodeGen *codegen, bool strip); | 27 | void codegen_set_strip(CodeGen *codegen, bool strip); |
| 28 | void codegen_set_verbose(CodeGen *codegen, bool verbose); | ||
| 29 | void codegen_set_errmsg_color(CodeGen *codegen, ErrColor err_color); | 28 | void codegen_set_errmsg_color(CodeGen *codegen, ErrColor err_color); |
| 30 | void codegen_set_out_name(CodeGen *codegen, Buf *out_name); | 29 | void codegen_set_out_name(CodeGen *codegen, Buf *out_name); |
| 31 | void codegen_set_libc_lib_dir(CodeGen *codegen, Buf *libc_lib_dir); | 30 | void codegen_set_libc_lib_dir(CodeGen *codegen, Buf *libc_lib_dir); |
src/ir.cpp+3-3| ... | @@ -7849,7 +7849,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -7849,7 +7849,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 7849 | if (ir_executable.invalid) | 7849 | if (ir_executable.invalid) |
| 7850 | return codegen->invalid_instruction; | 7850 | return codegen->invalid_instruction; |
| 7851 | 7851 | ||
| 7852 | if (codegen->verbose) { | 7852 | if (codegen->verbose_ir) { |
| 7853 | fprintf(stderr, "\nSource: "); | 7853 | fprintf(stderr, "\nSource: "); |
| 7854 | ast_render(codegen, stderr, node, 4); | 7854 | ast_render(codegen, stderr, node, 4); |
| 7855 | fprintf(stderr, "\n{ // (IR)\n"); | 7855 | fprintf(stderr, "\n{ // (IR)\n"); |
| ... | @@ -7870,7 +7870,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node | ... | @@ -7870,7 +7870,7 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node |
| 7870 | if (type_is_invalid(result_type)) | 7870 | if (type_is_invalid(result_type)) |
| 7871 | return codegen->invalid_instruction; | 7871 | return codegen->invalid_instruction; |
| 7872 | 7872 | ||
| 7873 | if (codegen->verbose) { | 7873 | if (codegen->verbose_ir) { |
| 7874 | fprintf(stderr, "{ // (analyzed)\n"); | 7874 | fprintf(stderr, "{ // (analyzed)\n"); |
| 7875 | ir_print(codegen, stderr, &analyzed_executable, 4); | 7875 | ir_print(codegen, stderr, &analyzed_executable, 4); |
| 7876 | fprintf(stderr, "}\n"); | 7876 | fprintf(stderr, "}\n"); |
| ... | @@ -13514,7 +13514,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -13514,7 +13514,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 13514 | return ira->codegen->builtin_types.entry_invalid; | 13514 | return ira->codegen->builtin_types.entry_invalid; |
| 13515 | } | 13515 | } |
| 13516 | 13516 | ||
| 13517 | if (ira->codegen->verbose) { | 13517 | if (ira->codegen->verbose_cimport) { |
| 13518 | fprintf(stderr, "\nC imports:\n"); | 13518 | fprintf(stderr, "\nC imports:\n"); |
| 13519 | fprintf(stderr, "-----------\n"); | 13519 | fprintf(stderr, "-----------\n"); |
| 13520 | ast_render(ira->codegen, stderr, child_import->root, 4); | 13520 | ast_render(ira->codegen, stderr, child_import->root, 4); |
src/link.cpp+7-14| ... | @@ -37,8 +37,12 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) | ... | @@ -37,8 +37,12 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) |
| 37 | parent_gen->zig_lib_dir); | 37 | parent_gen->zig_lib_dir); |
| 38 | 38 | ||
| 39 | child_gen->want_h_file = false; | 39 | child_gen->want_h_file = false; |
| 40 | child_gen->verbose_tokenize = parent_gen->verbose_tokenize; | ||
| 41 | child_gen->verbose_ast = parent_gen->verbose_ast; | ||
| 40 | child_gen->verbose_link = parent_gen->verbose_link; | 42 | child_gen->verbose_link = parent_gen->verbose_link; |
| 41 | child_gen->verbose_ir = parent_gen->verbose_ir; | 43 | child_gen->verbose_ir = parent_gen->verbose_ir; |
| 44 | child_gen->verbose_llvm_ir = parent_gen->verbose_llvm_ir; | ||
| 45 | child_gen->verbose_cimport = parent_gen->verbose_cimport; | ||
| 42 | 46 | ||
| 43 | codegen_set_cache_dir(child_gen, parent_gen->cache_dir); | 47 | codegen_set_cache_dir(child_gen, parent_gen->cache_dir); |
| 44 | 48 | ||
| ... | @@ -47,7 +51,6 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) | ... | @@ -47,7 +51,6 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path) |
| 47 | 51 | ||
| 48 | codegen_set_out_name(child_gen, buf_create_from_str(oname)); | 52 | codegen_set_out_name(child_gen, buf_create_from_str(oname)); |
| 49 | 53 | ||
| 50 | codegen_set_verbose(child_gen, parent_gen->verbose); | ||
| 51 | codegen_set_errmsg_color(child_gen, parent_gen->err_color); | 54 | codegen_set_errmsg_color(child_gen, parent_gen->err_color); |
| 52 | 55 | ||
| 53 | codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min); | 56 | codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min); |
| ... | @@ -859,15 +862,12 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -859,15 +862,12 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 859 | buf_resize(&lj.out_file, 0); | 862 | buf_resize(&lj.out_file, 0); |
| 860 | } | 863 | } |
| 861 | 864 | ||
| 862 | if (g->verbose || g->verbose_ir) { | 865 | if (g->verbose_llvm_ir) { |
| 863 | fprintf(stderr, "\nOptimization:\n"); | 866 | fprintf(stderr, "\nOptimization:\n"); |
| 864 | fprintf(stderr, "---------------\n"); | 867 | fprintf(stderr, "---------------\n"); |
| 868 | fflush(stderr); | ||
| 865 | LLVMDumpModule(g->module); | 869 | LLVMDumpModule(g->module); |
| 866 | } | 870 | } |
| 867 | if (g->verbose || g->verbose_link) { | ||
| 868 | fprintf(stderr, "\nLink:\n"); | ||
| 869 | fprintf(stderr, "-------\n"); | ||
| 870 | } | ||
| 871 | 871 | ||
| 872 | bool override_out_file = (buf_len(&lj.out_file) != 0); | 872 | bool override_out_file = (buf_len(&lj.out_file) != 0); |
| 873 | if (!override_out_file) { | 873 | if (!override_out_file) { |
| ... | @@ -888,9 +888,6 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -888,9 +888,6 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 888 | zig_panic("unable to rename object file into final output: %s", err_str(err)); | 888 | zig_panic("unable to rename object file into final output: %s", err_str(err)); |
| 889 | } | 889 | } |
| 890 | } | 890 | } |
| 891 | if (g->verbose || g->verbose_link) { | ||
| 892 | fprintf(stderr, "OK\n"); | ||
| 893 | } | ||
| 894 | return; | 891 | return; |
| 895 | } | 892 | } |
| 896 | 893 | ||
| ... | @@ -908,7 +905,7 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -908,7 +905,7 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 908 | construct_linker_job(&lj); | 905 | construct_linker_job(&lj); |
| 909 | 906 | ||
| 910 | 907 | ||
| 911 | if (g->verbose || g->verbose_link) { | 908 | if (g->verbose_link) { |
| 912 | for (size_t i = 0; i < lj.args.length; i += 1) { | 909 | for (size_t i = 0; i < lj.args.length; i += 1) { |
| 913 | const char *space = (i != 0) ? " " : ""; | 910 | const char *space = (i != 0) ? " " : ""; |
| 914 | fprintf(stderr, "%s%s", space, lj.args.at(i)); | 911 | fprintf(stderr, "%s%s", space, lj.args.at(i)); |
| ... | @@ -925,8 +922,4 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -925,8 +922,4 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 925 | } | 922 | } |
| 926 | 923 | ||
| 927 | codegen_add_time_event(g, "Done"); | 924 | codegen_add_time_event(g, "Done"); |
| 928 | |||
| 929 | if (g->verbose || g->verbose_link) { | ||
| 930 | fprintf(stderr, "OK\n"); | ||
| 931 | } | ||
| 932 | } | 925 | } |
src/main.cpp+85-57| ... | @@ -20,67 +20,70 @@ static int usage(const char *arg0) { | ... | @@ -20,67 +20,70 @@ static int usage(const char *arg0) { |
| 20 | fprintf(stderr, "Usage: %s [command] [options]\n" | 20 | fprintf(stderr, "Usage: %s [command] [options]\n" |
| 21 | "Commands:\n" | 21 | "Commands:\n" |
| 22 | " build build project from build.zig\n" | 22 | " build build project from build.zig\n" |
| 23 | " build-exe [source] create executable from source or object files\n" | 23 | " build-exe $source create executable from source or object files\n" |
| 24 | " build-lib [source] create library from source or object files\n" | 24 | " build-lib $source create library from source or object files\n" |
| 25 | " build-obj [source] create object from source or assembly\n" | 25 | " build-obj $source create object from source or assembly\n" |
| 26 | " parsec [source] convert c code to zig code\n" | 26 | " parsec $source convert c code to zig code\n" |
| 27 | " targets list available compilation targets\n" | 27 | " targets list available compilation targets\n" |
| 28 | " test [source] create and run a test build\n" | 28 | " test $source create and run a test build\n" |
| 29 | " version print version number and exit\n" | 29 | " version print version number and exit\n" |
| 30 | " zen print zen of zig and exit\n" | 30 | " zen print zen of zig and exit\n" |
| 31 | "Compile Options:\n" | 31 | "Compile Options:\n" |
| 32 | " --assembly [source] add assembly file to build\n" | 32 | " --assembly $source add assembly file to build\n" |
| 33 | " --cache-dir [path] override the cache directory\n" | 33 | " --cache-dir $path override the cache directory\n" |
| 34 | " --color [auto|off|on] enable or disable colored error messages\n" | 34 | " --color $auto|off|on enable or disable colored error messages\n" |
| 35 | " --enable-timing-info print timing diagnostics\n" | 35 | " --enable-timing-info print timing diagnostics\n" |
| 36 | " --libc-include-dir [path] directory where libc stdlib.h resides\n" | 36 | " --libc-include-dir $path directory where libc stdlib.h resides\n" |
| 37 | " --name [name] override output name\n" | 37 | " --name $name override output name\n" |
| 38 | " --output [file] override destination path\n" | 38 | " --output $file override destination path\n" |
| 39 | " --output-h [file] override generated header file path\n" | 39 | " --output-h $file override generated header file path\n" |
| 40 | " --pkg-begin [name] [path] make package available to import and push current pkg\n" | 40 | " --pkg-begin $name $path make package available to import and push current pkg\n" |
| 41 | " --pkg-end pop current pkg\n" | 41 | " --pkg-end pop current pkg\n" |
| 42 | " --release-fast build with optimizations on and safety off\n" | 42 | " --release-fast build with optimizations on and safety off\n" |
| 43 | " --release-safe build with optimizations on and safety on\n" | 43 | " --release-safe build with optimizations on and safety on\n" |
| 44 | " --static output will be statically linked\n" | 44 | " --static output will be statically linked\n" |
| 45 | " --strip exclude debug symbols\n" | 45 | " --strip exclude debug symbols\n" |
| 46 | " --target-arch [name] specify target architecture\n" | 46 | " --target-arch $name specify target architecture\n" |
| 47 | " --target-environ [name] specify target environment\n" | 47 | " --target-environ $name specify target environment\n" |
| 48 | " --target-os [name] specify target operating system\n" | 48 | " --target-os $name specify target operating system\n" |
| 49 | " --verbose turn on compiler debug output\n" | 49 | " --verbose-tokenize turn on compiler debug output for tokenization\n" |
| 50 | " --verbose-link turn on compiler debug output for linking only\n" | 50 | " --verbose-ast turn on compiler debug output for parsing into an AST\n" |
| 51 | " --verbose-ir turn on compiler debug output for IR only\n" | 51 | " --verbose-link turn on compiler debug output for linking\n" |
| 52 | " --zig-install-prefix [path] override directory where zig thinks it is installed\n" | 52 | " --verbose-ir turn on compiler debug output for Zig IR\n" |
| 53 | " -dirafter [dir] same as -isystem but do it last\n" | 53 | " --verbose-llvm-ir turn on compiler debug output for LLVM IR\n" |
| 54 | " -isystem [dir] add additional search path for other .h files\n" | 54 | " --verbose-cimport turn on compiler debug output for C imports\n" |
| 55 | " -mllvm [arg] additional arguments to forward to LLVM's option processing\n" | 55 | " --zig-install-prefix $path override directory where zig thinks it is installed\n" |
| 56 | " -dirafter $dir same as -isystem but do it last\n" | ||
| 57 | " -isystem $dir add additional search path for other .h files\n" | ||
| 58 | " -mllvm $arg additional arguments to forward to LLVM's option processing\n" | ||
| 56 | "Link Options:\n" | 59 | "Link Options:\n" |
| 57 | " --ar-path [path] set the path to ar\n" | 60 | " --ar-path $path set the path to ar\n" |
| 58 | " --dynamic-linker [path] set the path to ld.so\n" | 61 | " --dynamic-linker $path set the path to ld.so\n" |
| 59 | " --each-lib-rpath add rpath for each used dynamic library\n" | 62 | " --each-lib-rpath add rpath for each used dynamic library\n" |
| 60 | " --libc-lib-dir [path] directory where libc crt1.o resides\n" | 63 | " --libc-lib-dir $path directory where libc crt1.o resides\n" |
| 61 | " --libc-static-lib-dir [path] directory where libc crtbegin.o resides\n" | 64 | " --libc-static-lib-dir $path directory where libc crtbegin.o resides\n" |
| 62 | " --msvc-lib-dir [path] (windows) directory where vcruntime.lib resides\n" | 65 | " --msvc-lib-dir $path (windows) directory where vcruntime.lib resides\n" |
| 63 | " --kernel32-lib-dir [path] (windows) directory where kernel32.lib resides\n" | 66 | " --kernel32-lib-dir $path (windows) directory where kernel32.lib resides\n" |
| 64 | " --library [lib] link against lib\n" | 67 | " --library $lib link against lib\n" |
| 65 | " --library-path [dir] add a directory to the library search path\n" | 68 | " --library-path $dir add a directory to the library search path\n" |
| 66 | " --linker-script [path] use a custom linker script\n" | 69 | " --linker-script $path use a custom linker script\n" |
| 67 | " --object [obj] add object file to build\n" | 70 | " --object $obj add object file to build\n" |
| 68 | " -L[dir] alias for --library-path\n" | 71 | " -L$dir alias for --library-path\n" |
| 69 | " -rdynamic add all symbols to the dynamic symbol table\n" | 72 | " -rdynamic add all symbols to the dynamic symbol table\n" |
| 70 | " -rpath [path] add directory to the runtime library search path\n" | 73 | " -rpath $path add directory to the runtime library search path\n" |
| 71 | " -mconsole (windows) --subsystem console to the linker\n" | 74 | " -mconsole (windows) --subsystem console to the linker\n" |
| 72 | " -mwindows (windows) --subsystem windows to the linker\n" | 75 | " -mwindows (windows) --subsystem windows to the linker\n" |
| 73 | " -municode (windows) link with unicode\n" | 76 | " -municode (windows) link with unicode\n" |
| 74 | " -framework [name] (darwin) link against framework\n" | 77 | " -framework $name (darwin) link against framework\n" |
| 75 | " -mios-version-min [ver] (darwin) set iOS deployment target\n" | 78 | " -mios-version-min $ver (darwin) set iOS deployment target\n" |
| 76 | " -mmacosx-version-min [ver] (darwin) set Mac OS X deployment target\n" | 79 | " -mmacosx-version-min $ver (darwin) set Mac OS X deployment target\n" |
| 77 | " --ver-major [ver] dynamic library semver major version\n" | 80 | " --ver-major $ver dynamic library semver major version\n" |
| 78 | " --ver-minor [ver] dynamic library semver minor version\n" | 81 | " --ver-minor $ver dynamic library semver minor version\n" |
| 79 | " --ver-patch [ver] dynamic library semver patch version\n" | 82 | " --ver-patch $ver dynamic library semver patch version\n" |
| 80 | "Test Options:\n" | 83 | "Test Options:\n" |
| 81 | " --test-filter [text] skip tests that do not match filter\n" | 84 | " --test-filter $text skip tests that do not match filter\n" |
| 82 | " --test-name-prefix [text] add prefix to all tests\n" | 85 | " --test-name-prefix $text add prefix to all tests\n" |
| 83 | " --test-cmd [arg] specify test execution command one arg at a time\n" | 86 | " --test-cmd $arg specify test execution command one arg at a time\n" |
| 84 | " --test-cmd-bin appends test binary path to test cmd args\n" | 87 | " --test-cmd-bin appends test binary path to test cmd args\n" |
| 85 | , arg0); | 88 | , arg0); |
| 86 | return EXIT_FAILURE; | 89 | return EXIT_FAILURE; |
| ... | @@ -274,9 +277,12 @@ int main(int argc, char **argv) { | ... | @@ -274,9 +277,12 @@ int main(int argc, char **argv) { |
| 274 | bool is_static = false; | 277 | bool is_static = false; |
| 275 | OutType out_type = OutTypeUnknown; | 278 | OutType out_type = OutTypeUnknown; |
| 276 | const char *out_name = nullptr; | 279 | const char *out_name = nullptr; |
| 277 | bool verbose = false; | 280 | bool verbose_tokenize = false; |
| 281 | bool verbose_ast = false; | ||
| 278 | bool verbose_link = false; | 282 | bool verbose_link = false; |
| 279 | bool verbose_ir = false; | 283 | bool verbose_ir = false; |
| 284 | bool verbose_llvm_ir = false; | ||
| 285 | bool verbose_cimport = false; | ||
| 280 | ErrColor color = ErrColorAuto; | 286 | ErrColor color = ErrColorAuto; |
| 281 | const char *libc_lib_dir = nullptr; | 287 | const char *libc_lib_dir = nullptr; |
| 282 | const char *libc_static_lib_dir = nullptr; | 288 | const char *libc_static_lib_dir = nullptr; |
| ... | @@ -328,9 +334,7 @@ int main(int argc, char **argv) { | ... | @@ -328,9 +334,7 @@ int main(int argc, char **argv) { |
| 328 | args.append(NULL); // placeholder | 334 | args.append(NULL); // placeholder |
| 329 | args.append(NULL); // placeholder | 335 | args.append(NULL); // placeholder |
| 330 | for (int i = 2; i < argc; i += 1) { | 336 | for (int i = 2; i < argc; i += 1) { |
| 331 | if (strcmp(argv[i], "--debug-build-verbose") == 0) { | 337 | if (strcmp(argv[i], "--help") == 0) { |
| 332 | verbose = true; | ||
| 333 | } else if (strcmp(argv[i], "--help") == 0) { | ||
| 334 | asked_for_help = true; | 338 | asked_for_help = true; |
| 335 | args.append(argv[i]); | 339 | args.append(argv[i]); |
| 336 | } else if (i + 1 < argc && strcmp(argv[i], "--build-file") == 0) { | 340 | } else if (i + 1 < argc && strcmp(argv[i], "--build-file") == 0) { |
| ... | @@ -363,7 +367,6 @@ int main(int argc, char **argv) { | ... | @@ -363,7 +367,6 @@ int main(int argc, char **argv) { |
| 363 | 367 | ||
| 364 | CodeGen *g = codegen_create(build_runner_path, nullptr, OutTypeExe, BuildModeDebug, zig_lib_dir_buf); | 368 | CodeGen *g = codegen_create(build_runner_path, nullptr, OutTypeExe, BuildModeDebug, zig_lib_dir_buf); |
| 365 | codegen_set_out_name(g, buf_create_from_str("build")); | 369 | codegen_set_out_name(g, buf_create_from_str("build")); |
| 366 | codegen_set_verbose(g, verbose); | ||
| 367 | 370 | ||
| 368 | Buf build_file_abs = BUF_INIT; | 371 | Buf build_file_abs = BUF_INIT; |
| 369 | os_path_resolve(buf_create_from_str("."), buf_create_from_str(build_file), &build_file_abs); | 372 | os_path_resolve(buf_create_from_str("."), buf_create_from_str(build_file), &build_file_abs); |
| ... | @@ -398,14 +401,30 @@ int main(int argc, char **argv) { | ... | @@ -398,14 +401,30 @@ int main(int argc, char **argv) { |
| 398 | "\n" | 401 | "\n" |
| 399 | "General Options:\n" | 402 | "General Options:\n" |
| 400 | " --help Print this help and exit\n" | 403 | " --help Print this help and exit\n" |
| 401 | " --build-file [file] Override path to build.zig\n" | 404 | " --build-file $file Override path to build.zig\n" |
| 402 | " --cache-dir [path] Override path to cache directory\n" | 405 | " --cache-dir $path Override path to cache directory\n" |
| 403 | " --verbose Print commands before executing them\n" | 406 | " --verbose Print commands before executing them\n" |
| 404 | " --debug-build-verbose Print verbose debugging information for the build system itself\n" | 407 | " --verbose-tokenize Enable compiler debug output for tokenization\n" |
| 405 | " --prefix [prefix] Override default install prefix\n" | 408 | " --verbose-ast Enable compiler debug output for parsing into an AST\n" |
| 409 | " --verbose-link Enable compiler debug output for linking\n" | ||
| 410 | " --verbose-ir Enable compiler debug output for Zig IR\n" | ||
| 411 | " --verbose-llvm-ir Enable compiler debug output for LLVM IR\n" | ||
| 412 | " --verbose-cimport Enable compiler debug output for C imports\n" | ||
| 413 | " --prefix $path Override default install prefix\n" | ||
| 406 | "\n" | 414 | "\n" |
| 407 | "More options become available when the build file is found.\n" | 415 | "Project-specific options become available when the build file is found.\n" |
| 408 | "Run this command with no options to generate a build.zig template.\n" | 416 | "Run this command with no options to generate a build.zig template.\n" |
| 417 | "\n" | ||
| 418 | "Advanced Options:\n" | ||
| 419 | " --build-file $file Override path to build.zig\n" | ||
| 420 | " --cache-dir $path Override path to cache directory\n" | ||
| 421 | " --verbose-tokenize Enable compiler debug output for tokenization\n" | ||
| 422 | " --verbose-ast Enable compiler debug output for parsing into an AST\n" | ||
| 423 | " --verbose-link Enable compiler debug output for linking\n" | ||
| 424 | " --verbose-ir Enable compiler debug output for Zig IR\n" | ||
| 425 | " --verbose-llvm-ir Enable compiler debug output for LLVM IR\n" | ||
| 426 | " --verbose-cimport Enable compiler debug output for C imports\n" | ||
| 427 | "\n" | ||
| 409 | , zig_exe_path); | 428 | , zig_exe_path); |
| 410 | return 0; | 429 | return 0; |
| 411 | } | 430 | } |
| ... | @@ -452,12 +471,18 @@ int main(int argc, char **argv) { | ... | @@ -452,12 +471,18 @@ int main(int argc, char **argv) { |
| 452 | strip = true; | 471 | strip = true; |
| 453 | } else if (strcmp(arg, "--static") == 0) { | 472 | } else if (strcmp(arg, "--static") == 0) { |
| 454 | is_static = true; | 473 | is_static = true; |
| 455 | } else if (strcmp(arg, "--verbose") == 0) { | 474 | } else if (strcmp(arg, "--verbose-tokenize") == 0) { |
| 456 | verbose = true; | 475 | verbose_tokenize = true; |
| 476 | } else if (strcmp(arg, "--verbose-ast") == 0) { | ||
| 477 | verbose_ast = true; | ||
| 457 | } else if (strcmp(arg, "--verbose-link") == 0) { | 478 | } else if (strcmp(arg, "--verbose-link") == 0) { |
| 458 | verbose_link = true; | 479 | verbose_link = true; |
| 459 | } else if (strcmp(arg, "--verbose-ir") == 0) { | 480 | } else if (strcmp(arg, "--verbose-ir") == 0) { |
| 460 | verbose_ir = true; | 481 | verbose_ir = true; |
| 482 | } else if (strcmp(arg, "--verbose-llvm-ir") == 0) { | ||
| 483 | verbose_llvm_ir = true; | ||
| 484 | } else if (strcmp(arg, "--verbose-cimport") == 0) { | ||
| 485 | verbose_cimport = true; | ||
| 461 | } else if (strcmp(arg, "-mwindows") == 0) { | 486 | } else if (strcmp(arg, "-mwindows") == 0) { |
| 462 | mwindows = true; | 487 | mwindows = true; |
| 463 | } else if (strcmp(arg, "-mconsole") == 0) { | 488 | } else if (strcmp(arg, "-mconsole") == 0) { |
| ... | @@ -742,9 +767,12 @@ int main(int argc, char **argv) { | ... | @@ -742,9 +767,12 @@ int main(int argc, char **argv) { |
| 742 | codegen_set_kernel32_lib_dir(g, buf_create_from_str(kernel32_lib_dir)); | 767 | codegen_set_kernel32_lib_dir(g, buf_create_from_str(kernel32_lib_dir)); |
| 743 | if (dynamic_linker) | 768 | if (dynamic_linker) |
| 744 | codegen_set_dynamic_linker(g, buf_create_from_str(dynamic_linker)); | 769 | codegen_set_dynamic_linker(g, buf_create_from_str(dynamic_linker)); |
| 745 | codegen_set_verbose(g, verbose); | 770 | g->verbose_tokenize = verbose_tokenize; |
| 771 | g->verbose_ast = verbose_ast; | ||
| 746 | g->verbose_link = verbose_link; | 772 | g->verbose_link = verbose_link; |
| 747 | g->verbose_ir = verbose_ir; | 773 | g->verbose_ir = verbose_ir; |
| 774 | g->verbose_llvm_ir = verbose_llvm_ir; | ||
| 775 | g->verbose_cimport = verbose_cimport; | ||
| 748 | codegen_set_errmsg_color(g, color); | 776 | codegen_set_errmsg_color(g, color); |
| 749 | 777 | ||
| 750 | for (size_t i = 0; i < lib_dirs.length; i += 1) { | 778 | for (size_t i = 0; i < lib_dirs.length; i += 1) { |
src/parsec.cpp+1-1| ... | @@ -3167,7 +3167,7 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch | ... | @@ -3167,7 +3167,7 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch |
| 3167 | { | 3167 | { |
| 3168 | Context context = {0}; | 3168 | Context context = {0}; |
| 3169 | Context *c = &context; | 3169 | Context *c = &context; |
| 3170 | c->warnings_on = codegen->verbose; | 3170 | c->warnings_on = codegen->verbose_cimport; |
| 3171 | c->import = import; | 3171 | c->import = import; |
| 3172 | c->errors = errors; | 3172 | c->errors = errors; |
| 3173 | if (buf_ends_with_str(buf_create_from_str(target_file), ".h")) { | 3173 | if (buf_ends_with_str(buf_create_from_str(target_file), ".h")) { |
std/build.zig+32-7| ... | @@ -33,6 +33,12 @@ pub const Builder = struct { | ... | @@ -33,6 +33,12 @@ pub const Builder = struct { |
| 33 | available_options_map: AvailableOptionsMap, | 33 | available_options_map: AvailableOptionsMap, |
| 34 | available_options_list: ArrayList(AvailableOption), | 34 | available_options_list: ArrayList(AvailableOption), |
| 35 | verbose: bool, | 35 | verbose: bool, |
| 36 | verbose_tokenize: bool, | ||
| 37 | verbose_ast: bool, | ||
| 38 | verbose_link: bool, | ||
| 39 | verbose_ir: bool, | ||
| 40 | verbose_llvm_ir: bool, | ||
| 41 | verbose_cimport: bool, | ||
| 36 | invalid_user_input: bool, | 42 | invalid_user_input: bool, |
| 37 | zig_exe: []const u8, | 43 | zig_exe: []const u8, |
| 38 | default_step: &Step, | 44 | default_step: &Step, |
| ... | @@ -88,6 +94,12 @@ pub const Builder = struct { | ... | @@ -88,6 +94,12 @@ pub const Builder = struct { |
| 88 | .build_root = build_root, | 94 | .build_root = build_root, |
| 89 | .cache_root = %%os.path.relative(allocator, build_root, cache_root), | 95 | .cache_root = %%os.path.relative(allocator, build_root, cache_root), |
| 90 | .verbose = false, | 96 | .verbose = false, |
| 97 | .verbose_tokenize = false, | ||
| 98 | .verbose_ast = false, | ||
| 99 | .verbose_link = false, | ||
| 100 | .verbose_ir = false, | ||
| 101 | .verbose_llvm_ir = false, | ||
| 102 | .verbose_cimport = false, | ||
| 91 | .invalid_user_input = false, | 103 | .invalid_user_input = false, |
| 92 | .allocator = allocator, | 104 | .allocator = allocator, |
| 93 | .lib_paths = ArrayList([]const u8).init(allocator), | 105 | .lib_paths = ArrayList([]const u8).init(allocator), |
| ... | @@ -536,15 +548,19 @@ pub const Builder = struct { | ... | @@ -536,15 +548,19 @@ pub const Builder = struct { |
| 536 | return self.spawnChildEnvMap(null, &self.env_map, argv); | 548 | return self.spawnChildEnvMap(null, &self.env_map, argv); |
| 537 | } | 549 | } |
| 538 | 550 | ||
| 551 | fn printCmd(cwd: ?[]const u8, argv: []const []const u8) { | ||
| 552 | if (cwd) |yes_cwd| %%io.stderr.print("cd {} && ", yes_cwd); | ||
| 553 | for (argv) |arg| { | ||
| 554 | %%io.stderr.print("{} ", arg); | ||
| 555 | } | ||
| 556 | %%io.stderr.printf("\n"); | ||
| 557 | } | ||
| 558 | |||
| 539 | fn spawnChildEnvMap(self: &Builder, cwd: ?[]const u8, env_map: &const BufMap, | 559 | fn spawnChildEnvMap(self: &Builder, cwd: ?[]const u8, env_map: &const BufMap, |
| 540 | argv: []const []const u8) -> %void | 560 | argv: []const []const u8) -> %void |
| 541 | { | 561 | { |
| 542 | if (self.verbose) { | 562 | if (self.verbose) { |
| 543 | if (cwd) |yes_cwd| %%io.stderr.print("cd {}; ", yes_cwd); | 563 | printCmd(cwd, argv); |
| 544 | for (argv) |arg| { | ||
| 545 | %%io.stderr.print("{} ", arg); | ||
| 546 | } | ||
| 547 | %%io.stderr.printf("\n"); | ||
| 548 | } | 564 | } |
| 549 | 565 | ||
| 550 | const child = %%os.ChildProcess.init(argv, self.allocator); | 566 | const child = %%os.ChildProcess.init(argv, self.allocator); |
| ... | @@ -561,12 +577,15 @@ pub const Builder = struct { | ... | @@ -561,12 +577,15 @@ pub const Builder = struct { |
| 561 | switch (term) { | 577 | switch (term) { |
| 562 | Term.Exited => |code| { | 578 | Term.Exited => |code| { |
| 563 | if (code != 0) { | 579 | if (code != 0) { |
| 564 | %%io.stderr.printf("Process {} exited with error code {}\n", argv[0], code); | 580 | %%io.stderr.printf("The following command exited with error code {}:\n", code); |
| 581 | printCmd(cwd, argv); | ||
| 565 | return error.UncleanExit; | 582 | return error.UncleanExit; |
| 566 | } | 583 | } |
| 567 | }, | 584 | }, |
| 568 | else => { | 585 | else => { |
| 569 | %%io.stderr.printf("Process {} terminated unexpectedly\n", argv[0]); | 586 | %%io.stderr.printf("The following command terminated unexpectedly:\n"); |
| 587 | printCmd(cwd, argv); | ||
| 588 | |||
| 570 | return error.UncleanExit; | 589 | return error.UncleanExit; |
| 571 | }, | 590 | }, |
| 572 | }; | 591 | }; |
| ... | @@ -1117,6 +1136,12 @@ pub const LibExeObjStep = struct { | ... | @@ -1117,6 +1136,12 @@ pub const LibExeObjStep = struct { |
| 1117 | if (self.verbose) { | 1136 | if (self.verbose) { |
| 1118 | %%zig_args.append("--verbose"); | 1137 | %%zig_args.append("--verbose"); |
| 1119 | } | 1138 | } |
| 1139 | if (builder.verbose_tokenize) %%zig_args.append("--verbose-tokenize"); | ||
| 1140 | if (builder.verbose_ast) %%zig_args.append("--verbose-ast"); | ||
| 1141 | if (builder.verbose_cimport) %%zig_args.append("--verbose-cimport"); | ||
| 1142 | if (builder.verbose_ir) %%zig_args.append("--verbose-ir"); | ||
| 1143 | if (builder.verbose_llvm_ir) %%zig_args.append("--verbose-llvm-ir"); | ||
| 1144 | if (builder.verbose_link) %%zig_args.append("--verbose-link"); | ||
| 1120 | 1145 | ||
| 1121 | if (self.strip) { | 1146 | if (self.strip) { |
| 1122 | %%zig_args.append("--strip"); | 1147 | %%zig_args.append("--strip"); |
std/special/build_runner.zig+32-7| ... | @@ -69,6 +69,18 @@ pub fn main() -> %void { | ... | @@ -69,6 +69,18 @@ pub fn main() -> %void { |
| 69 | %%io.stderr.printf("Expected argument after --prefix\n\n"); | 69 | %%io.stderr.printf("Expected argument after --prefix\n\n"); |
| 70 | return usage(&builder, false, &io.stderr); | 70 | return usage(&builder, false, &io.stderr); |
| 71 | }); | 71 | }); |
| 72 | } else if (mem.eql(u8, arg, "--verbose-tokenize")) { | ||
| 73 | builder.verbose_tokenize = true; | ||
| 74 | } else if (mem.eql(u8, arg, "--verbose-ast")) { | ||
| 75 | builder.verbose_ast = true; | ||
| 76 | } else if (mem.eql(u8, arg, "--verbose-link")) { | ||
| 77 | builder.verbose_link = true; | ||
| 78 | } else if (mem.eql(u8, arg, "--verbose-ir")) { | ||
| 79 | builder.verbose_ir = true; | ||
| 80 | } else if (mem.eql(u8, arg, "--verbose-llvm-ir")) { | ||
| 81 | builder.verbose_llvm_ir = true; | ||
| 82 | } else if (mem.eql(u8, arg, "--verbose-cimport")) { | ||
| 83 | builder.verbose_cimport = true; | ||
| 72 | } else { | 84 | } else { |
| 73 | %%io.stderr.printf("Unrecognized argument: {}\n\n", arg); | 85 | %%io.stderr.printf("Unrecognized argument: {}\n\n", arg); |
| 74 | return usage(&builder, false, &io.stderr); | 86 | return usage(&builder, false, &io.stderr); |
| ... | @@ -116,27 +128,40 @@ fn usage(builder: &Builder, already_ran_build: bool, out_stream: &io.OutStream) | ... | @@ -116,27 +128,40 @@ fn usage(builder: &Builder, already_ran_build: bool, out_stream: &io.OutStream) |
| 116 | \\ | 128 | \\ |
| 117 | \\General Options: | 129 | \\General Options: |
| 118 | \\ --help Print this help and exit | 130 | \\ --help Print this help and exit |
| 119 | \\ --build-file [file] Override path to build.zig | ||
| 120 | \\ --cache-dir [path] Override path to cache directory | ||
| 121 | \\ --verbose Print commands before executing them | 131 | \\ --verbose Print commands before executing them |
| 122 | \\ --debug-build-verbose Print verbose debugging information for the build system itself | 132 | \\ --prefix $path Override default install prefix |
| 123 | \\ --prefix [prefix] Override default install prefix | ||
| 124 | \\ | 133 | \\ |
| 125 | \\Project-Specific Options: | 134 | \\Project-Specific Options: |
| 126 | \\ | 135 | \\ |
| 127 | ); | 136 | ); |
| 128 | 137 | ||
| 129 | if (builder.available_options_list.len == 0) { | 138 | if (builder.available_options_list.len == 0) { |
| 130 | %%out_stream.printf(" (none)\n"); | 139 | %%out_stream.print(" (none)\n"); |
| 131 | } else { | 140 | } else { |
| 132 | for (builder.available_options_list.toSliceConst()) |option| { | 141 | for (builder.available_options_list.toSliceConst()) |option| { |
| 133 | const name = %%fmt.allocPrint(allocator, | 142 | const name = %%fmt.allocPrint(allocator, |
| 134 | " -D{}=({})", option.name, Builder.typeIdName(option.type_id)); | 143 | " -D{}=${}", option.name, Builder.typeIdName(option.type_id)); |
| 135 | defer allocator.free(name); | 144 | defer allocator.free(name); |
| 136 | %%out_stream.printf("{s24} {}\n", name, option.description); | 145 | %%out_stream.print("{s24} {}\n", name, option.description); |
| 137 | } | 146 | } |
| 138 | } | 147 | } |
| 139 | 148 | ||
| 149 | %%out_stream.write( | ||
| 150 | \\ | ||
| 151 | \\Advanced Options: | ||
| 152 | \\ --build-file $file Override path to build.zig | ||
| 153 | \\ --cache-dir $path Override path to zig cache directory | ||
| 154 | \\ --verbose-tokenize Enable compiler debug output for tokenization | ||
| 155 | \\ --verbose-ast Enable compiler debug output for parsing into an AST | ||
| 156 | \\ --verbose-link Enable compiler debug output for linking | ||
| 157 | \\ --verbose-ir Enable compiler debug output for Zig IR | ||
| 158 | \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR | ||
| 159 | \\ --verbose-cimport Enable compiler debug output for C imports | ||
| 160 | \\ | ||
| 161 | ); | ||
| 162 | |||
| 163 | %%out_stream.flush(); | ||
| 164 | |||
| 140 | if (out_stream == &io.stderr) | 165 | if (out_stream == &io.stderr) |
| 141 | return error.InvalidArgs; | 166 | return error.InvalidArgs; |
| 142 | } | 167 | } |