about summary refs log tree commit diff stats
path: root/046closure_name.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-06 22:15:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-06 22:15:45 -0700
commit5f98a10cc78829a03c9fa5a137392e7d5e9030ac (patch)
treeb88536e28f6d507c4b68b337423c0b6a4e28306c /046closure_name.cc
parent75aa3a98e2b9311d65df91523ec754d5a2770456 (diff)
downloadmu-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 '046closure_name.cc')
-rw-r--r--046closure_name.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/046closure_name.cc b/046closure_name.cc
index eef4753f..82ba5db3 100644
--- a/046closure_name.cc
+++ b/046closure_name.cc
@@ -50,19 +50,19 @@ void collect_surrounding_spaces(const recipe_ordinal r) {
           || inst.products.at(j).types.at(0) != Type_ordinal["address"]
           || inst.products.at(j).types.at(1) != Type_ordinal["array"]
           || inst.products.at(j).types.at(2) != Type_ordinal["location"]) {
-        raise << "slot 0 should always have type address:array:location, but is " << inst.products.at(j).to_string() << '\n' << end();
+        raise_error << "slot 0 should always have type address:array:location, but is " << inst.products.at(j).to_string() << '\n' << end();
         continue;
       }
       vector<string> s = property(inst.products.at(j), "names");
       if (s.empty()) {
-        raise << "slot 0 requires a /names property in recipe " << Recipe[r].name << end();
+        raise_error << "slot 0 requires a /names property in recipe " << Recipe[r].name << end();
         continue;
       }
-      if (SIZE(s) > 1) raise << "slot 0 should have a single value in /names, but got " << inst.products.at(j).to_string() << '\n' << end();
+      if (SIZE(s) > 1) raise_error << "slot 0 should have a single value in /names, but got " << inst.products.at(j).to_string() << '\n' << end();
       string surrounding_recipe_name = s.at(0);
       if (Surrounding_space.find(r) != Surrounding_space.end()
           && Surrounding_space[r] != Recipe_ordinal[surrounding_recipe_name]) {
-        raise << "recipe " << Recipe[r].name << " can have only one 'surrounding' recipe but has " << Recipe[Surrounding_space[r]].name << " and " << surrounding_recipe_name << '\n' << end();
+        raise_error << "recipe " << Recipe[r].name << " can have only one 'surrounding' recipe but has " << Recipe[Surrounding_space[r]].name << " and " << surrounding_recipe_name << '\n' << end();
         continue;
       }
       trace("name") << "recipe " << Recipe[r].name << " is surrounded by " << surrounding_recipe_name << end();
@@ -77,11 +77,11 @@ void collect_surrounding_spaces(const recipe_ordinal r) {
 :(replace{} "long long int lookup_name(const reagent& r, const recipe_ordinal default_recipe)")
 long long int lookup_name(const reagent& x, const recipe_ordinal default_recipe) {
   if (!has_property(x, "space")) {
-    if (Name[default_recipe].empty()) raise << "name not found: " << x.name << '\n' << end();
+    if (Name[default_recipe].empty()) raise_error << "name not found: " << x.name << '\n' << end();
     return Name[default_recipe][x.name];
   }
   vector<string> p = property(x, "space");
-  if (SIZE(p) != 1) raise << "/space property should have exactly one (non-negative integer) value\n" << end();
+  if (SIZE(p) != 1) raise_error << "/space property should have exactly one (non-negative integer) value\n" << end();
   long long int n = to_integer(p.at(0));
   assert(n >= 0);
   recipe_ordinal surrounding_recipe = lookup_surrounding_recipe(default_recipe, n);
@@ -95,11 +95,11 @@ long long int lookup_name(const reagent& x, const recipe_ordinal default_recipe)
 long long int lookup_name(const reagent& x, const recipe_ordinal r, set<recipe_ordinal>& done, vector<recipe_ordinal>& path) {
   if (!Name[r].empty()) return Name[r][x.name];
   if (done.find(r) != done.end()) {
-    raise << "can't compute address of " << x.to_string() << " because " << end();
+    raise_error << "can't compute address of " << x.to_string() << " because " << end();
     for (long long int i = 1; i < SIZE(path); ++i) {
-      raise << path.at(i-1) << " requires computing names of " << path.at(i) << '\n' << end();
+      raise_error << path.at(i-1) << " requires computing names of " << path.at(i) << '\n' << end();
     }
-    raise << path.at(SIZE(path)-1) << " requires computing names of " << r << "..ad infinitum\n" << end();
+    raise_error << path.at(SIZE(path)-1) << " requires computing names of " << r << "..ad infinitum\n" << end();
     return 0;
   }
   done.insert(r);
@@ -112,20 +112,20 @@ long long int lookup_name(const reagent& x, const recipe_ordinal r, set<recipe_o
 recipe_ordinal lookup_surrounding_recipe(const recipe_ordinal r, long long int n) {
   if (n == 0) return r;
   if (Surrounding_space.find(r) == Surrounding_space.end()) {
-    raise << "don't know surrounding recipe of " << Recipe[r].name << '\n' << end();
+    raise_error << "don't know surrounding recipe of " << Recipe[r].name << '\n' << end();
     return 0;
   }
   assert(Surrounding_space[r]);
   return lookup_surrounding_recipe(Surrounding_space[r], n-1);
 }
 
-//: weaken use-before-set warnings just a tad
+//: weaken use-before-set detection just a tad
 :(replace{} "bool already_transformed(const reagent& r, const map<string, long long int>& names)")
 bool already_transformed(const reagent& r, const map<string, long long int>& names) {
   if (has_property(r, "space")) {
     vector<string> p = property(r, "space");
     if (SIZE(p) != 1) {
-      raise << "/space property should have exactly one (non-negative integer) value in " << r.original_string << '\n' << end();
+      raise_error << "/space property should have exactly one (non-negative integer) value in " << r.original_string << '\n' << end();
       return false;
     }
     if (p.at(0) != "0") return true;