/*to be used for structure checking */
/ *@only@* / static constraintExpr
-doSRefFixInvarConstraintTerm (/ *@only@* / constraintExpr e,
- sRef s, ctype ct)
+doSRefFixInvarConstraintTerm (/ *@only@* / constraintExpr e, sRef s, ctype ct)
{
constraintTerm t;
/*drl added these around 10/18/001*/
-static /*@only@*/ constraintExpr constraintExpr_div (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc)
+static /*@only@*/ constraintExpr
+constraintExpr_div (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc)
{
int sizefrom = ctype_getSize (tfrom);
int sizeto = ctype_getSize (tto);
if (sizeto == sizefrom)
{
+ DPRINTF (("Sizes match: %d / %d", sizeto, sizefrom));
; /* Sizes match, a-ok */
}
else
llassert (e != NULL);
llassert (e->kind == term);
ct = constraintExprData_termGetTerm (e->data);
+ DPRINTF (("constraint: %s / %s", constraintExpr_unparse (e), constraintTerm_unparse (ct)));
llassert (constraintTerm_canGetValue (ct));
val = constraintTerm_getValue (ct);
/*@access exprNode@*/
-static /*@only@*/ constraintExpr constraintTerm_simpleDivTypeExprNode (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc)
+static /*@only@*/ constraintExpr
+constraintTerm_simpleDivTypeExprNode (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc)
{
exprData data;
exprNode t1, t2, expr;
/* empty */
}
}
+ else
+ {
+ DPRINTF (("Not a mult: %s", constraintExpr_unparse (e)));
+ }
}
return (constraintExpr_div (e, tfrom, tto, loc));
opts->warn_comments = 0;
opts->warnings_are_errors = 0;
+ /* Added 2003-07-10: */
+ opts->traditional = FALSE;
+ opts->c89 = TRUE;
initialize_char_syntax (opts);
}
cpplib_installBuiltin ("__REGISTER_PREFIX__", ctype_string, -1, T_REGISTER_PREFIX_TYPE, 0, NULL, -1);
cpplib_installBuiltin ("__TIME__", ctype_string, -1, T_TIME, 0, NULL, -1);
- /*
- ** No, don't define __STDC__
- **
-
if (!cppReader_isTraditional (pfile))
{
cpplib_installBuiltin ("__STDC__", ctype_int, -1, T_CONST, STDC_VALUE, NULL, -1);
}
- **
- */
-
# ifdef WIN32
cpplib_installBuiltin ("_WIN32", ctype_int, -1, T_CONST, STDC_VALUE, NULL, -1);
# endif
DPRINTF (("No error: [%s] %s / [%s] %s",
exprNode_unparse (e1), ctype_unparse (tr1),
exprNode_unparse (e2), ctype_unparse (tr2)));
+
+ /*
+ ** evans 2003-06-15: changed this so if either type is a literal,
+ ** the other type is used.
+ ** (Need to look at the ISO C99 rules on this...)
+ */
- ret = ctype_biggerType (tr1, tr2);
+ if (exprNode_isNumLiteral (e1)) {
+ ret = tr2;
+ } else if (exprNode_isNumLiteral (e2)) {
+ ret = tr1;
+ } else {
+ ret = ctype_biggerType (tr1, tr2);
+ }
}
else
{
"casebreak",
FLG_CASEBREAK,
"non-empty case in a switch without preceding break",
- "Execution falls through from the previous case.", 0, 0
+ "Execution falls through from the previous case (use /*@fallthrough@*/ to mark fallthrough cases).", 0, 0
},
{
FK_CONTROL, FK_NONE, modeFlag,
if (ctype_isSU (st) && ctype_isRealSU (sRef_getType (slhs))
&& ctype_match (sRef_getType (slhs), st))
{
- if (tt == TT_DOASSIGN && sRef_isStateDefined (srhs))
+ if ((tt == TT_DOASSIGN || tt == TT_FIELDASSIGN) && sRef_isStateDefined (srhs))
{
sRef_setDefinedComplete (slhs, loc);
}
if (sRef_isLocalVar (slhs)
&& sRef_isFileOrGlobalScope (sRef_getRootBase (srhs)))
{
+ DPRINTF (("Global scope!"));
sRef_setDependent (slhs, exprNode_loc (lhs));
}
- else
- {
- if (ctype_isUnion (st))
- {
- sRef_setDefState (slhs, sRef_getDefState (srhs),
- exprNode_loc (lhs));
+ }
- sRefSet_realElements (sRef_derivedFields (srhs), sr)
- {
- if (sRef_isField (sr))
- {
- cstring fieldname = sRef_getField (sr);
- sRef lfld = sRef_makeField (slhs, fieldname);
+ /*
+ ** evans 2003-07-10: should always copy the fields!
+ */
- (void) checkTransfer (rhs, sr, lhs, lfld,
- exprNode_undefined,
- exprNode_loc (lhs), tt);
- }
- } end_sRefSet_realElements ;
- }
- else
+ if (ctype_isUnion (st))
+ {
+ sRef_setDefState (slhs, sRef_getDefState (srhs),
+ exprNode_loc (lhs));
+
+ sRefSet_realElements (sRef_derivedFields (srhs), sr)
+ {
+ if (sRef_isField (sr))
{
- uentryList fields = ctype_getFields (st);
+ cstring fieldname = sRef_getField (sr);
+ sRef lfld = sRef_makeField (slhs, fieldname);
- uentryList_elements (fields, field)
- {
- sRef rfld = sRef_makeField (srhs, uentry_rawName (field));
- sRef lfld = sRef_makeField (slhs, uentry_rawName (field));
- (void) checkTransfer (rhs, rfld, lhs, lfld,
- exprNode_undefined,
- exprNode_loc (lhs), tt);
- } end_uentryList_elements ;
- }
-
- if (sRef_isOnly (srhs))
- {
- sRef_setKeptComplete (srhs, loc);
+ (void) checkTransfer (rhs, sr, lhs, lfld,
+ exprNode_undefined,
+ exprNode_loc (lhs), tt);
}
- }
+ } end_sRefSet_realElements ;
+ }
+ else
+ {
+ uentryList fields = ctype_getFields (st);
+
+ uentryList_elements (fields, field)
+ {
+ sRef rfld = sRef_makeField (srhs, uentry_rawName (field));
+ sRef lfld = sRef_makeField (slhs, uentry_rawName (field));
+ DPRINTF (("Transfer field: %s := %s",
+ sRef_unparse (lfld), sRef_unparse (rfld)));
+ (void) checkTransfer (rhs, rfld, lhs, lfld,
+ exprNode_undefined,
+ exprNode_loc (lhs), tt);
+ } end_uentryList_elements ;
+ }
+
+ if (sRef_isOnly (srhs))
+ {
+ sRef_setKeptComplete (srhs, loc);
}
}
}
if (ctype_isRealSU (sRef_getType (srhs)))
{
+ DPRINTF (("Check struct transfer: %s := %s", exprNode_unparse (lhs),
+ exprNode_unparse (rhs)));
checkStructTransfer (lhs, slhs, rhs, srhs, exprNode_loc (lhs), TT_FIELDASSIGN);
}
else
check: $(LCSFILES)
-$(SPLINT) -showcol -weak $(MODULES) -expect 19
- -$(SPLINT) -showcol +strict -modfilesystem +showsummary $(MODULES) -expect 338
+ -$(SPLINT) -showcol +strict -bounds -modfilesystem +showsummary $(MODULES) -expect 338
# evans 2002-07-09: 5 bufferoverflowhigh warnings for using sprintf