Compare commits

..
5 changed files with 24 additions and 45 deletions
-8
View File
@@ -65,14 +65,6 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_circular_reference INITIALLY( ERROR_
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_attribute INITIALLY( ERROR_none );
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_ambiguous_group INITIALLY( ERROR_none );
/** If we're inside a conditional statement (within a function, procedure, etc)
* then this variable points to that statement. Currently the only use is to
* suppress errors when the test in an IF...ENDIF always evaluates one way.
* Set within STMTresolve().
* \sa STMTresolve
*/
GLOBAL SCL_EXPRESS_EXPORT Statement currCondStmt INITIALLY(0);
#undef GLOBAL
#undef INITIALLY
+17 -5
View File
@@ -550,11 +550,23 @@ Severity SDAI_Application_instance::STEPread( int id, int idIncr,
while( i < n - 1 ) {
i++; // check if following attributes are redefined
if( !( attributes[i].aDesc->AttrType() == AttrType_Redefining ) ) {
PrependEntityErrMsg();
_error.AppendToDetailMsg( "Missing attribute value[s].\n" );
// recoverable error
_error.GreaterSeverity( SEVERITY_WARNING );
return _error.severity();
//The attribute is missing. If it's a string, use ''.
if( ( !strict ) && ( attributes[i].aDesc->NonRefType() == STRING_TYPE ) ) {
attributes[i].StrToVal("''", instance_set, idIncr);
_error.AppendToDetailMsg("Missing required non-redefined attribute of type string added as null string.\n" );
_error.GreaterSeverity( SEVERITY_INCOMPLETE );
std::ostringstream oss;
oss << "/* Entity #" << id <<", attribute #" << i;
oss << ": a missing, required, non-redefined string; added as null string. */\n";
p21Comment.append( oss.str() );
} else {
PrependEntityErrMsg();
_error.AppendToDetailMsg( "Missing attribute value[s].\n" );
// recoverable error
_error.GreaterSeverity( SEVERITY_WARNING );
return _error.severity();
}
}
i++;
}
+3 -18
View File
@@ -286,17 +286,6 @@ static int EXP_resolve_op_dot_fuzzy( Type selection, Symbol ref, Variable * v, c
}
}
/// evaluate the test for the conditional statement that we're currently in
/// if its value can be determined, return LTrue/LFalse, otherwise LUnknown
Logical EXP_eval_conditional() {
Expression t = currCondStmt->u.cond->test;
//go through t, looking for tautologies
//if found, store and print warning when execution is done (per Tom T)
FIXME //FIXME incomplete
return Lunknown;
}
Type EXPresolve_op_dot( Expression expr, Scope scope ) {
Expression op1 = expr->e.op1;
Expression op2 = expr->e.op2;
@@ -339,14 +328,10 @@ Type EXPresolve_op_dot( Expression expr, Scope scope ) {
switch( options ) {
case 0:
/* no possible resolutions */
if( ( currCondStmt != 0 ) && ( EXP_eval_conditional() != Lunknown) ) {
return( Type_Runtime );
} else {
ERRORreport_with_symbol( ERROR_undefined_attribute,
ERRORreport_with_symbol( ERROR_undefined_attribute,
&op2->symbol, op2->symbol.name );
resolve_failed( expr );
return( Type_Bad );
}
resolve_failed( expr );
return( Type_Bad );
case 1:
/* only one possible resolution */
if( dt != OBJ_VARIABLE ) {
-10
View File
@@ -842,7 +842,6 @@ void CASE_ITresolve( Case_Item item, Scope scope, Type type ) {
void STMTresolve( Statement statement, Scope scope ) {
Type type;
Scope proc;
Statement lastCondStmt = 0; ///< used to store the previous value of currCondStmt
if( !statement ) {
return; /* could be null statement */
@@ -872,20 +871,11 @@ void STMTresolve( Statement statement, Scope scope ) {
STMTlist_resolve( statement->u.compound->statements, scope );
break;
case STMT_COND:
if( currCondStmt ) {
lastCondStmt = currCondStmt;
}
currCondStmt = statement;
EXPresolve( statement->u.cond->test, scope, Type_Dont_Care );
STMTlist_resolve( statement->u.cond->code, scope );
if( statement->u.cond->otherwise ) {
STMTlist_resolve( statement->u.cond->otherwise, scope );
}
if( lastCondStmt ) {
currCondStmt = lastCondStmt;
} else {
currCondStmt = 0;
}
break;
case STMT_PCALL:
#define proc_name statement->symbol.name
+4 -4
View File
@@ -152,8 +152,8 @@ int main( int argc, char * argv[] ) {
sfile.ReadExchangeFile( flnm );
sfile.Error().PrintContents( cout );
if ( sfile.Error().severity() <= SEVERITY_INCOMPLETE )
exit(1);
if ( sfile.Error().severity() < SEVERITY_INCOMPLETE )
exit( EXIT_FAILURE );
checkSchemaName( registry, sfile, ignoreErr );
@@ -169,7 +169,7 @@ int main( int argc, char * argv[] ) {
sfile.Error().PrintContents( cout );
cout << flnm << " written" << endl;
if( ( sfile.Error().severity() <= SEVERITY_INCOMPLETE ) || ( readSev <= SEVERITY_INCOMPLETE ) ) { //lower is worse
exit( 1 );
if( sfile.Error().severity() < SEVERITY_INCOMPLETE ) { //lower is worse
exit( EXIT_FAILURE );
}
}