aboutsummaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2021-02-21 20:53:56 +0000
committerGitHub <noreply@github.com>2021-02-21 20:53:56 +0000
commit3fee43cde0ec424e52ea62f78722b061aaac280a (patch)
treec3fe7d79380e9bf2c73c56543f5461715e0a0395 /frontends
parent127484e675538fbaeca1f6e53ba264a1f02e9cf6 (diff)
parent220cb1f7bbf6405117b953526c50a21a5ef5788f (diff)
downloadyosys-3fee43cde0ec424e52ea62f78722b061aaac280a.tar.gz
yosys-3fee43cde0ec424e52ea62f78722b061aaac280a.tar.bz2
yosys-3fee43cde0ec424e52ea62f78722b061aaac280a.zip
Merge pull request #2591 from zachjs/verilog-preproc-unapplied
verilog: error on macro invocations with missing argument lists
Diffstat (limited to 'frontends')
-rw-r--r--frontends/verilog/preproc.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/frontends/verilog/preproc.cc b/frontends/verilog/preproc.cc
index c451c4c20..de707593f 100644
--- a/frontends/verilog/preproc.cc
+++ b/frontends/verilog/preproc.cc
@@ -477,7 +477,16 @@ static bool try_expand_macro(define_map_t &defines, std::string &tok)
std::string name = tok.substr(1);
std::string skipped_spaces = skip_spaces();
tok = next_token(false);
- if (tok == "(" && body->has_args) {
+ if (body->has_args) {
+ if (tok != "(") {
+ if (tok.size() == 1 && iscntrl(tok[0])) {
+ char buf[5];
+ snprintf(buf, sizeof(buf), "\\x%02x", tok[0]);
+ tok = buf;
+ }
+ log_error("Expected to find '(' to begin macro arguments for '%s', but instead found '%s'\n",
+ name.c_str(), tok.c_str());
+ }
std::vector<std::string> args;
bool done = false;
while (!done) {