ppTests Extend macro_LINE to catch more unusual behaviour seen in the wild.
This commit is contained in:
parent
7236f51602
commit
2e77dbc38a
@ -1,6 +1,19 @@
|
|||||||
module a;
|
// __LINE__ = `__LINE__
|
||||||
initial begin
|
|
||||||
if (3 == 0) begin
|
// This block SHOULD be emitted from the preprocessor.
|
||||||
end
|
|
||||||
end
|
|
||||||
|
// 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
|
endmodule
|
||||||
|
@ -1,6 +1,30 @@
|
|||||||
module a;
|
// __LINE__ = `__LINE__
|
||||||
initial begin
|
|
||||||
if (`__LINE__ == 0) begin
|
`ifdef __LINE__
|
||||||
end
|
// This block SHOULD be emitted from the preprocessor.
|
||||||
end
|
`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
|
endmodule
|
||||||
|
Loading…
x
Reference in New Issue
Block a user