diff --git a/src/script_opt/CPP/Driver.cc b/src/script_opt/CPP/Driver.cc index 61b4aca58e..7011a7d315 100644 --- a/src/script_opt/CPP/Driver.cc +++ b/src/script_opt/CPP/Driver.cc @@ -25,6 +25,13 @@ CPPCompile::CPPCompile(vector& _funcs, std::shared_ptr _ } Compile(report_uncompilable); + + if ( standalone && skipped_uncompilable_func && ! analysis_options.allow_cond ) { + reporter->Error( + "standalone C++ compilation incomplete due to having to skip some functions; use \"-O allow-cond\" to " + "override"); + exit(1); + } } CPPCompile::~CPPCompile() { fclose(write_file); } @@ -208,6 +215,7 @@ bool CPPCompile::AnalyzeFuncBody(FuncInfo& fi, unordered_set& filenames_ } fi.SetSkip(true); + skipped_uncompilable_func = true; } } @@ -252,6 +260,8 @@ bool CPPCompile::AnalyzeFuncBody(FuncInfo& fi, unordered_set& filenames_ } not_fully_compilable.insert(f->GetName()); + skipped_uncompilable_func = true; + return false; } diff --git a/src/script_opt/CPP/Driver.h b/src/script_opt/CPP/Driver.h index 6b17267aa8..d7a266ee7c 100644 --- a/src/script_opt/CPP/Driver.h +++ b/src/script_opt/CPP/Driver.h @@ -104,6 +104,9 @@ std::unordered_map hashed_funcs; // If true, the generated code should run "standalone". bool standalone = false; +// If true, compilation skipped at least one function due to non-compilability. +bool skipped_uncompilable_func = false; + // Hash over the functions in this compilation. This is only needed for // "seatbelts", to ensure that we can produce a unique hash relating to this // compilation (*and* its compilation time, which is why these are "seatbelts"