diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-06 22:15:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-06 22:15:45 -0700 |
commit | 5f98a10cc78829a03c9fa5a137392e7d5e9030ac (patch) | |
tree | b88536e28f6d507c4b68b337423c0b6a4e28306c /021check_instruction.cc | |
parent | 75aa3a98e2b9311d65df91523ec754d5a2770456 (diff) | |
download | mu-5f98a10cc78829a03c9fa5a137392e7d5e9030ac.tar.gz |
2258 - separate warnings from errors
At the lowest level I'm reluctantly starting to see the need for errors that stop the program in its tracks. Only way to avoid memory corruption and security issues. But beyond that core I still want to be as lenient as possible at higher levels of abstraction.
Diffstat (limited to '021check_instruction.cc')
-rw-r--r-- | 021check_instruction.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc index bf238020..fcd861da 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -21,12 +21,12 @@ void check_instruction(const recipe_ordinal r) { // Primitive Recipe Checks case COPY: { if (SIZE(inst.products) != SIZE(inst.ingredients)) { - raise << "ingredients and products should match in '" << inst.to_string() << "'\n" << end(); + raise_error << "ingredients and products should match in '" << inst.to_string() << "'\n" << end(); break; } for (long long int i = 0; i < SIZE(inst.ingredients); ++i) { if (!types_match(inst.products.at(i), inst.ingredients.at(i))) { - raise << maybe(Recipe[r].name) << "can't copy " << inst.ingredients.at(i).original_string << " to " << inst.products.at(i).original_string << "; types don't match\n" << end(); + raise_error << maybe(Recipe[r].name) << "can't copy " << inst.ingredients.at(i).original_string << " to " << inst.products.at(i).original_string << "; types don't match\n" << end(); goto finish_checking_instruction; } } @@ -43,32 +43,32 @@ void check_instruction(const recipe_ordinal r) { } :(scenario copy_checks_reagent_count) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:number <- copy 34, 35 ] -+warn: ingredients and products should match in '1:number <- copy 34, 35' ++error: ingredients and products should match in '1:number <- copy 34, 35' :(scenario write_scalar_to_array_disallowed) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:array:number <- copy 34 ] -+warn: main: can't copy 34 to 1:array:number; types don't match ++error: main: can't copy 34 to 1:array:number; types don't match :(scenario write_scalar_to_array_disallowed_2) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:number, 2:array:number <- copy 34, 35 ] -+warn: main: can't copy 35 to 2:array:number; types don't match ++error: main: can't copy 35 to 2:array:number; types don't match :(scenario write_scalar_to_address_disallowed) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:address:number <- copy 34 ] -+warn: main: can't copy 34 to 1:address:number; types don't match ++error: main: can't copy 34 to 1:address:number; types don't match :(code) bool types_match(reagent lhs, reagent rhs) { |