+ if (!uentry_isElipsisMarker (uentryList_getN (params, paramno)))
+ {
+ voptgenerror
+ (FLG_TYPE,
+ message ("Ensures clauses uses ... for function without ... in parameter list: %q",
+ uentry_getName (le)),
+ uentry_whereLast (le));
+ /*@innerbreak@*/ break;
+ }
+
+ while (paramno < exprNodeList_size (args))
+ {
+ exprNode arg = exprNodeList_getN (args, paramno);
+ fs = exprNode_getSref (arg);
+ DPRINTF (("Merge arg: %s", exprNode_unparse (arg)));
+
+ /* cut and pasted... gack*/
+ if (stateValue_isDefined (sval))
+ {
+ /* Use combination table to merge old state value with new one: */
+ stateValue tval = sRef_getMetaStateValue (fs, key);
+
+ if (stateValue_isDefined (tval))
+ {
+ stateCombinationTable sctable = metaStateInfo_getMergeTable (msinfo);
+ cstring msg = cstring_undefined;
+ int nval = stateCombinationTable_lookup (sctable,
+ stateValue_getValue (sval),
+ stateValue_getValue (tval),
+ &msg);
+ DPRINTF (("Combining: %s + %s -> %d",
+ stateValue_unparseValue (sval, msinfo),
+ stateValue_unparseValue (tval, msinfo),
+ nval));
+
+ if (nval == stateValue_error)
+ {
+ if (optgenerror
+ (FLG_STATEMERGE,
+ message
+ ("Attributes merged in ensures clause in states that "
+ "cannot be combined (%q is %q, %q is %q)%q",
+ sRef_unparse (lastref),
+ stateValue_unparseValue (sval, msinfo),
+ sRef_unparse (fs),
+ stateValue_unparseValue (tval, msinfo),
+ cstring_isDefined (msg) ?
+ message (": %s", msg) : cstring_undefined),
+ exprNode_loc (f)))
+ {
+ sRef_showMetaStateInfo (fs, key);
+ }
+ }
+
+ stateValue_updateValueLoc (sval, nval, fileloc_undefined);
+ loc = exprNode_loc (arg);
+ }
+ else
+ {
+ DPRINTF (("No value for: %s:%s", sRef_unparse (fs), key));
+ }
+ }
+ else
+ {
+ sval = sRef_getMetaStateValue (fs, key);
+ }
+
+ lastref = fs;
+
+ if (stateValue_isError (sval))
+ {
+ /*@innerbreak@*/ break; /* Don't merge any more values if here was an error */
+ }
+
+
+ paramno++;
+ }
+ }
+ else
+ {
+ msr = metaStateSpecifier_getSref (ms);
+
+
+ llassert (sRef_isParam (sRef_getRootBase (msr)));
+ fs = sRef_fixBaseParam (msr, args);
+
+ if (stateValue_isDefined (sval))
+ {
+ /* Use combination table to merge old state value with new one: */
+ stateValue tval = sRef_getMetaStateValue (fs, key);
+
+ if (stateValue_isDefined (tval))
+ {
+ stateCombinationTable sctable = metaStateInfo_getMergeTable (msinfo);
+ cstring msg = cstring_undefined;
+ int nval = stateCombinationTable_lookup (sctable,
+ stateValue_getValue (sval),
+ stateValue_getValue (tval),
+ &msg);
+ DPRINTF (("Combining: %s + %s -> %d",
+ stateValue_unparseValue (sval, msinfo),
+ stateValue_unparseValue (tval, msinfo),
+ nval));
+
+ if (nval == stateValue_error)
+ {
+ if (optgenerror
+ (FLG_STATEMERGE,
+ message
+ ("Attributes merged in ensures clause in states that "
+ "cannot be combined (%q is %q, %q is %q)%q",
+ sRef_unparse (lastref),
+ stateValue_unparseValue (sval, msinfo),
+ sRef_unparse (fs),
+ stateValue_unparseValue (tval, msinfo),
+ cstring_isDefined (msg)
+ ? message (": %s", msg) : cstring_undefined),
+ exprNode_loc (f)))
+ {
+ sRef_showMetaStateInfo (fs, key);
+ }
+ }
+
+ stateValue_updateValueLoc (sval, nval, fileloc_undefined);
+ }
+ else
+ {
+ DPRINTF (("No value for: %s:%s", sRef_unparse (fs), key));
+ }
+ }
+ else
+ {
+ sval = sRef_getMetaStateValue (fs, key);
+ }
+
+ lastref = fs;
+
+ if (stateValue_isError (sval))
+ {
+ /*@innerbreak@*/ break; /* Don't merge any more values if here was an error */
+ }
+ }
+ }
+
+ DPRINTF (("Setting: %s:%s <- %s", sRef_unparse (s), key, stateValue_unparse (sval)));
+
+ if (stateValue_isDefined (sval))
+ {
+ sRef_setMetaStateValueComplete (s, key, stateValue_getValue (sval), loc);
+ }
+ else
+ {
+ DPRINTF (("Undefined state: %s", cstring_toCharsSafe (sRef_unparse (s))));
+ }
+ } end_metaStateConstraintList_elements ;