Ignore DECLFILENAME on library files
This commit is contained in:
parent
dce245da5a
commit
809e5fda8a
|
|
@ -2414,7 +2414,9 @@ simulators.
|
|||
Warns that a module or other declaration's name doesn't match the filename
|
||||
with path and extension stripped that it is declared in. The filename a
|
||||
modules/interfaces/programs is declared in should match the name of the
|
||||
module etc. so that -y directory searching will work.
|
||||
module etc. so that -y directory searching will work. This warning is
|
||||
printed for only the first mismatching module in any given file, and -v
|
||||
library files are ignored.
|
||||
|
||||
Disabled by default as this is a code style warning, it will simulate
|
||||
correctly.
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <cctype>
|
||||
#include <unistd.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -79,6 +80,7 @@ private:
|
|||
bool m_inGenerate; // Inside a generate
|
||||
AstNodeModule* m_valueModp; // If set, move AstVar->valuep() initial values to this module
|
||||
vector<V3SymTable*> m_delSymps; // Symbol tables to delete
|
||||
set<string> m_declfnWarned; // Files we issued DECLFILENAME on
|
||||
|
||||
static int debug() {
|
||||
static int level = -1;
|
||||
|
|
@ -228,9 +230,14 @@ private:
|
|||
// Module: Create sim table for entire module and iterate
|
||||
UINFO(2,"Link Module: "<<nodep<<endl);
|
||||
if (m_idState == ID_FIND) {
|
||||
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()) {
|
||||
nodep->v3warn(DECLFILENAME, "Filename '"<<nodep->fileline()->filebasenameNoExt()
|
||||
<<"' does not match "<<nodep->typeName()<<" name: "<<nodep->prettyName());
|
||||
if (nodep->fileline()->filebasenameNoExt() != nodep->prettyName()
|
||||
&& !v3Global.opt.isLibraryFile(nodep->fileline()->filename())) {
|
||||
// We only complain once per file, otherwise library-like files have a huge mess of warnings
|
||||
if (m_declfnWarned.find(nodep->fileline()->filename()) == m_declfnWarned.end()) {
|
||||
m_declfnWarned.insert(nodep->fileline()->filename());
|
||||
nodep->v3warn(DECLFILENAME, "Filename '"<<nodep->fileline()->filebasenameNoExt()
|
||||
<<"' does not match "<<nodep->typeName()<<" name: "<<nodep->prettyName());
|
||||
}
|
||||
}
|
||||
}
|
||||
AstCell* upperCellp = m_cellp;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@ void V3Options::addFuture(const string& flag) {
|
|||
bool V3Options::isFuture(const string& flag) const {
|
||||
return m_futures.find(flag) != m_futures.end();
|
||||
}
|
||||
bool V3Options::isLibraryFile(const string& filename) const {
|
||||
return m_libraryFiles.find(filename) != m_libraryFiles.end();
|
||||
}
|
||||
|
||||
void V3Options::addLibraryFile(const string& filename) {
|
||||
if (m_libraryFiles.find(filename) == m_libraryFiles.end()) {
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ class V3Options {
|
|||
const V3LangCode& language() const { return m_language; }
|
||||
|
||||
bool isFuture(const string& flag) const;
|
||||
bool isLibraryFile(const string& filename) const;
|
||||
|
||||
// ACCESSORS (optimization options)
|
||||
bool oAcycSimp() const { return m_oAcycSimp; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue