Check for missing concat subexpressions (PR#11)

This commit is contained in:
steve 2000-10-14 02:23:02 +00:00
parent 06f5482631
commit f526d235d1
3 changed files with 27 additions and 11 deletions

View File

@ -17,7 +17,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: elab_net.cc,v 1.50 2000/10/08 04:59:36 steve Exp $" #ident "$Id: elab_net.cc,v 1.51 2000/10/14 02:23:02 steve Exp $"
#endif #endif
# include "PExpr.h" # include "PExpr.h"
@ -925,6 +925,13 @@ NetNet* PEConcat::elaborate_net(Design*des, const string&path,
/* Elaborate the operands of the concatenation. */ /* Elaborate the operands of the concatenation. */
for (unsigned idx = 0 ; idx < nets.count() ; idx += 1) { for (unsigned idx = 0 ; idx < nets.count() ; idx += 1) {
if (parms_[idx] == 0) {
cerr << get_line() << ": error: Empty expressions "
<< "not allowed in concatenations." << endl;
errors += 1;
continue;
}
/* Look for the special case of an unsized number in a /* Look for the special case of an unsized number in a
concatenation expression. Mark this as an error, but concatenation expression. Mark this as an error, but
allow elaboration to continue to see if I can find allow elaboration to continue to see if I can find
@ -1745,6 +1752,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
/* /*
* $Log: elab_net.cc,v $ * $Log: elab_net.cc,v $
* Revision 1.51 2000/10/14 02:23:02 steve
* Check for missing concat subexpressions (PR#11)
*
* Revision 1.50 2000/10/08 04:59:36 steve * Revision 1.50 2000/10/08 04:59:36 steve
* Fix repeat concatenation with multiple expressions (PR#10) * Fix repeat concatenation with multiple expressions (PR#10)
* *

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: parse.y,v 1.106 2000/09/23 03:04:10 steve Exp $" #ident "$Id: parse.y,v 1.107 2000/10/14 02:23:02 steve Exp $"
#endif #endif
# include "parse_misc.h" # include "parse_misc.h"
@ -732,7 +732,7 @@ expression_list
{ svector<PExpr*>*tmp = new svector<PExpr*>(*$1, 0); { svector<PExpr*>*tmp = new svector<PExpr*>(*$1, 0);
delete $1; delete $1;
$$ = tmp; $$ = tmp;
} }
; ;
@ -803,8 +803,8 @@ expr_primary
{ $$ = $2; } { $$ = $2; }
| '{' expression_list '}' | '{' expression_list '}'
{ PEConcat*tmp = new PEConcat(*$2); { PEConcat*tmp = new PEConcat(*$2);
tmp->set_file(@2.text); tmp->set_file(@1.text);
tmp->set_lineno(@2.first_line); tmp->set_lineno(@1.first_line);
delete $2; delete $2;
$$ = tmp; $$ = tmp;
} }

View File

@ -17,7 +17,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: pform_dump.cc,v 1.61 2000/07/26 05:08:07 steve Exp $" #ident "$Id: pform_dump.cc,v 1.62 2000/10/14 02:23:02 steve Exp $"
#endif #endif
/* /*
@ -83,9 +83,12 @@ void PEConcat::dump(ostream&out) const
return; return;
} }
out << "{" << *parms_[0]; out << "{";
for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) if (parms_[0]) out << *parms_[0];
out << ", " << *parms_[idx]; for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) {
out << ", ";
if (parms_[idx]) out << *parms_[idx];
}
out << "}"; out << "}";
@ -97,10 +100,10 @@ void PECallFunction::dump(ostream &out) const
out << name_ << "("; out << name_ << "(";
if (parms_.count() > 0) { if (parms_.count() > 0) {
parms_[0]->dump(out); if (parms_[0]) parms_[0]->dump(out);
for (unsigned idx = 1; idx < parms_.count(); ++idx) { for (unsigned idx = 1; idx < parms_.count(); ++idx) {
out << ", "; out << ", ";
parms_[idx]->dump(out); if (parms_[idx]) parms_[idx]->dump(out);
} }
} }
out << ")"; out << ")";
@ -780,6 +783,9 @@ void PUdp::dump(ostream&out) const
/* /*
* $Log: pform_dump.cc,v $ * $Log: pform_dump.cc,v $
* Revision 1.62 2000/10/14 02:23:02 steve
* Check for missing concat subexpressions (PR#11)
*
* Revision 1.61 2000/07/26 05:08:07 steve * Revision 1.61 2000/07/26 05:08:07 steve
* Parse disable statements to pform. * Parse disable statements to pform.
* *