Fix preprocessor to show `line 2 on resumed file per IEEE.

This commit is contained in:
Wilson Snyder 2023-10-07 14:29:46 -04:00
parent e2343c03e0
commit 1d3d59243c
8 changed files with 29 additions and 28 deletions

View File

@ -33,6 +33,7 @@ Verilator 5.017 devel
* Fix 'this' in a constructor (#4533). [Ryszard Rozak, Antmicro Ltd.]
* Fix stream shift operator of 32 bits (#4536). [Julien Faucher]
* Fix inlining of real functions miscasting (#4543). [Andrew Nolte]
* Fix preprocessor to show `line 2 on resumed file.
Verilator 5.016 2023-09-16

View File

@ -583,7 +583,7 @@ string V3PreLex::endOfStream(bool& againr) {
} else if (curStreamp()->m_termState == 2) {
// Now ending `line
curStreamp()->m_termState = 3;
return curFilelinep()->lineDirectiveStrg(2); // Exit old file
return curFilelinep()->lineDirectiveStrg(0); // THe "2" exit is below
} else {
// Final shutdown phase for a stream, we can finally change the
// current fileline to the new stream
@ -603,7 +603,7 @@ string V3PreLex::endOfStream(bool& againr) {
if (curStreamp()->m_eof) {
return "";
} else {
return curFilelinep()->lineDirectiveStrg(0); // Reenter resumed file
return curFilelinep()->lineDirectiveStrg(2); // Reenter resumed file
}
}
}

View File

@ -1,3 +1,3 @@
`line 1 "obj_vlt/t_lint_eofline/t_lint_eofline_bad.v" 1
`line 2 "obj_vlt/t_lint_eofline/t_lint_eofline_bad.v" 2
`line 2 "obj_vlt/t_lint_eofline/t_lint_eofline_bad.v" 0

View File

@ -35,8 +35,8 @@ inc line 7;
inc line 8;
inc line 9;
`line 14 "t/t_pipe_filter_inc.vh" 2
`line 14 "t/t_pipe_filter.v" 0
`line 14 "t/t_pipe_filter_inc.vh" 0
`line 14 "t/t_pipe_filter.v" 2
`line 15 "t/t_pipe_filter.v" 0
@ -59,12 +59,12 @@ inc line 7;
inc line 8;
inc line 9;
`line 14 "t/t_pipe_filter_inc.vh" 2
`line 16 "t/t_pipe_filter.v" 0
`line 14 "t/t_pipe_filter_inc.vh" 0
`line 16 "t/t_pipe_filter.v" 2
`line 18 "t/t_pipe_filter.v" 0
example line 15;
example line 16;
`line 21 "t/t_pipe_filter.v" 2
`line 21 "t/t_pipe_filter.v" 0

View File

@ -13,5 +13,5 @@
`line 7 "t/t_pp_pragma_bad.v" 0
`pragma
`line 9 "t/t_pp_pragma_bad.v" 2
`line 9 "t/t_pp_pragma_bad.v" 0
%Error: Exiting due to

View File

@ -50,12 +50,12 @@ At file "t/t_preproc_inc2.vh" line 5
`line 110 "inc3_a_filename_from_line_directive" 2
`line 7 "t/t_preproc_inc2.vh" 0
`line 110 "inc3_a_filename_from_line_directive" 0
`line 7 "t/t_preproc_inc2.vh" 2
`line 9 "t/t_preproc_inc2.vh" 2
`line 10 "t/t_preproc.v" 0
`line 9 "t/t_preproc_inc2.vh" 0
`line 10 "t/t_preproc.v" 2
`line 12 "t/t_preproc.v" 0
@ -372,8 +372,8 @@ begin addr <= ({regs[6], regs[7]}); wdata <= (rdata); wr <= 1; end more
`line 6 "t/t_preproc_inc4.vh" 0
`line 8 "t/t_preproc_inc4.vh" 2
`line 236 "t/t_preproc.v" 0
`line 8 "t/t_preproc_inc4.vh" 0
`line 236 "t/t_preproc.v" 2
`line 237 "t/t_preproc.v" 0
@ -701,8 +701,8 @@ hello4hello4hello4hello4
`line 6 "t/t_preproc_inc4.vh" 0
`line 8 "t/t_preproc_inc4.vh" 2
`line 444 "t/t_preproc.v" 0
`line 8 "t/t_preproc_inc4.vh" 0
`line 444 "t/t_preproc.v" 2
`line 445 "t/t_preproc.v" 0
@ -1045,4 +1045,4 @@ predef 2 2
`line 729 "t/t_preproc.v" 2
`line 729 "t/t_preproc.v" 0

View File

@ -50,12 +50,12 @@ At file "t/t_preproc_inc2.vh" line 5
`line 110 "inc3_a_filename_from_line_directive" 2
`line 7 "t/t_preproc_inc2.vh" 0
`line 110 "inc3_a_filename_from_line_directive" 0
`line 7 "t/t_preproc_inc2.vh" 2
`line 9 "t/t_preproc_inc2.vh" 2
`line 10 "t/t_preproc.v" 0
`line 9 "t/t_preproc_inc2.vh" 0
`line 10 "t/t_preproc.v" 2
`line 12 "t/t_preproc.v" 0
@ -372,8 +372,8 @@ begin addr <= ({regs[6], regs[7]}); wdata <= (rdata); wr <= 1; end more
`line 6 "t/t_preproc_inc4.vh" 0
`line 8 "t/t_preproc_inc4.vh" 2
`line 236 "t/t_preproc.v" 0
`line 8 "t/t_preproc_inc4.vh" 0
`line 236 "t/t_preproc.v" 2
`line 237 "t/t_preproc.v" 0
@ -706,8 +706,8 @@ hello4hello4hello4hello4
`line 6 "t/t_preproc_inc4.vh" 0
`line 8 "t/t_preproc_inc4.vh" 2
`line 444 "t/t_preproc.v" 0
`line 8 "t/t_preproc_inc4.vh" 0
`line 444 "t/t_preproc.v" 2
`line 445 "t/t_preproc.v" 0
@ -1050,4 +1050,4 @@ predef 2 2
// After `undefineall above, for testing --dump-defines
`line 729 "t/t_preproc.v" 2
`line 729 "t/t_preproc.v" 0

View File

@ -84,4 +84,4 @@ HERE-72 - Line71
`line 74 "t/t_preproc_def09.v" 0
`line 76 "t/t_preproc_def09.v" 2
`line 76 "t/t_preproc_def09.v" 0