From 48de7395064be7ee382488b4b239c3c487d533c1 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Mar 2000 21:50:25 +0000 Subject: [PATCH] Switch to control warnings. --- compiler.h | 14 +++++++++++++- elab_net.cc | 20 +++++++++++++++----- main.cc | 25 ++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/compiler.h b/compiler.h index 2ef83f54f8..781d14f5c3 100644 --- a/compiler.h +++ b/compiler.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: compiler.h,v 1.2 2000/02/23 02:56:54 steve Exp $" +#ident "$Id: compiler.h,v 1.3 2000/03/17 21:50:25 steve Exp $" #endif /* @@ -33,8 +33,20 @@ # define INTEGER_WIDTH 32 #endif +/* + * These are flags to enable various sorts of warnings. By default all + * the warnings are of, the -W parameter arranges for each to be + * enabled. + */ + +/* Implicit definitions of wires. */ +extern bool warn_implicit; + /* * $Log: compiler.h,v $ + * Revision 1.3 2000/03/17 21:50:25 steve + * Switch to control warnings. + * * Revision 1.2 2000/02/23 02:56:54 steve * Macintosh compilers do not support ident. * diff --git a/elab_net.cc b/elab_net.cc index e415c05ccc..1d75e3507e 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -17,12 +17,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: elab_net.cc,v 1.25 2000/03/16 19:03:03 steve Exp $" +#ident "$Id: elab_net.cc,v 1.26 2000/03/17 21:50:25 steve Exp $" #endif # include "PExpr.h" # include "netlist.h" # include "netmisc.h" +# include "compiler.h" /* * Elaborating binary operations generally involves elaborating the @@ -857,8 +858,11 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path, sig = new NetNet(scope, path+"."+text_, NetNet::IMPLICIT, 1); des->add_signal(sig); - cerr << get_line() << ": warning: Implicitly defining " - "wire " << path << "." << text_ << "." << endl; + + if (warn_implicit) + cerr << get_line() << ": warning: implicit " + " definition of wire " << path << "." << + text_ << "." << endl; } } @@ -998,8 +1002,11 @@ NetNet* PEIdent::elaborate_lnet(Design*des, const string&path) const /* Fine, create an implicit wire as an l-value. */ sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT, 1); des->add_signal(sig); - cerr << get_line() << ": warning: Implicitly defining " - "wire " << path << "." << text_ << "." << endl; + + if (warn_implicit) + cerr << get_line() << ": warning: implicit " + " definition of wire " << path << "." << + text_ << "." << endl; } assert(sig); @@ -1353,6 +1360,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path, /* * $Log: elab_net.cc,v $ + * Revision 1.26 2000/03/17 21:50:25 steve + * Switch to control warnings. + * * Revision 1.25 2000/03/16 19:03:03 steve * Revise the VVM backend to use nexus objects so that * drivers and resolution functions can be used, and diff --git a/main.cc b/main.cc index aa08b307c0..624b26a3a8 100644 --- a/main.cc +++ b/main.cc @@ -19,7 +19,7 @@ const char COPYRIGHT[] = * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: main.cc,v 1.29 2000/02/23 02:56:54 steve Exp $" +#ident "$Id: main.cc,v 1.30 2000/03/17 21:50:25 steve Exp $" #endif const char NOTICE[] = @@ -50,6 +50,7 @@ const char NOTICE[] = # include "pform.h" # include "netlist.h" # include "target.h" +# include "compiler.h" const char VERSION[] = "$Name: $ $State: Exp $"; @@ -58,6 +59,12 @@ string start_module = ""; map flags; +/* + * These are the warning enable flags. + */ +bool warn_implicit = false; + + static void parm_to_flagmap(const string&flag) { string key, value; @@ -118,6 +125,7 @@ int main(int argc, char*argv[]) const char* net_path = 0; const char* out_path = 0; const char* pf_path = 0; + const char* warn_en = ""; int opt; unsigned flag_errors = 0; queue net_func_queue; @@ -165,6 +173,9 @@ int main(int argc, char*argv[]) cout << COPYRIGHT << endl; cout << endl << NOTICE << endl; return 0; + case 'W': + warn_en = optarg; + break; default: flag_errors += 1; break; @@ -188,6 +199,15 @@ int main(int argc, char*argv[]) return 1; } + /* Scan the warnings enable string for warning flags. */ + for (const char*cp = warn_en ; *cp ; cp += 1) switch (*cp) { + case 'i': + warn_implicit = true; + break; + default: + break; + } + /* Parse the input. Make the pform. */ map modules; map primitives; @@ -287,6 +307,9 @@ int main(int argc, char*argv[]) /* * $Log: main.cc,v $ + * Revision 1.30 2000/03/17 21:50:25 steve + * Switch to control warnings. + * * Revision 1.29 2000/02/23 02:56:54 steve * Macintosh compilers do not support ident. *