2704 - eradicate all mention of warnings from core
This commit is contained in:
parent
05331766a9
commit
a0b9fa55a0
16
003trace.cc
16
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;
|
||||
|
|
18
011load.cc
18
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
|
||||
|
|
|
@ -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 + ": ";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue