diff options
author | Zachary Snow <zach@zachjs.com> | 2021-01-28 11:26:21 -0500 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2021-01-28 11:26:35 -0500 |
commit | 27257a419fe94e10f24eea916c56821e22e43cc5 (patch) | |
tree | e4f30ff6b441acbe2e07a2cc1785a2743081866d /frontends | |
parent | 98afe2b7589181c39281a6c58540f6756395e1d9 (diff) | |
download | yosys-27257a419fe94e10f24eea916c56821e22e43cc5.tar.gz yosys-27257a419fe94e10f24eea916c56821e22e43cc5.tar.bz2 yosys-27257a419fe94e10f24eea916c56821e22e43cc5.zip |
verilog: strip leading and trailing spaces in macro args
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/verilog/preproc.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/frontends/verilog/preproc.cc b/frontends/verilog/preproc.cc index 5a2804a41..c451c4c20 100644 --- a/frontends/verilog/preproc.cc +++ b/frontends/verilog/preproc.cc @@ -390,12 +390,16 @@ static void input_file(std::istream &f, std::string filename) // the argument list); false if we finished with ','. static bool read_argument(std::string &dest) { + skip_spaces(); std::vector<char> openers; for (;;) { std::string tok = next_token(true); if (tok == ")") { - if (openers.empty()) + if (openers.empty()) { + while (dest.size() && (dest.back() == ' ' || dest.back() == '\t')) + dest = dest.substr(0, dest.size() - 1); return true; + } if (openers.back() != '(') log_error("Mismatched brackets in macro argument: %c and %c.\n", openers.back(), tok[0]); |