Add suggestions on misspelled PLI functions.
This commit is contained in:
parent
b7345eb5d5
commit
981d3ce782
1
Changes
1
Changes
|
|
@ -21,6 +21,7 @@ Verilator 5.027 devel
|
||||||
* Support conditional constraints (#5245). [Arkadiusz Kozdra, Antmicro Ltd.]
|
* Support conditional constraints (#5245). [Arkadiusz Kozdra, Antmicro Ltd.]
|
||||||
* Add `--compiler-include` for additional C++ includes (#5139) (#5202). [Bartłomiej Chmiel, Antmicro Ltd.]
|
* Add `--compiler-include` for additional C++ includes (#5139) (#5202). [Bartłomiej Chmiel, Antmicro Ltd.]
|
||||||
* Add `--emit-accessors` (#5182) (#5227). [Ryan Ziegler]
|
* Add `--emit-accessors` (#5182) (#5227). [Ryan Ziegler]
|
||||||
|
* Add suggestions on misspelled PLI functions.
|
||||||
* Fix fusing macro arguments to not ignore whitespace (#5061). [Tudor Timi]
|
* Fix fusing macro arguments to not ignore whitespace (#5061). [Tudor Timi]
|
||||||
* Fix classes/modules of case-similar names (#5109). [Arkadiusz Kozdra]
|
* Fix classes/modules of case-similar names (#5109). [Arkadiusz Kozdra]
|
||||||
* Fix mis-removing $value$plusargs calls (#5127) (#5137). [Seth Pellegrino]
|
* Fix mis-removing $value$plusargs calls (#5127) (#5137). [Seth Pellegrino]
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
|
|
||||||
#include "V3Graph.h"
|
#include "V3Graph.h"
|
||||||
#include "V3MemberMap.h"
|
#include "V3MemberMap.h"
|
||||||
|
#include "V3Parse.h"
|
||||||
#include "V3String.h"
|
#include "V3String.h"
|
||||||
#include "V3SymTable.h"
|
#include "V3SymTable.h"
|
||||||
|
|
||||||
|
|
@ -3355,8 +3356,13 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
||||||
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
VSpellCheck speller;
|
||||||
|
V3Parse::candidatePli(&speller);
|
||||||
|
const string suggest = speller.bestCandidateMsg(nodep->prettyName());
|
||||||
nodep->v3error(
|
nodep->v3error(
|
||||||
"Unsupported or unknown PLI call: " << nodep->prettyNameQ());
|
"Unsupported or unknown PLI call: "
|
||||||
|
<< nodep->prettyNameQ() << '\n'
|
||||||
|
<< (suggest.empty() ? "" : nodep->warnMore() + suggest));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const string suggest = m_statep->suggestSymFallback(
|
const string suggest = m_statep->suggestSymFallback(
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ public:
|
||||||
|
|
||||||
// Push preprocessed text to the lexer
|
// Push preprocessed text to the lexer
|
||||||
static void ppPushText(V3ParseImp* impp, const string& text) VL_MT_DISABLED;
|
static void ppPushText(V3ParseImp* impp, const string& text) VL_MT_DISABLED;
|
||||||
|
|
||||||
|
// Suggest PLI functions for spell check
|
||||||
|
static void candidatePli(VSpellCheck* spellerp) VL_MT_DISABLED;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,17 @@ const char* V3ParseImp::tokenName(int token) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V3ParseImp::candidatePli(VSpellCheck* spellerp) {
|
||||||
|
#if !YYERROR_VERBOSE
|
||||||
|
#error "Need lex token names"
|
||||||
|
#endif
|
||||||
|
for (int i = 0; yytname[i]; ++i) {
|
||||||
|
if (yytname[i][0] != '\"') continue;
|
||||||
|
if (yytname[i][1] != '$') continue;
|
||||||
|
spellerp->pushCandidate(string{yytname[i]}.substr(1, strlen(yytname[i]) - 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void V3ParseImp::parserClear() {
|
void V3ParseImp::parserClear() {
|
||||||
// Clear up any dynamic memory V3Parser required
|
// Clear up any dynamic memory V3Parser required
|
||||||
VARDTYPE(nullptr);
|
VARDTYPE(nullptr);
|
||||||
|
|
|
||||||
|
|
@ -693,3 +693,4 @@ void V3Parse::parseFile(FileLine* fileline, const string& modname, bool inLibrar
|
||||||
void V3Parse::ppPushText(V3ParseImp* impp, const string& text) {
|
void V3Parse::ppPushText(V3ParseImp* impp, const string& text) {
|
||||||
if (text != "") impp->ppPushText(text);
|
if (text != "") impp->ppPushText(text);
|
||||||
}
|
}
|
||||||
|
void V3Parse::candidatePli(VSpellCheck* spellerp) { V3ParseImp::candidatePli(spellerp); }
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,7 @@ public:
|
||||||
void parseFile(FileLine* fileline, const string& modfilename, bool inLibrary,
|
void parseFile(FileLine* fileline, const string& modfilename, bool inLibrary,
|
||||||
const string& errmsg) VL_MT_DISABLED;
|
const string& errmsg) VL_MT_DISABLED;
|
||||||
void dumpInputsFile() VL_MT_DISABLED;
|
void dumpInputsFile() VL_MT_DISABLED;
|
||||||
|
static void candidatePli(VSpellCheck* spellerp) VL_MT_DISABLED;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void preprocDumps(std::ostream& os);
|
void preprocDumps(std::ostream& os);
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,12 @@
|
||||||
%Error: t/t_pli_bad.v:13:11: Unsupported or unknown PLI call: '$unknown_pli_function'
|
%Error: t/t_pli_bad.v:13:11: Unsupported or unknown PLI call: '$unknown_pli_function'
|
||||||
13 | i = $unknown_pli_function("arg", i);
|
13 | i = $unknown_pli_function("arg", i);
|
||||||
| ^~~~~~~~~~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~~~~~~~~~
|
||||||
|
%Error: t/t_pli_bad.v:15:7: Unsupported or unknown PLI call: '$sformatff'
|
||||||
|
: ... Suggested alternative: '$sformatf'
|
||||||
|
15 | $sformatff();
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
%Error: t/t_pli_bad.v:16:11: Unsupported or unknown PLI call: '$sformatff'
|
||||||
|
: ... Suggested alternative: '$sformatf'
|
||||||
|
16 | i = $sformatff();
|
||||||
|
| ^~~~~~~~~~
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ module t;
|
||||||
$unknown_pli_task("arg", i);
|
$unknown_pli_task("arg", i);
|
||||||
i = $unknown_pli_function;
|
i = $unknown_pli_function;
|
||||||
i = $unknown_pli_function("arg", i);
|
i = $unknown_pli_function("arg", i);
|
||||||
|
|
||||||
|
$sformatff(); // Typo
|
||||||
|
i = $sformatff(); // Typo
|
||||||
|
|
||||||
$stop;
|
$stop;
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue