diff --git a/sv-parser-pp/testcases/expected/macro_LINE.sv b/sv-parser-pp/testcases/expected/macro_LINE.sv index c741818..46752cd 100644 --- a/sv-parser-pp/testcases/expected/macro_LINE.sv +++ b/sv-parser-pp/testcases/expected/macro_LINE.sv @@ -1,6 +1,19 @@ -module a; -initial begin - if (3 == 0) begin - end -end +// __LINE__ = `__LINE__ + +// This block SHOULD be emitted from the preprocessor. + + +// Emitted instead. + + +// The following define should have no effect. +`define __LINE__ -2 + +// The following undef should have no effect. +module M; + initial + if (26 == 28) // Should be "26 == 28". + $display("PASS"); + else if (28 == 28) // Should be "28 == 28". + $display("FAIL"); endmodule diff --git a/sv-parser-pp/testcases/macro_LINE.sv b/sv-parser-pp/testcases/macro_LINE.sv index 911ec70..76de077 100644 --- a/sv-parser-pp/testcases/macro_LINE.sv +++ b/sv-parser-pp/testcases/macro_LINE.sv @@ -1,6 +1,30 @@ -module a; -initial begin - if (`__LINE__ == 0) begin - end -end +// __LINE__ = `__LINE__ + +`ifdef __LINE__ +// This block SHOULD be emitted from the preprocessor. +`elsif UNDEFINED +// NOT emitted. +`endif + +`ifndef __LINE__ +// This block should NOT be emitted from the preprocessor. +// However, following (conditional) definition should make it through the +// preprocessor parsing stage without error. +`define __LINE__ -1 +`elsif UNDEFINED +// Emitted instead. +`endif + +// The following define should have no effect. +`define __LINE__ -2 + +// The following undef should have no effect. +`undef __LINE__ + +module M; + initial + if (`__LINE__ == 28) // Should be "26 == 28". + $display("PASS"); + else if (`__LINE__ == 28) // Should be "28 == 28". + $display("FAIL"); endmodule