Switch to control warnings.

This commit is contained in:
steve 2000-03-17 21:50:25 +00:00
parent 3adaf23aab
commit 48de739506
3 changed files with 52 additions and 7 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
/* /*
@ -33,8 +33,20 @@
# define INTEGER_WIDTH 32 # define INTEGER_WIDTH 32
#endif #endif
/*
* These are flags to enable various sorts of warnings. By default all
* the warnings are of, the -W<list> parameter arranges for each to be
* enabled.
*/
/* Implicit definitions of wires. */
extern bool warn_implicit;
/* /*
* $Log: compiler.h,v $ * $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 * Revision 1.2 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident. * Macintosh compilers do not support ident.
* *

View File

@ -17,12 +17,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
# include "PExpr.h" # include "PExpr.h"
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
# include "compiler.h"
/* /*
* Elaborating binary operations generally involves elaborating the * 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); sig = new NetNet(scope, path+"."+text_, NetNet::IMPLICIT, 1);
des->add_signal(sig); 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. */ /* Fine, create an implicit wire as an l-value. */
sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT, 1); sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT, 1);
des->add_signal(sig); 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); assert(sig);
@ -1353,6 +1360,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
/* /*
* $Log: elab_net.cc,v $ * $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 * Revision 1.25 2000/03/16 19:03:03 steve
* Revise the VVM backend to use nexus objects so that * Revise the VVM backend to use nexus objects so that
* drivers and resolution functions can be used, and * drivers and resolution functions can be used, and

25
main.cc
View File

@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
const char NOTICE[] = const char NOTICE[] =
@ -50,6 +50,7 @@ const char NOTICE[] =
# include "pform.h" # include "pform.h"
# include "netlist.h" # include "netlist.h"
# include "target.h" # include "target.h"
# include "compiler.h"
const char VERSION[] = "$Name: $ $State: Exp $"; const char VERSION[] = "$Name: $ $State: Exp $";
@ -58,6 +59,12 @@ string start_module = "";
map<string,string> flags; map<string,string> flags;
/*
* These are the warning enable flags.
*/
bool warn_implicit = false;
static void parm_to_flagmap(const string&flag) static void parm_to_flagmap(const string&flag)
{ {
string key, value; string key, value;
@ -118,6 +125,7 @@ int main(int argc, char*argv[])
const char* net_path = 0; const char* net_path = 0;
const char* out_path = 0; const char* out_path = 0;
const char* pf_path = 0; const char* pf_path = 0;
const char* warn_en = "";
int opt; int opt;
unsigned flag_errors = 0; unsigned flag_errors = 0;
queue<net_func> net_func_queue; queue<net_func> net_func_queue;
@ -165,6 +173,9 @@ int main(int argc, char*argv[])
cout << COPYRIGHT << endl; cout << COPYRIGHT << endl;
cout << endl << NOTICE << endl; cout << endl << NOTICE << endl;
return 0; return 0;
case 'W':
warn_en = optarg;
break;
default: default:
flag_errors += 1; flag_errors += 1;
break; break;
@ -188,6 +199,15 @@ int main(int argc, char*argv[])
return 1; 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. */ /* Parse the input. Make the pform. */
map<string,Module*> modules; map<string,Module*> modules;
map<string,PUdp*> primitives; map<string,PUdp*> primitives;
@ -287,6 +307,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.cc,v $ * $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 * Revision 1.29 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident. * Macintosh compilers do not support ident.
* *