aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-20 18:33:36 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-03-20 18:33:36 -0400
commit3a2c4908891cdc9f64f0e94eb570ce084f8bc57c (patch)
tree406893c5de91823ce9da9191d5723e6a0df68e1c /src/main.cpp
parent8429ddecf89bf0e78b2e0143e9a4a6e7ba88a0fb (diff)
downloadzig-3a2c4908891cdc9f64f0e94eb570ce084f8bc57c.tar.gz
zig-3a2c4908891cdc9f64f0e94eb570ce084f8bc57c.zip
"generate .h files" feature is no longer supported in stage1
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 06d132da8b..76d6eadb14 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -54,7 +54,6 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" --cache-dir [path] override the local cache directory\n"
" --cache [auto|off|on] build in cache, print output path to stdout\n"
" --color [auto|off|on] enable or disable colored error messages\n"
- " --disable-gen-h do not generate a C header file (.h)\n"
" --disable-valgrind omit valgrind client requests in debug builds\n"
" --eh-frame-hdr enable C++ exception handling by passing --eh-frame-hdr to linker\n"
" --enable-valgrind include valgrind client requests release builds\n"
@@ -77,6 +76,8 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" -fno-emit-asm (default) do not output .s (assembly code)\n"
" -femit-llvm-ir produce a .ll file with LLVM IR\n"
" -fno-emit-llvm-ir (default) do not produce a .ll file with LLVM IR\n"
+ " -femit-h generate a C header file (.h)\n"
+ " -fno-emit-h (default) do not generate a C header file (.h)\n"
" --libc [file] Provide a file which specifies libc paths\n"
" --name [name] override output name\n"
" --output-dir [dir] override output directory (defaults to cwd)\n"
@@ -431,6 +432,7 @@ static int main0(int argc, char **argv) {
bool emit_bin = true;
bool emit_asm = false;
bool emit_llvm_ir = false;
+ bool emit_h = false;
const char *cache_dir = nullptr;
CliPkg *cur_pkg = heap::c_allocator.create<CliPkg>();
BuildMode build_mode = BuildModeDebug;
@@ -439,7 +441,6 @@ static int main0(int argc, char **argv) {
bool system_linker_hack = false;
TargetSubsystem subsystem = TargetSubsystemAuto;
bool want_single_threaded = false;
- bool disable_gen_h = false;
bool bundle_compiler_rt = false;
Buf *override_lib_dir = nullptr;
Buf *main_pkg_path = nullptr;
@@ -660,9 +661,7 @@ static int main0(int argc, char **argv) {
} else if (strcmp(arg, "--system-linker-hack") == 0) {
system_linker_hack = true;
} else if (strcmp(arg, "--single-threaded") == 0) {
- want_single_threaded = true;
- } else if (strcmp(arg, "--disable-gen-h") == 0) {
- disable_gen_h = true;
+ want_single_threaded = true;;
} else if (strcmp(arg, "--bundle-compiler-rt") == 0) {
bundle_compiler_rt = true;
} else if (strcmp(arg, "--test-cmd-bin") == 0) {
@@ -719,6 +718,11 @@ static int main0(int argc, char **argv) {
emit_llvm_ir = true;
} else if (strcmp(arg, "-fno-emit-llvm-ir") == 0) {
emit_llvm_ir = false;
+ } else if (strcmp(arg, "-femit-h") == 0) {
+ emit_h = true;
+ } else if (strcmp(arg, "-fno-emit-h") == 0 || strcmp(arg, "--disable-gen-h") == 0) {
+ // the --disable-gen-h is there to support godbolt. once they upgrade to -fno-emit-h then we can remove this
+ emit_h = false;
} else if (str_starts_with(arg, "-mcpu=")) {
mcpu = arg + strlen("-mcpu=");
} else if (i + 1 >= argc) {
@@ -1202,7 +1206,7 @@ static int main0(int argc, char **argv) {
g->verbose_cc = verbose_cc;
g->verbose_llvm_cpu_features = verbose_llvm_cpu_features;
g->output_dir = output_dir;
- g->disable_gen_h = disable_gen_h;
+ g->disable_gen_h = !emit_h;
g->bundle_compiler_rt = bundle_compiler_rt;
codegen_set_errmsg_color(g, color);
g->system_linker_hack = system_linker_hack;