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
7 changed files with 4 additions and 92 deletions

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;