authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-09 01:00:45-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-09 01:00:45-05:00
log94e52dba85e4b81f5c4f2576c91df039604d06fb
tree1f2dc6ff88128caa53d15518f8c4fddac5b27556
parent5046aa9403e98fec7a744f35faa9d17925c9079d
signature Commit is signed but in an unrecognized format.

fix docgen and fix unnecessarily adding .root suffix to objects


2 files changed, 19 insertions(+), 21 deletions(-)

doc/docgen.zig+14-12
......@@ -1011,8 +1011,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
10111011 zig_exe,
10121012 "build-exe",
10131013 tmp_source_file_name,
1014 "--output",
1015 tmp_bin_file_name,
1014 "--output-dir",
1015 tmp_dir_name,
1016 "--name",
1017 code.name,
10161018 });
10171019 try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", code.name);
10181020 switch (code.mode) {
......@@ -1085,8 +1087,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
10851087 zig_exe,
10861088 "test",
10871089 tmp_source_file_name,
1088 "--output",
1089 test_out_path,
1090 "--output-dir",
1091 tmp_dir_name,
10901092 });
10911093 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
10921094 switch (code.mode) {
......@@ -1122,8 +1124,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
11221124 "--color",
11231125 "on",
11241126 tmp_source_file_name,
1125 "--output",
1126 test_out_path,
1127 "--output-dir",
1128 tmp_dir_name,
11271129 });
11281130 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
11291131 switch (code.mode) {
......@@ -1179,8 +1181,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
11791181 zig_exe,
11801182 "test",
11811183 tmp_source_file_name,
1182 "--output",
1183 test_out_path,
1184 "--output-dir",
1185 tmp_dir_name,
11841186 });
11851187 switch (code.mode) {
11861188 builtin.Mode.Debug => {},
......@@ -1239,10 +1241,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
12391241 tmp_source_file_name,
12401242 "--color",
12411243 "on",
1242 "--output",
1243 tmp_obj_file_name,
1244 "--output-h",
1245 output_h_file_name,
1244 "--name",
1245 code.name,
1246 "--output-dir",
1247 tmp_dir_name,
12461248 });
12471249
12481250 if (!code.is_inline) {
src/codegen.cpp+5-9
......@@ -9120,18 +9120,14 @@ static void resolve_out_paths(CodeGen *g) {
91209120 buf_init_from_buf(&g->output_file_path, g->link_objects.at(0));
91219121 return;
91229122 }
9123 if (!need_llvm_module(g) || (g->enable_cache && g->link_objects.length == 0)) {
9124 // Either we're not creating an object file from our LLVM Module,
9125 // or we have caching enabled and do not need to link objects together.
9126 // In both cases, the output file path and object file path basename can match.
9127 buf_append_str(o_basename, target_o_file_ext(g->zig_target));
9128 buf_append_str(out_basename, target_o_file_ext(g->zig_target));
9129 } else {
9123 if (need_llvm_module(g) && g->link_objects.length != 0 && !g->enable_cache &&
9124 buf_eql_buf(o_basename, out_basename))
9125 {
91309126 // make it not collide with main output object
91319127 buf_append_str(o_basename, ".root");
9132 buf_append_str(o_basename, target_o_file_ext(g->zig_target));
9133 buf_append_str(out_basename, target_o_file_ext(g->zig_target));
91349128 }
9129 buf_append_str(o_basename, target_o_file_ext(g->zig_target));
9130 buf_append_str(out_basename, target_o_file_ext(g->zig_target));
91359131 break;
91369132 case OutTypeExe:
91379133 buf_append_str(o_basename, target_o_file_ext(g->zig_target));