From 05331766a971ecd1c3df236af0b374ae039b1142 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 25 Feb 2016 08:24:14 -0800 Subject: 2703 --- 043space.cc | 10 +++++----- 050scenario.cc | 2 +- 056recipe_header.cc | 12 ++++++------ 057static_dispatch.cc | 2 +- 059shape_shifting_recipe.cc | 2 +- 077hash.cc | 2 +- 091run_interactive.cc | 10 ++++------ 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/043space.cc b/043space.cc index a1c91a34..e068e874 100644 --- a/043space.cc +++ b/043space.cc @@ -247,12 +247,12 @@ void rewrite_default_space_instruction(instruction& curr) { //:: all recipes must set default-space one way or another :(before "End Globals") -bool Warn_on_missing_default_space = false; +bool Hide_missing_default_space_errors = true; :(before "End Checks") Transform.push_back(check_default_space); // idempotent :(code) void check_default_space(const recipe_ordinal r) { - if (!Warn_on_missing_default_space) return; // skip previous core tests; this is only for mu code + if (Hide_missing_default_space_errors) return; // skip previous core tests; this is only for mu code const recipe& caller = get(Recipe, r); // skip scenarios (later layer) // user code should never create recipes with underscores in their names @@ -269,11 +269,11 @@ void check_default_space(const recipe_ordinal r) { } } :(after "Load .mu Core") -Warn_on_missing_default_space = true; +Hide_missing_default_space_errors = false; :(after "Test Runs") -Warn_on_missing_default_space = false; +Hide_missing_default_space_errors = true; :(after "Running Main") -Warn_on_missing_default_space = true; +Hide_missing_default_space_errors = false; :(code) bool contains_non_special_name(const recipe_ordinal r) { diff --git a/050scenario.cc b/050scenario.cc index fa87541b..ae8f8684 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -111,7 +111,7 @@ long long int Num_core_mu_tests = 0; :(after "Check For .mu Files") Num_core_mu_tests = SIZE(Scenarios); :(before "End Tests") -Warn_on_missing_default_space = true; +Hide_missing_default_space_errors = false; time_t mu_time; time(&mu_time); cerr << "\nMu tests: " << ctime(&mu_time); for (long long int i = 0; i < SIZE(Scenarios); ++i) { diff --git a/056recipe_header.cc b/056recipe_header.cc index 01105e7a..e9b2a378 100644 --- a/056recipe_header.cc +++ b/056recipe_header.cc @@ -220,7 +220,7 @@ void check_calls_against_header(const recipe_ordinal r) { if (!types_coercible(callee.ingredients.at(i), inst.ingredients.at(i))) raise_error << maybe(caller.name) << "ingredient " << i << " has the wrong type at '" << to_string(inst) << "'\n" << end(); if (is_unique_address(inst.ingredients.at(i))) - raise_error << maybe(caller.name) << "try to avoid passing non-shared addresses into calls, like ingredient " << i << " at '" << to_string(inst) << "'\n" << end(); + raise_error << maybe(caller.name) << "avoid passing non-shared addresses into calls, like ingredient " << i << " at '" << to_string(inst) << "'\n" << end(); } for (long int i = 0; i < min(SIZE(inst.products), SIZE(callee.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; @@ -228,7 +228,7 @@ void check_calls_against_header(const recipe_ordinal r) { if (!types_coercible(inst.products.at(i), callee.products.at(i))) raise_error << maybe(caller.name) << "product " << i << " has the wrong type at '" << to_string(inst) << "'\n" << end(); if (is_unique_address(inst.products.at(i))) - raise_error << maybe(caller.name) << "try to avoid getting non-shared addresses out of calls, like product " << i << " at '" << to_string(inst) << "'\n" << end(); + raise_error << maybe(caller.name) << "avoid getting non-shared addresses out of calls, like product " << i << " at '" << to_string(inst) << "'\n" << end(); } } } @@ -241,19 +241,19 @@ bool is_unique_address(reagent x) { return x.type->right->value != get(Type_ordinal, "shared"); } -//: additionally, warn on calls receiving non-shared addresses +//: additionally, flag an error on calls receiving non-shared addresses :(scenario warn_on_calls_with_addresses) % Hide_errors = true; recipe main [ - 1:address:number <- copy 3/unsafe + 1:address:number <- copy 0 foo 1:address:number ] recipe foo x:address:number [ local-scope load-ingredients ] -+error: main: try to avoid passing non-shared addresses into calls, like ingredient 0 at 'foo 1: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) % Hide_errors = true; @@ -265,7 +265,7 @@ recipe foo -> x:address:number [ load-ingredients x <- copy 0 ] -+error: main: try to avoid getting non-shared addresses out of calls, like product 0 at '1:address:number <- foo ' ++error: main: avoid getting non-shared addresses out of calls, like product 0 at '1:address:number <- foo ' //:: Check types going in and out of all recipes with headers. diff --git a/057static_dispatch.cc b/057static_dispatch.cc index 313facce..2b64fdd0 100644 --- a/057static_dispatch.cc +++ b/057static_dispatch.cc @@ -15,7 +15,7 @@ recipe test a:number, b:number -> z:number [ +mem: storing 1 in location 7 //: When loading recipes, accumulate variants if headers don't collide, and -//: raise a warning if headers collide. +//: flag an error if headers collide. :(before "End Globals") map > Recipe_variants; diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc index 55f5f2b8..dbaa8503 100644 --- a/059shape_shifting_recipe.cc +++ b/059shape_shifting_recipe.cc @@ -329,7 +329,7 @@ void accumulate_type_ingredients(const reagent& exemplar_reagent, reagent& refin void accumulate_type_ingredients(const type_tree* exemplar_type, const type_tree* refinement_type, map& mappings, const recipe& exemplar, const reagent& exemplar_reagent, const instruction& call_instruction, const recipe& caller_recipe, bool* error) { if (!exemplar_type) return; if (!refinement_type) { - // todo: make this smarter; only warn if exemplar_type contains some *new* type ingredient + // todo: make this smarter; only flag an error if exemplar_type contains some *new* type ingredient raise_error << maybe(exemplar.name) << "missing type ingredient in " << exemplar_reagent.original_string << '\n' << end(); return; } diff --git a/077hash.cc b/077hash.cc index fc98fd3e..eb6879d1 100644 --- a/077hash.cc +++ b/077hash.cc @@ -120,7 +120,7 @@ size_t hash_mu_exclusive_container(size_t h, const reagent& r) { assert(r.type->value); long long int tag = get(Memory, r.value); reagent variant = variant_type(r, tag); - // todo: move this warning to container definition time + // todo: move this error to container definition time if (has_property(variant, "ignore-for-hash")) raise_error << get(Type, r.type->value).name << ": /ignore-for-hash won't work in exclusive containers\n" << end(); variant.set_value(r.value + /*skip tag*/1); diff --git a/091run_interactive.cc b/091run_interactive.cc index c4d67278..83a732da 100644 --- a/091run_interactive.cc +++ b/091run_interactive.cc @@ -111,7 +111,6 @@ bool run_interactive(long long int address) { void run_code_begin(bool snapshot_recently_added_recipes) { //? cerr << "loading new trace\n"; // stuff to undo later, in run_code_end() - Hide_warnings = true; Hide_errors = true; Disable_redefine_errors = true; if (snapshot_recently_added_recipes) { @@ -129,7 +128,6 @@ void run_code_begin(bool snapshot_recently_added_recipes) { void run_code_end() { //? cerr << "back to old trace\n"; - Hide_warnings = false; Hide_errors = false; Disable_redefine_errors = false; delete Trace_stream; @@ -225,15 +223,15 @@ case _MOST_RECENT_PRODUCTS: { } :(before "End Primitive Recipe Declarations") -SAVE_ERRORS_WARNINGS, +SAVE_ERRORS, :(before "End Primitive Recipe Numbers") -put(Recipe_ordinal, "save-errors", SAVE_ERRORS_WARNINGS); +put(Recipe_ordinal, "save-errors", SAVE_ERRORS); :(before "End Primitive Recipe Checks") -case SAVE_ERRORS_WARNINGS: { +case SAVE_ERRORS: { break; } :(before "End Primitive Recipe Implementations") -case SAVE_ERRORS_WARNINGS: { +case SAVE_ERRORS: { products.resize(1); products.at(0).push_back(trace_error_contents()); break; -- cgit 1.4.1-2-gfad0