diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-24 20:41:39 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-24 20:41:39 -0700 |
commit | 7e423e268bd0a07f43f5114eb015548d04331eb2 (patch) | |
tree | 4ef48f9ed6ba64f8bbbd451bef95f6c14252d085 | |
parent | cd1e0c811fae4c50c772aea558b3c07fefef2e2a (diff) | |
download | mu-7e423e268bd0a07f43f5114eb015548d04331eb2.tar.gz |
1841 - reenable old layers
-rw-r--r-- | 011load.cc | 17 | ||||
-rw-r--r-- | 081run_interactive.cc | 8 |
2 files changed, 16 insertions, 9 deletions
diff --git a/011load.cc b/011load.cc index 0ae42cf5..7ce8e25f 100644 --- a/011load.cc +++ b/011load.cc @@ -33,9 +33,7 @@ vector<recipe_ordinal> load(istream& in) { if (Recipe_ordinal.find(recipe_name) == Recipe_ordinal.end()) { Recipe_ordinal[recipe_name] = Next_recipe_ordinal++; } - if (Recipe.find(Recipe_ordinal[recipe_name]) != Recipe.end()) { - if (!Loading_interactive) raise << "redefining recipe " << Recipe[Recipe_ordinal[recipe_name]].name << "\n"; - } + // Warn On Redefinition // todo: save user-defined recipes to mu's memory Recipe[Recipe_ordinal[recipe_name]] = slurp_recipe(in); //? cerr << Recipe_ordinal[recipe_name] << ": " << recipe_name << '\n'; //? 1 @@ -196,6 +194,19 @@ void skip_comma(istream& in) { skip_whitespace(in); } +//: Warn if a recipe gets redefined, because large codebases can accidentally +//: step on their own toes. But there'll be many occasions later where +//: we'll want to disable the warnings. +:(before "End Globals") +bool Hide_redefine_warnings = false; +:(before "End Setup") +Hide_redefine_warnings = false; +:(after "Warn On Redefinition") +if (!Hide_redefine_warnings + && Recipe.find(Recipe_ordinal[recipe_name]) != Recipe.end()) { + raise << "redefining recipe " << Recipe[Recipe_ordinal[recipe_name]].name << "\n"; +} + // for debugging :(before "End Globals") bool Show_rest_of_stream = false; diff --git a/081run_interactive.cc b/081run_interactive.cc index f7d049ff..36a0ec1a 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -257,10 +257,6 @@ long long int warnings_from_trace() { //: simpler version of run-interactive: doesn't do any running, just loads //: recipes and reports warnings. -:(before "End Globals") -bool Loading_interactive = false; -:(before "End Setup") -Loading_interactive = false; :(before "End Primitive Recipe Declarations") RELOAD, :(before "End Primitive Recipe Numbers") @@ -273,13 +269,13 @@ case RELOAD: { Trace_stream = new trace_stream; Trace_stream->collect_layer = "warn"; } - Loading_interactive = true; Hide_warnings = true; + Hide_redefine_warnings = true; load(read_mu_string(ingredients.at(0).at(0))); transform_all(); Trace_stream->newline(); // flush trace + Hide_redefine_warnings = false; Hide_warnings = false; - Loading_interactive = false; products.resize(1); products.at(0).push_back(warnings_from_trace()); if (Trace_stream->collect_layer == "warn") { |