Fix // in filenames, bug1610.

This commit is contained in:
Wilson Snyder 2019-11-20 21:23:03 -05:00
parent a86e1953eb
commit 99455a16bf
3 changed files with 8 additions and 3 deletions

View File

@ -22,6 +22,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix VPI timed callbacks to be one-shot, pull5. [Matthew Ballance]
**** Fix // in filenames, bug1610. [Peter Nelson]
* Verilator 4.022 2019-11-10

View File

@ -1247,13 +1247,15 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
// Strip simple comments
string oline;
// cppcheck-suppress StlMissingComparison
for (string::const_iterator pos = line.begin(); pos != line.end(); ++pos) {
char lastch = ' ';
for (string::const_iterator pos = line.begin(); pos != line.end(); lastch = *pos++) {
if (inCmt) {
if (*pos=='*' && *(pos+1)=='/') {
inCmt = false;
++pos;
}
} else if (*pos=='/' && *(pos+1)=='/') {
} else if (*pos=='/' && *(pos+1)=='/'
&& (pos == line.begin() || isspace(lastch))) { // But allow /file//path
break; // Ignore to EOL
} else if (*pos=='/' && *(pos+1)=='*') {
inCmt = true;

View File

@ -1,6 +1,7 @@
// Test that environment substitutions work
-f $VERILATOR_ROOT/test_regress/t/t_flag_f__2.vc
// Env var with .v file, and parens
${VERILATOR_ROOT}/test_regress/t/t_flag_f__3.v
// Double slash below is intentional, as allowed in other tools
${VERILATOR_ROOT}/test_regress/t//t_flag_f__3.v
// Test -f
-F $VERILATOR_ROOT/test_regress/t/tsub/t_flag_f_tsub.vc