forked from github/verilator
Fix +1364-1995ext flags applying too late, bug1384.
This commit is contained in:
parent
b8ccb7a4c1
commit
b1831d7e33
2
Changes
2
Changes
@ -18,6 +18,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
**** Fix maintainer test when no Parallel::Forker, msg2630. [Enzo Chi]
|
||||
|
||||
**** Fix +1364-1995ext flags applying too late, bug1384. [Al Grant]
|
||||
|
||||
|
||||
* Verilator 4.010 2019-01-27
|
||||
|
||||
|
@ -91,6 +91,7 @@ protected:
|
||||
friend class V3ParseImp;
|
||||
friend class V3PreLex;
|
||||
friend class V3PreProcImp;
|
||||
friend class V3PreShellImp;
|
||||
void lineno(int num) { m_lineno = num; }
|
||||
void language(V3LangCode lang) { singleton().numberToLang(m_filenameno, lang); }
|
||||
void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); }
|
||||
|
@ -115,17 +115,6 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i
|
||||
m_fileline = new FileLine(fileline);
|
||||
m_inLibrary = inLibrary;
|
||||
|
||||
// Set language standard up front
|
||||
if (!v3Global.opt.preprocOnly()) {
|
||||
// Leting lex parse this saves us from having to specially en/decode
|
||||
// from the V3LangCode to the various Lex BEGIN states. The language
|
||||
// of this source file is updated here, in case there have been any
|
||||
// intervening +<lang>ext+ options since it was first ecountered.
|
||||
FileLine *modfileline = new FileLine(modfilename, 0);
|
||||
modfileline->language(v3Global.opt.fileLanguage(modfilename));
|
||||
ppPushText(string("`begin_keywords \"")+modfileline->language().ascii()+"\"\n");
|
||||
}
|
||||
|
||||
// Preprocess into m_ppBuffer
|
||||
bool ok = V3PreShell::preproc(fileline, modfilename, m_filterp, this, errmsg);
|
||||
if (!ok) {
|
||||
|
@ -102,8 +102,20 @@ protected:
|
||||
|
||||
// Preprocess
|
||||
s_filterp = filterp;
|
||||
bool ok = preprocOpen(fl, s_filterp, modname, "", errmsg);
|
||||
if (!ok) return false;
|
||||
string modfilename = preprocOpen(fl, s_filterp, modname, "", errmsg);
|
||||
if (modfilename.empty()) return false;
|
||||
|
||||
// Set language standard up front
|
||||
if (!v3Global.opt.preprocOnly()) {
|
||||
// Leting lex parse this saves us from having to specially en/decode
|
||||
// from the V3LangCode to the various Lex BEGIN states. The language
|
||||
// of this source file is updated here, in case there have been any
|
||||
// intervening +<lang>ext+ options since it was first ecountered.
|
||||
FileLine* modfileline = new FileLine(modfilename, 0);
|
||||
modfileline->language(v3Global.opt.fileLanguage(modfilename));
|
||||
V3Parse::ppPushText(parsep, (string("`begin_keywords \"")
|
||||
+modfileline->language().ascii()+"\"\n"));
|
||||
}
|
||||
|
||||
while (!s_preprocp->isEof()) {
|
||||
string line = s_preprocp->getline();
|
||||
@ -116,12 +128,15 @@ protected:
|
||||
if (modname[0]=='/' || modname[0]=='\\') {
|
||||
fl->v3warn(INCABSPATH,"Suggest `include with absolute path be made relative, and use +include: "<<modname);
|
||||
}
|
||||
preprocOpen(fl, s_filterp, modname, V3Os::filenameDir(fl->filename()), "Cannot find include file: ");
|
||||
preprocOpen(fl, s_filterp, modname, V3Os::filenameDir(fl->filename()),
|
||||
"Cannot find include file: ");
|
||||
}
|
||||
|
||||
bool preprocOpen(FileLine* fl, V3InFilter* filterp, const string& modname, const string& lastpath,
|
||||
const string& errmsg) { // Error message or "" to suppress
|
||||
// Returns true if successful
|
||||
private:
|
||||
string preprocOpen(FileLine* fl, V3InFilter* filterp,
|
||||
const string& modname, const string& lastpath,
|
||||
const string& errmsg) { // Error message or "" to suppress
|
||||
// Returns filename if successful
|
||||
// Try a pure name in case user has a bogus `filename they don't expect
|
||||
string filename = v3Global.opt.filePath(fl, modname, lastpath, errmsg);
|
||||
if (filename=="") {
|
||||
@ -131,13 +146,14 @@ protected:
|
||||
|
||||
filename = v3Global.opt.filePath(fl, ppmodname, lastpath, errmsg);
|
||||
}
|
||||
if (filename=="") return false; // Not found
|
||||
if (filename=="") return ""; // Not found
|
||||
|
||||
UINFO(2," Reading "<<filename<<endl);
|
||||
s_preprocp->openFile(fl, filterp, filename);
|
||||
return true;
|
||||
return filename;
|
||||
}
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
V3PreShellImp() {}
|
||||
~V3PreShellImp() {}
|
||||
|
18
test_regress/t/t_langext_order.pl
Executable file
18
test_regress/t/t_langext_order.pl
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
scenarios(simulator => 1);
|
||||
|
||||
# This is a compile only test.
|
||||
compile(
|
||||
v_flags2 => ["+1364-2005ext+v"],
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
12
test_regress/t/t_langext_order.v
Normal file
12
test_regress/t/t_langext_order.v
Normal file
@ -0,0 +1,12 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// A test of the +verilog2001ext+ and +verilog2005ext+ flags.
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Wilson Snyder.
|
||||
|
||||
// verilator lint_off SYMRSVDWORD
|
||||
|
||||
module t(input do);
|
||||
t_langext_order_sub sub (.do(do));
|
||||
endmodule
|
11
test_regress/t/t_langext_order_sub.v
Normal file
11
test_regress/t/t_langext_order_sub.v
Normal file
@ -0,0 +1,11 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// A test of the +verilog2001ext+ and +verilog2005ext+ flags.
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2019 by Wilson Snyder.
|
||||
|
||||
// verilator lint_off SYMRSVDWORD
|
||||
|
||||
module t_langext_order_sub(input do);
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user