Add -Wpedantic for compliance testing.

This commit is contained in:
Wilson Snyder
2019-11-16 11:59:21 -05:00
parent a481638edb
commit 47b5e36e60
13 changed files with 120 additions and 17 deletions
+17 -5
View File
@@ -175,12 +175,15 @@ void FileLine::lineDirective(const char* textp, int& enterExitRef) {
while (*textp && (isspace(*textp) || *textp=='"')) textp++;
// Grab linenumber
bool fail = false;
const char* ln = textp;
while (*textp && !isspace(*textp)) textp++;
if (isdigit(*ln)) {
lineno(atoi(ln));
}
while (*textp && (isspace(*textp) || *textp=='"')) textp++;
} else fail = true;
while (*textp && (isspace(*textp))) textp++;
if (*textp != '"') fail = true;
while (*textp && (isspace(*textp) || *textp == '"')) textp++;
// Grab filename
const char* fn = textp;
@@ -189,12 +192,21 @@ void FileLine::lineDirective(const char* textp, int& enterExitRef) {
string strfn = fn;
strfn = strfn.substr(0, textp-fn);
filename(strfn);
}
} else fail = true;
// Grab level
while (*textp && (isspace(*textp) || *textp=='"')) textp++;
if (isdigit(*textp)) enterExitRef = atoi(textp);
else enterExitRef = 0;
if (isdigit(*textp)) {
enterExitRef = atoi(textp);
if (enterExitRef >= 3) fail = true;
} else {
enterExitRef = 0;
fail = true;
}
if (fail && v3Global.opt.pedantic()) {
v3error("`line was not properly formed with '`line number \"filename\" level'\n");
}
//printf ("PPLINE %d '%s'\n", s_lineno, s_filename.c_str());
}