forked from github/verilator
Support # as a comment in -f files (#2497).
This commit is contained in:
parent
9a4c5509fc
commit
430238a6b4
2
Changes
2
Changes
@ -7,6 +7,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
**** Support const object new() assignments.
|
||||
|
||||
**** Support # as a comment in -f files (#2497). [phantom-killua]
|
||||
|
||||
|
||||
* Verilator 4.100 2020-09-07
|
||||
|
||||
|
@ -1587,6 +1587,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
||||
string oline;
|
||||
// cppcheck-suppress StlMissingComparison
|
||||
char lastch = ' ';
|
||||
bool space_begin = true; // At beginning or leading spaces only
|
||||
for (string::const_iterator pos = line.begin(); pos != line.end(); lastch = *pos++) {
|
||||
if (inCmt) {
|
||||
if (*pos == '*' && *(pos + 1) == '/') {
|
||||
@ -1596,11 +1597,15 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
||||
} else if (*pos == '/' && *(pos + 1) == '/'
|
||||
&& (pos == line.begin() || isspace(lastch))) { // But allow /file//path
|
||||
break; // Ignore to EOL
|
||||
} else if (*pos == '#' && space_begin) { // Only # at [spaced] begin of line
|
||||
break; // Ignore to EOL
|
||||
} else if (*pos == '/' && *(pos + 1) == '*') {
|
||||
inCmt = true;
|
||||
space_begin = false;
|
||||
// cppcheck-suppress StlMissingComparison
|
||||
++pos;
|
||||
} else {
|
||||
if (!isspace(*pos)) space_begin = false;
|
||||
oline += *pos;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Test that environment substitutions work
|
||||
# This is also a comment (in several simulators)
|
||||
-f $VERILATOR_ROOT/test_regress/t/t_flag_f__2.vc
|
||||
// Env var with .v file, and parens
|
||||
// Double slash below is intentional, as allowed in other tools
|
||||
|
Loading…
Reference in New Issue
Block a user