From 3c1426e631c7c041d78d868a5623ca41ef703fba Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 16 Jan 2003 21:44:19 +0000 Subject: [PATCH] Detect duplicate module declarations. --- pform.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pform.cc b/pform.cc index 5c3453973..11ee70ea8 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.cc,v 1.104 2003/01/14 21:16:18 steve Exp $" +#ident "$Id: pform.cc,v 1.105 2003/01/16 21:44:19 steve Exp $" #endif # include "config.h" @@ -212,6 +212,16 @@ void pform_endmodule(const char*name) { assert(pform_cur_module); assert(strcmp(name, pform_cur_module->mod_name()) == 0); + + map::const_iterator test = pform_modules.find(name); + if (test != pform_modules.end()) { + ostringstream msg; + msg << "Module " << name << " was already declared here: " + << (*test).second->get_line() << endl; + VLerror(msg.str().c_str()); + pform_cur_module = 0; + return; + } pform_modules[name] = pform_cur_module; pform_cur_module = 0; } @@ -1360,6 +1370,9 @@ int pform_parse(const char*path, FILE*file) /* * $Log: pform.cc,v $ + * Revision 1.105 2003/01/16 21:44:19 steve + * Detect duplicate module declarations. + * * Revision 1.104 2003/01/14 21:16:18 steve * Move strstream to ostringstream for compatibility. *