diff options
-rw-r--r-- | 003trace.cc | 16 | ||||
-rw-r--r-- | 011load.cc | 18 | ||||
-rw-r--r-- | 013update_operation.cc | 2 | ||||
-rw-r--r-- | 029tools.cc | 2 | ||||
-rw-r--r-- | 032array.cc | 2 | ||||
-rw-r--r-- | 033exclusive_container.cc | 2 | ||||
-rw-r--r-- | 050scenario.cc | 9 | ||||
-rw-r--r-- | 056recipe_header.cc | 4 | ||||
-rw-r--r-- | 091run_interactive.cc | 4 |
9 files changed, 24 insertions, 35 deletions
diff --git a/003trace.cc b/003trace.cc index d6a60985..9c17ccbd 100644 --- a/003trace.cc +++ b/003trace.cc @@ -91,15 +91,12 @@ struct trace_line { :(before "End Globals") const int Max_depth = 9999; -const int Error_depth = 0; // definitely always print the error that caused death -const int Warning_depth = 1; +const int Error_depth = 0; // definitely always print errors const int App_depth = 2; // temporarily where all mu code will trace to :(before "End Tracing") bool Hide_errors = false; -bool Hide_warnings = false; :(before "End Setup") Hide_errors = false; -Hide_warnings = false; :(before "End Tracing") struct trace_stream { @@ -134,8 +131,6 @@ struct trace_stream { past_lines.push_back(trace_line(curr_depth, trim(curr_label), curr_contents)); // preserve indent in contents if (!Hide_errors && curr_label == "error") cerr << curr_label << ": " << curr_contents << '\n'; - else if (!Hide_warnings && curr_label == "warn") - cerr << curr_label << ": " << curr_contents << '\n'; delete curr_stream; curr_stream = NULL; curr_label.clear(); @@ -161,14 +156,12 @@ trace_stream* Trace_stream = NULL; // Top-level helper. IMPORTANT: can't nest #define trace(...) !Trace_stream ? cerr /*print nothing*/ : Trace_stream->stream(__VA_ARGS__) -// Errors and warnings are special layers. -#define raise (!Trace_stream ? (tb_shutdown(),cerr) /*do print*/ : Trace_stream->stream(Warning_depth, "warn")) +// Errors are a special layer. #define raise_error (!Trace_stream ? (tb_shutdown(),cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error")) // Inside tests, fail any tests that displayed (unexpected) errors. // Expected errors in tests should always be hidden and silently checked for. :(before "End Test Teardown") -if (Passed && ((!Hide_errors && trace_count("error") > 0) - || (!Hide_warnings && trace_count("warn") > 0))) { +if (Passed && !Hide_errors && trace_count("error") > 0) { Passed = false; ++Num_failures; } @@ -370,8 +363,7 @@ using std::ofstream; //: In future layers we'll use the depth field as follows: //: //: Errors will be depth 0. -//: Warnings will be depth 1. -//: Mu 'applications' will be able to use depths 2-100 as they like. +//: Mu 'applications' will be able to use depths 1-100 as they like. //: Primitive statements will occupy 101-9989 const int Initial_callstack_depth = 101; const int Max_callstack_depth = 9989; diff --git a/011load.cc b/011load.cc index be0ca375..97af75f7 100644 --- a/011load.cc +++ b/011load.cc @@ -28,9 +28,9 @@ vector<recipe_ordinal> load(istream& in) { result.push_back(slurp_recipe(in)); } else if (command == "recipe!") { - Disable_redefine_errors = true; + Disable_redefine_checks = true; result.push_back(slurp_recipe(in)); - Disable_redefine_errors = false; + Disable_redefine_checks = false; } // End Command Handlers else { @@ -53,7 +53,7 @@ long long int slurp_recipe(istream& in) { put(Recipe_ordinal, result.name, Next_recipe_ordinal++); if (Recipe.find(get(Recipe_ordinal, result.name)) != Recipe.end()) { trace(9991, "parse") << "already exists" << end(); - if (warn_on_redefine(result.name)) + if (should_check_for_redefine(result.name)) raise_error << "redefining recipe " << result.name << "\n" << end(); Recipe.erase(get(Recipe_ordinal, result.name)); } @@ -208,12 +208,12 @@ void skip_comment(istream& in) { //: step on their own toes. But there'll be many occasions later where //: we'll want to disable the errors. :(before "End Globals") -bool Disable_redefine_errors = false; +bool Disable_redefine_checks = false; :(before "End Setup") -Disable_redefine_errors = false; +Disable_redefine_checks = false; :(code) -bool warn_on_redefine(const string& recipe_name) { - if (Disable_redefine_errors) return false; +bool should_check_for_redefine(const string& recipe_name) { + if (Disable_redefine_checks) return false; return true; } @@ -363,7 +363,7 @@ void test_parse_comment_terminated_by_eof() { cerr << "."; // termination = success } -:(scenario warn_on_redefine) +:(scenario forbid_redefining_recipes) % Hide_errors = true; recipe main [ 1:number <- copy 23 @@ -373,7 +373,7 @@ recipe main [ ] +error: redefining recipe main -:(scenario redefine_without_warning) +:(scenario permit_forcibly_redefining_recipes) % Hide_errors = true; recipe main [ 1:number <- copy 23 diff --git a/013update_operation.cc b/013update_operation.cc index da18252d..2504c336 100644 --- a/013update_operation.cc +++ b/013update_operation.cc @@ -21,7 +21,7 @@ void update_instruction_operations(recipe_ordinal r) { } } -// hook to suppress inserting recipe name into errors and warnings (for later layers) +// hook to suppress inserting recipe name into errors (for later layers) string maybe(string s) { return s + ": "; } diff --git a/029tools.cc b/029tools.cc index c379825a..4329818a 100644 --- a/029tools.cc +++ b/029tools.cc @@ -99,7 +99,6 @@ case HIDE_ERRORS: { :(before "End Primitive Recipe Implementations") case HIDE_ERRORS: { Hide_errors = true; - Hide_warnings = true; break; } @@ -114,7 +113,6 @@ case SHOW_ERRORS: { :(before "End Primitive Recipe Implementations") case SHOW_ERRORS: { Hide_errors = false; - Hide_warnings = false; break; } diff --git a/032array.cc b/032array.cc index 8adefe30..250e915b 100644 --- a/032array.cc +++ b/032array.cc @@ -126,7 +126,7 @@ container foo [ ] $error: 0 -:(scenario container_warns_on_dynamic_array_element) +:(scenario container_disallows_dynamic_array_element) % Hide_errors = true; container foo [ x:array:number diff --git a/033exclusive_container.cc b/033exclusive_container.cc index 7068ef18..9c300e29 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -181,7 +181,7 @@ exclusive-container foo [ ] $error: 0 -:(scenario exclusive_container_warns_on_dynamic_array_element) +:(scenario exclusive_container_disallows_dynamic_array_element) % Hide_errors = true; exclusive-container foo [ x:array:number diff --git a/050scenario.cc b/050scenario.cc index ae8f8684..2e09defd 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -150,8 +150,7 @@ void run_mu_scenario(const scenario& s) { bind_special_scenario_names(tmp.at(0)); transform_all(); run(tmp.front()); - if (Passed && ((!Hide_errors && trace_count("error") > 0) - || (!Hide_warnings && trace_count("warn") > 0))) { + if (Passed && !Hide_errors && trace_count("error") > 0) { Passed = false; ++Num_failures; } @@ -170,9 +169,9 @@ void run_mu_scenario(const scenario& s) { //: Watch out for redefinitions of scenario routines. We should never ever be //: doing that, regardless of anything else. :(scenarios run) -:(scenario warn_on_redefine_scenario) +:(scenario forbid_redefining_scenario_even_if_forced) % Hide_errors = true; -% Disable_redefine_errors = true; +% Disable_redefine_checks = true; recipe scenario-foo [ 1:number <- copy 34 ] @@ -182,7 +181,7 @@ recipe scenario-foo [ ] +error: redefining recipe scenario-foo -:(after "bool warn_on_redefine(const string& recipe_name)") +:(after "bool should_check_for_redefine(const string& recipe_name)") if (recipe_name.find("scenario-") == 0) return true; //:: The special instructions we want to support inside scenarios. diff --git a/056recipe_header.cc b/056recipe_header.cc index e9b2a378..0974e490 100644 --- a/056recipe_header.cc +++ b/056recipe_header.cc @@ -243,7 +243,7 @@ bool is_unique_address(reagent x) { //: additionally, flag an error on calls receiving non-shared addresses -:(scenario warn_on_calls_with_addresses) +:(scenario forbid_calls_with_nonshared_addresses) % Hide_errors = true; recipe main [ 1:address:number <- copy 0 @@ -255,7 +255,7 @@ recipe foo x:address:number [ ] +error: main: avoid passing non-shared addresses into calls, like ingredient 0 at 'foo 1:address:number' -:(scenario warn_on_calls_with_addresses_2) +:(scenario forbid_calls_with_nonshared_addresses_2) % Hide_errors = true; recipe main [ 1:address:number <- foo diff --git a/091run_interactive.cc b/091run_interactive.cc index 83a732da..e570dee2 100644 --- a/091run_interactive.cc +++ b/091run_interactive.cc @@ -112,7 +112,7 @@ void run_code_begin(bool snapshot_recently_added_recipes) { //? cerr << "loading new trace\n"; // stuff to undo later, in run_code_end() Hide_errors = true; - Disable_redefine_errors = true; + Disable_redefine_checks = true; if (snapshot_recently_added_recipes) { Save_recently_added_recipes = Recently_added_recipes; Recently_added_recipes.clear(); @@ -129,7 +129,7 @@ void run_code_begin(bool snapshot_recently_added_recipes) { void run_code_end() { //? cerr << "back to old trace\n"; Hide_errors = false; - Disable_redefine_errors = false; + Disable_redefine_checks = false; delete Trace_stream; Trace_stream = Save_trace_stream; Save_trace_stream = NULL; |