ppTests Extend macro_LINE to catch more unusual behaviour seen in the wild.

This commit is contained in:
damc 2022-07-25 21:59:40 +02:00
parent 7236f51602
commit 2e77dbc38a
2 changed files with 47 additions and 10 deletions

View File

@ -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

View File

@ -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