Add support for `resetall compiler directive
authorClifford Wolf <clifford@clifford.at>
Wed, 26 Apr 2017 14:09:32 +0000 (16:09 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 26 Apr 2017 14:09:41 +0000 (16:09 +0200)
frontends/verilog/preproc.cc

index 41b5eac19f485e8bfe5d5c1eb5c0667b1c07f915..cf220fef908e2761d27799653c8d23c1b2eecc94 100644 (file)
@@ -438,6 +438,13 @@ std::string frontend_verilog_preproc(std::istream &f, std::string filename, cons
                        continue;
                }
 
+               if (tok == "`resetall") {
+                       defines_map.clear();
+                       defines_with_args.clear();
+                       global_defines_cache.clear();
+                       continue;
+               }
+
                if (tok.size() > 1 && tok[0] == '`' && defines_map.count(tok.substr(1)) > 0) {
                        std::string name = tok.substr(1);
                        // printf("expand: >>%s<< -> >>%s<<\n", name.c_str(), defines_map[name].c_str());