mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
verilog: error on macro invocations with missing argument lists
This would previously complain about an undefined internal macro if the unapplied macro had not already been used. If it had, it would incorrectly use the arguments from the previous invocation.
This commit is contained in:
parent
127484e675
commit
220cb1f7bb
3 changed files with 32 additions and 1 deletions
17
tests/verilog/macro_unapplied.ys
Normal file
17
tests/verilog/macro_unapplied.ys
Normal file
|
@ -0,0 +1,17 @@
|
|||
logger -expect-no-warnings
|
||||
read_verilog -sv <<EOT
|
||||
`define MACRO(a = 1, b = 2) initial $display("MACRO(a = %d, b = %d)", a, b)
|
||||
module top;
|
||||
`MACRO();
|
||||
endmodule
|
||||
EOT
|
||||
|
||||
design -reset
|
||||
|
||||
logger -expect error "Expected to find '\(' to begin macro arguments for 'MACRO', but instead found ';'" 1
|
||||
read_verilog -sv <<EOT
|
||||
`define MACRO(a = 1, b = 2) initial $display("MACRO(a = %d, b = %d)", a, b)
|
||||
module top;
|
||||
`MACRO;
|
||||
endmodule
|
||||
EOT
|
5
tests/verilog/macro_unapplied_newline.ys
Normal file
5
tests/verilog/macro_unapplied_newline.ys
Normal file
|
@ -0,0 +1,5 @@
|
|||
logger -expect error "Expected to find '\(' to begin macro arguments for 'foo', but instead found '\\x0a'" 1
|
||||
read_verilog -sv <<EOT
|
||||
`define foo(a=1) (a)
|
||||
`foo
|
||||
EOT
|
Loading…
Add table
Add a link
Reference in a new issue