Report errors when extra underscores used in meta-comments.

This commit is contained in:
Wilson Snyder 2010-03-24 22:08:59 -04:00
parent 64719f3ace
commit 7c3048ab9c
4 changed files with 35 additions and 0 deletions

View File

@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Improve error handling on slices of arrays, bug226. [by Bryon Bradley] **** Improve error handling on slices of arrays, bug226. [by Bryon Bradley]
**** Report errors when extra underscores used in meta-comments.
**** Fix "make install" with configure outside srcdir. [Stefan Wallentowitz] **** Fix "make install" with configure outside srcdir. [Stefan Wallentowitz]
**** Fix trace files with empty modules crashing some viewers. **** Fix trace files with empty modules crashing some viewers.

View File

@ -323,9 +323,11 @@ void V3PreProcImp::comment(const string& text) {
if ((cp[0]=='v' || cp[0]=='V') if ((cp[0]=='v' || cp[0]=='V')
&& 0==(strncmp(cp+1,"erilator",8))) { && 0==(strncmp(cp+1,"erilator",8))) {
cp+=strlen("verilator"); cp+=strlen("verilator");
if (*cp == '_') fileline()->v3error("Extra underscore in meta-comment; use /*verilator {...}*/ not /*verilator_{...}*/");
} else if (0==(strncmp(cp,"synopsys",strlen("synopsys")))) { } else if (0==(strncmp(cp,"synopsys",strlen("synopsys")))) {
cp+=strlen("synopsys"); cp+=strlen("synopsys");
synth = true; synth = true;
if (*cp == '_') fileline()->v3error("Extra underscore in meta-comment; use /*synopsys {...}*/ not /*synopsys_{...}*/");
} else if (0==(strncmp(cp,"cadence",strlen("cadence")))) { } else if (0==(strncmp(cp,"cadence",strlen("cadence")))) {
cp+=strlen("cadence"); cp+=strlen("cadence");
synth = true; synth = true;

View File

@ -0,0 +1,22 @@
#!/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.
$Self->{vlt} or $Self->skip("Verilator only test");
compile (
verilator_flags2 => ["--lint-only"],
fails=>1,
expect=>
'%Error: t/t_pp_underline_bad.v:\d+: Extra underscore in meta-comment.*
%Error: Exiting due to.*',
);
ok(1);
1;

View File

@ -0,0 +1,9 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t;
// verilator_no_inline_module
initial $stop; // Should have failed
endmodule