Fix false EOFNEWLINE warning when DOS carriage returns present (#3171).

This commit is contained in:
Wilson Snyder 2021-10-13 21:21:51 -04:00
parent b64e89f7ed
commit b8f6b262e4
4 changed files with 6 additions and 5 deletions

View File

@ -24,6 +24,7 @@ Verilator 4.213 devel
* Fix cygwin compile error due to missing -std=gnu++14 (#3149). [Sun Kim]
* Fix missing install of vl_file_copy/vl_hier_graph (#3165). [Popolon]
* Fix calling new with arguments in same class (#3166). [Matthew Ballance]
* Fix false EOFNEWLINE warning when DOS carriage returns present (#3171).
Verilator 4.212 2021-09-01

View File

@ -824,9 +824,7 @@ void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filenam
for (const char* cp = sp; cp < ep; cp++) {
if (VL_UNLIKELY(*cp == '\r' || *cp == '\0')) {
strip = true;
break;
}
if (VL_UNLIKELY(*cp == '\n')) {
} else if (VL_UNLIKELY(*cp == '\n')) {
eof_newline = 0;
++eof_lineno;
} else {
@ -853,7 +851,7 @@ void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filenam
FileLine* fl = new FileLine{flsp};
fl->contentLineno(eof_lineno);
fl->column(eof_newline + 1, eof_newline + 1);
fl->v3warn(EOFNEWLINE, "Missing newline at end of file (POSIX 3.206)."
fl->v3warn(EOFNEWLINE, "Missing newline at end of file (POSIX 3.206).\n"
<< fl->warnMore() << "... Suggest add newline.");
}
}

View File

@ -11,6 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
compile(
verilator_flags2 => ['-Wall -Wno-DECLFILENAME'], # To check EOFNEWLINE with DOS CRs
);
execute(

View File

@ -1,4 +1,5 @@
%Warning-EOFNEWLINE: obj_vlt/t_lint_eofline_bad/t_lint_eofline_bad.v:4:10: Missing newline at end of file (POSIX 3.206). : ... Suggest add newline.
%Warning-EOFNEWLINE: obj_vlt/t_lint_eofline_bad/t_lint_eofline_bad.v:4:10: Missing newline at end of file (POSIX 3.206).
: ... Suggest add newline.
4 | endmodule
| ^
... For warning description see https://verilator.org/warn/EOFNEWLINE?v=latest