From af38e8d38731dc8bbd1e69afafefe636d6d3b451 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 14 Jan 2020 07:33:12 -0500 Subject: [PATCH] Improve error on > 127 char modnames. #2106. --- src/V3Options.cpp | 7 +++- test_regress/t/t_inst_long_bad.out | 6 +++ test_regress/t/t_inst_long_bad.pl | 60 ++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 test_regress/t/t_inst_long_bad.out create mode 100755 test_regress/t/t_inst_long_bad.pl diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 184d92c5b..455050a66 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -374,7 +374,12 @@ string V3Options::filePath(FileLine* fl, const string& modname, const string& la void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) { static bool shown_notfound_msg = false; - if (!shown_notfound_msg) { + if (modname.find("__Vhsh") != string::npos) { + std::cerr << V3Error::warnMore() << "... Unsupported: Name is longer than 127 characters;" + << " automatic file lookup not supported.\n"; + std::cerr << V3Error::warnMore() << "... Suggest putting filename with this module/package" + << " onto command line instead.\n"; + } else if (!shown_notfound_msg) { shown_notfound_msg = true; if (m_impp->m_incDirUsers.empty()) { fl->v3error("This may be because there's no search path specified with -I."< 1); + +my $length = 200; +my $long = "long_" x (($length + 4) / 5); + +sub gen_top { + my $filename = shift; + + my $fh = IO::File->new(">$filename") + or $Self->error("Can't write $filename"); + $fh->print("// Generated by t_inst_long.pl\n"); + $fh->print("module t;\n"); + $fh->print("\n"); + $fh->print(" ${long} inst ();\n"); + $fh->print("\n"); + $fh->print("endmodule\n"); + $fh->close; +} + +sub gen_sub { + my $filename = shift; + + my $fh = IO::File->new(">$filename") + or $Self->error("Can't write $filename"); + $fh->print("// Generated by t_inst_long.pl\n"); + $fh->print("module ${long};\n"); + $fh->print("\n"); + $fh->print(" initial begin\n"); + $fh->print(" \$write(\"*-* All Finished *-*\\n\");\n"); + $fh->print(" \$finish;\n"); + $fh->print(" end\n"); + $fh->print("endmodule\n"); + $fh->close; +} + +top_filename("$Self->{obj_dir}/t_inst_long.v", $long); + +gen_top($Self->{top_filename}); +gen_sub("$Self->{obj_dir}/${long}.v"); + +lint( + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1;