revert detection of rtti and exceptions

This caused link errors in c++ code because it was not correct to pass
these flags to child codegens. And that was the only reason to detect
these flags. Otherwise we can safely rely on non-explicitly-detected
flag forwarding.
This commit is contained in:
Andrew Kelley 2020-03-30 17:42:30 -04:00
parent 6408766d6b
commit cfedd3aca2
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
7 changed files with 4 additions and 92 deletions

View File

@ -2554,14 +2554,7 @@ flagpd1("femulated-tls"),
flagpd1("fencode-extended-block-signature"),
sepd1("ferror-limit"),
flagpd1("fescaping-block-tail-calls"),
.{
.name = "fexceptions",
.syntax = .flag,
.zig_equivalent = .exceptions,
.pd1 = true,
.pd2 = false,
.psl = false,
},
flagpd1("fexceptions"),
flagpd1("fexperimental-isel"),
flagpd1("fexperimental-new-constant-interpreter"),
flagpd1("fexperimental-new-pass-manager"),
@ -2765,14 +2758,7 @@ flagpd1("fno-elide-type"),
flagpd1("fno-eliminate-unused-debug-symbols"),
flagpd1("fno-emulated-tls"),
flagpd1("fno-escaping-block-tail-calls"),
.{
.name = "fno-exceptions",
.syntax = .flag,
.zig_equivalent = .no_exceptions,
.pd1 = true,
.pd2 = false,
.psl = false,
},
flagpd1("fno-exceptions"),
flagpd1("fno-experimental-isel"),
flagpd1("fno-experimental-new-pass-manager"),
flagpd1("fno-fast-math"),
@ -2861,14 +2847,7 @@ flagpd1("fno-rewrite-includes"),
flagpd1("fno-ropi"),
flagpd1("fno-rounding-math"),
flagpd1("fno-rtlib-add-rpath"),
.{
.name = "fno-rtti",
.syntax = .flag,
.zig_equivalent = .no_rtti,
.pd1 = true,
.pd2 = false,
.psl = false,
},
flagpd1("fno-rtti"),
flagpd1("fno-rtti-data"),
flagpd1("fno-rwpi"),
flagpd1("fno-sanitize-address-poison-custom-array-cookie"),
@ -3016,14 +2995,7 @@ flagpd1("fno-frontend-optimize"),
flagpd1("fropi"),
flagpd1("frounding-math"),
flagpd1("frtlib-add-rpath"),
.{
.name = "frtti",
.syntax = .flag,
.zig_equivalent = .rtti,
.pd1 = true,
.pd2 = false,
.psl = false,
},
flagpd1("frtti"),
flagpd1("frwpi"),
flagpd1("fsanitize-address-globals-dead-stripping"),
flagpd1("fsanitize-address-poison-custom-array-cookie"),

View File

@ -1286,10 +1286,6 @@ pub const ClangArgIterator = extern struct {
sanitize,
linker_script,
verbose_cmds,
exceptions,
no_exceptions,
rtti,
no_rtti,
for_linker,
linker_input_z,
};

View File

@ -2262,8 +2262,6 @@ struct CodeGen {
bool emit_asm;
bool emit_llvm_ir;
bool test_is_evented;
bool cpp_rtti;
bool cpp_exceptions;
CodeModel code_model;
Buf *root_out_name;

View File

@ -8784,8 +8784,6 @@ static Error define_builtin_compile_vars(CodeGen *g) {
cache_bool(&cache_hash, g->is_test_build);
cache_bool(&cache_hash, g->is_single_threaded);
cache_bool(&cache_hash, g->test_is_evented);
cache_bool(&cache_hash, g->cpp_rtti);
cache_bool(&cache_hash, g->cpp_exceptions);
cache_int(&cache_hash, g->code_model);
cache_int(&cache_hash, g->zig_target->is_native_os);
cache_int(&cache_hash, g->zig_target->is_native_cpu);
@ -9259,14 +9257,6 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
case CSourceKindAsm:
break;
}
if (source_kind == CSourceKindCpp) {
if (!g->cpp_rtti) {
args.append("-fno-rtti");
}
if (!g->cpp_exceptions) {
args.append("-fno-exceptions");
}
}
for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) {
args.append(g->zig_target->llvm_cpu_features_asm_ptr[i]);
}
@ -9714,8 +9704,6 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose
cache_bool(cache_hash, g->have_sanitize_c);
cache_bool(cache_hash, want_valgrind_support(g));
cache_bool(cache_hash, g->function_sections);
cache_bool(cache_hash, g->cpp_rtti);
cache_bool(cache_hash, g->cpp_exceptions);
cache_int(cache_hash, g->code_model);
for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) {
@ -10550,8 +10538,6 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
cache_bool(ch, g->emit_bin);
cache_bool(ch, g->emit_llvm_ir);
cache_bool(ch, g->emit_asm);
cache_bool(ch, g->cpp_rtti);
cache_bool(ch, g->cpp_exceptions);
cache_usize(ch, g->version_major);
cache_usize(ch, g->version_minor);
cache_usize(ch, g->version_patch);
@ -10856,8 +10842,6 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_global_cache_dir(), false, child_progress_node);
child_gen->root_out_name = buf_create_from_str(name);
child_gen->disable_gen_h = true;
child_gen->cpp_rtti = parent_gen->cpp_rtti;
child_gen->cpp_exceptions = parent_gen->cpp_exceptions;
child_gen->want_stack_check = WantStackCheckDisabled;
child_gen->want_sanitize_c = WantCSanitizeDisabled;
child_gen->verbose_tokenize = parent_gen->verbose_tokenize;

View File

@ -458,8 +458,6 @@ static int main0(int argc, char **argv) {
bool only_preprocess = false;
bool ensure_libc_on_non_freestanding = false;
bool ensure_libcpp_on_non_freestanding = false;
bool cpp_rtti = true;
bool cpp_exceptions = true;
ZigList<const char *> llvm_argv = {0};
llvm_argv.append("zig (LLVM option parsing)");
@ -724,18 +722,6 @@ static int main0(int argc, char **argv) {
verbose_cc = true;
verbose_link = true;
break;
case Stage2ClangArgExceptions:
cpp_exceptions = true;
break;
case Stage2ClangArgNoExceptions:
cpp_exceptions = false;
break;
case Stage2ClangArgRtti:
cpp_rtti = true;
break;
case Stage2ClangArgNoRtti:
cpp_rtti = false;
break;
case Stage2ClangArgForLinker:
linker_args.append(buf_create_from_str(it.only_arg));
break;
@ -1331,8 +1317,6 @@ static int main0(int argc, char **argv) {
LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));
link_lib->provided_explicitly = true;
}
g->cpp_rtti = cpp_rtti;
g->cpp_exceptions = cpp_exceptions;
g->subsystem = subsystem;
g->valgrind_support = valgrind_support;
g->want_pic = want_pic;
@ -1481,8 +1465,6 @@ static int main0(int argc, char **argv) {
}
CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,
override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node);
g->cpp_rtti = cpp_rtti;
g->cpp_exceptions = cpp_exceptions;
if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
g->valgrind_support = valgrind_support;
g->link_eh_frame_hdr = link_eh_frame_hdr;

View File

@ -345,10 +345,6 @@ enum Stage2ClangArg {
Stage2ClangArgSanitize,
Stage2ClangArgLinkerScript,
Stage2ClangArgVerboseCmds,
Stage2ClangArgExceptions,
Stage2ClangArgNoExceptions,
Stage2ClangArgRtti,
Stage2ClangArgNoRtti,
Stage2ClangArgForLinker,
Stage2ClangArgLinkerInputZ,
};

View File

@ -174,22 +174,6 @@ const known_options = [_]KnownOpt{
.name = "###",
.ident = "verbose_cmds",
},
.{
.name = "fexceptions",
.ident = "exceptions",
},
.{
.name = "fno-exceptions",
.ident = "no_exceptions",
},
.{
.name = "frtti",
.ident = "rtti",
},
.{
.name = "fno-rtti",
.ident = "no_rtti",
},
};
const blacklisted_options = [_][]const u8{};