uentry hdr;
if (!(context_inFunctionLike () || context_inMacroConstant ()
- || context_inMacroUnknown ()))
+ || context_inUnknownMacro ()))
{
llcontbug
(message
}
}
}
- else if (context_inMacroFunction () || context_inMacroUnknown ())
+ else if (context_inMacroFunction () || context_inUnknownMacro ())
{
ctype rettype = context_getRetType ();
/*@owned@*/ exprNode body;
- // return;
-
- // context_setFlag(FLG_ORCONSTRAINT, TRUE);
context_enterInnerContext ();
body = fcnBody;
- // if we're not going to printing any errors for buffer buffer flows
- //we can skip the checking to improve performance
- //
- //FLG_DEBUGFUNCTIONCONSTRAINT controls wheather we perform the check anyway
- // in order to find potential problems like asserts and seg faults...
+ /*
+ if we're not going to be printing any errors for buffer overflows
+ we can skip the checking to improve performance
+
+ FLG_DEBUGFUNCTIONCONSTRAINT controls wheather we perform the check anyway
+ in order to find potential problems like asserts and seg faults...
+ */
if (!context_getFlag(FLG_DEBUGFUNCTIONCONSTRAINT) )
- // check if errors will printed
+ /* check if errors will printed */
if (! (context_getFlag(FLG_DEBUGFUNCTIONCONSTRAINT) ||
context_getFlag(FLG_FUNCTIONCONSTRAINT) ||
+ context_getFlag(FLG_ARRAYBOUNDS) ||
+ context_getFlag(FLG_ARRAYBOUNDSREAD) ||
context_getFlag(FLG_CHECKPOST)
)
)
body->requiresConstraints = constraintList_reflectChangesFreePre (body->requiresConstraints, implicitFcnConstraints );
}
}
+
+ body->requiresConstraints = constraintList_sort (body->requiresConstraints);
constraintList_printError(body->requiresConstraints, g_currentloc);
}
if (constraintList_isDefined(post) )
- constraintList_free(post);
+ {
+ constraintList_free(post);
+ }
+ body->ensuresConstraints = constraintList_sort(body->ensuresConstraints);
- constraintList_printError(body->ensuresConstraints, g_currentloc);
+ if ( context_getFlag (FLG_FUNCTIONPOST) )
+ {
+ constraintList_printError(body->ensuresConstraints, g_currentloc);
+ }
- // ConPrint (message ("Unable to resolve function constraints:\n%s", constraintList_printDetailed(body->requiresConstraints) ), g_currentloc);
+ /* ConPrint (message ("Unable to resolve function constraints:\n%s", constraintList_printDetailed(body->requiresConstraints) ), g_currentloc);
- // ConPrint (message ("LCLint has found function post conditions:\n%s", constraintList_printDetailed(body->ensuresConstraints) ), g_currentloc);
+ ConPrint (message ("LCLint has found function post conditions:\n%s", constraintList_printDetailed(body->ensuresConstraints) ), g_currentloc);
- // printf ("The required constraints are:\n%s", constraintList_printDetailed(body->requiresConstraints) );
- // printf ("The ensures constraints are:\n%s", constraintList_printDetailed(body->ensuresConstraints) );
+ printf ("The required constraints are:\n%s", constraintList_printDetailed(body->requiresConstraints) );
+ printf ("The ensures constraints are:\n%s", constraintList_printDetailed(body->ensuresConstraints) );
+ */
if (constraintList_isDefined(c) )
constraintList_free(c);
uentry hdr;
if (!(context_inFunctionLike () || context_inMacroConstant ()
- || context_inMacroUnknown ()))
+ || context_inUnknownMacro ()))
{
llcontbug
(message ("exprNode_checkEmptyMacroBody: not in macro function or constant: %q",
ctype tr = ctype_getReturnType (context_currentFunctionType ());
ctype te = exprNode_getType (e);
+ /* evans 2001-08-21: added test to warn about void returns from void functions */
+ if (ctype_isVoid (tr))
+ {
+ (void) gentypeerror
+ (te, e, tr, exprNode_undefined,
+ message ("Return expression from function declared void: %s", exprNode_unparse (e)),
+ e->loc);
+ return;
+ }
+
if (!ctype_forceMatch (tr, te) && !exprNode_matchLiteral (tr, e))
{
(void) gentypeerror