# undef realloc
# endif
-void checkandsetBufState(idDecl id, exprNode is);
%}
%union
/*@only@*/ exprNodeList alist;
/*@only@*/ sRefSet srset;
/*@only@*/ cstringList cstringlist;
+ /*drl
+ added 1/19/2001
+ */
+ constraint con;
+ constraintList conL;
+ constraintExpr conE;
+ /* drl */
}
/* standard C tokens */
%token <tok> QMAXREAD
%token <tok> QTESTINRANGE
+%token <tok> TCAND
/* identifiers, literals */
%type <sr> mExpr modListExpr specClauseListExpr
/*drl*/
-%type <sr> BufConstraint
+%type <con> BufConstraint
%type <tok> relationalOp
%type <tok> BufBinaryOp
%type <tok> bufferModifier
-%type <sr> BufConstraintExpr
+%type <conE> BufConstraintExpr
-%type <sr> BufConstraintTerm
+%type <conE> BufConstraintTerm
+%type <sr> BufConstraintSrefExpr
-%type <sr> BufConstraintList
+%type <conL> BufConstraintList
%type <tok> BufUnaryOp
%type <tquallist> optGlobQuals
%type <qtyp> completeType completeTypeSpecifier optCompleteType
%type <qtyp> completeTypeSpecifierAux altType typeExpression
-%type <expr> lclintassertion
+/*%type <expr> lclintassertion*/
%start file
{ setCurrentParams ($4);
}
optGlobMods optGlobBufConstraints
- { clearCurrentParams ();
+ { setImplictfcnConstraints ();
+ clearCurrentParams ();
$$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
- context_popLoc ();
-
- // printf("Done nameDeclBase\n");
+ context_popLoc ();
}
plainNamedDeclBase
context_setProtectVars (); enterParamsTemp ();
sRef_setGlobalScopeSafe ();
-} QENSURESCONSTRAINT BufConstraintList QENDMACRO
+} QENSURESCONSTRAINT BufConstraintList optSemi QENDMACRO
{
setEnsuresConstraints ($3);
exitParamsTemp ();
context_setProtectVars (); enterParamsTemp ();
sRef_setGlobalScopeSafe ();
-} QBUFFERCONSTRAINT BufConstraintList QENDMACRO
+} QBUFFERCONSTRAINT BufConstraintList optSemi QENDMACRO
{
setFunctionConstraints ($3);
exitParamsTemp ();
| /*empty*/
BufConstraintList
-: BufConstraint BufConstraintList{ $$ = constraintList_add ($2, $1); }
-| BufConstraint {constraintList c; c = constraintList_new(); c = constraintList_add (c, $1); $$ = c}
+: BufConstraint TCAND BufConstraintList { $$ = constraintList_add ($3, $1); }
+| BufConstraint {constraintList c; c = constraintList_makeNew(); c = constraintList_add (c, $1); $$ = c}
BufConstraint
-: BufConstraintExpr relationalOp BufConstraintExpr TSEMI {
+: BufConstraintExpr relationalOp BufConstraintExpr {
$$ = makeConstraintParse3 ($1, $2, $3);
DPRINTF(("Done BufConstraint1\n")); }
$$ = constraintExpr_parseMakeBinaryOp ($2, $3, $4); }
BufConstraintTerm
-: id { /* $$ = constraintExpr_makeTermsRef (checkSpecClausesId ($1)); */
- $$ = constraintExpr_makeTermsRef (checkbufferConstraintClausesId ($1));}
- | NEW_IDENTIFIER { $$ = constraintExpr_makeTermsRef(fixSpecClausesId ($1) ); }
+: BufConstraintSrefExpr { $$ = constraintExpr_makeTermsRef($1);}
| CCONSTANT { char *t; int c;
t = cstring_toCharsSafe (exprNode_unparse($1));
c = atoi( t );
$$ = constraintExpr_makeIntLiteral (c);
}
+
+BufConstraintSrefExpr
+: id {
+ $$ =
+ checkbufferConstraintClausesId ($1);}
+ | NEW_IDENTIFIER { $$ = fixSpecClausesId ($1); }
+
+ | BufConstraintSrefExpr TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
+ | BufConstraintSrefExpr TLSQBR CCONSTANT TRSQBR {
+ char *t; int c;
+ t = cstring_toCharsSafe (exprNode_unparse($3));
+ c = atoi( t );
+ $$ = sRef_makeArrayFetchKnown($1, c); }
+ | TMULT BufConstraintSrefExpr { $$ = sRef_constructPointer ($2); }
+ | TLPAREN BufConstraintSrefExpr TRPAREN { $$ = $2; }
+ | BufConstraintSrefExpr TDOT newId { cstring_markOwned ($3);
+ $$ = sRef_buildField ($1, $3); }
+ | BufConstraintSrefExpr ARROW_OP newId { cstring_markOwned ($3);
+ $$ = sRef_makeArrow ($1, $3); }
+
+/*
+| BufConstraintTerm TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
+ | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
+ | TLPAREN specClauseListExpr TRPAREN { $$ = $2; }
+ | specClauseListExpr TDOT newId { cstring_markOwned ($3);
+ $$ = sRef_buildField ($1, $3); }
+*/
+
/*BufConstraintExpr
: BufConstraintTerm
*/
: fcnDefHdr fcnBody
{
context_setFunctionDefined (exprNode_loc ($2));
- /* exprNode_checkFunction (context_getHeader (), $2); */
+ exprNode_checkFunction (context_getHeader (), $2);
/* DRL 8 8 2000 */
context_exitFunction ();
| iterationStmt
| iterStmt
| jumpStmt
-/* | tst1 */
- | lclintassertion {$$ = $1; printf ("Doing stmt lclintassertion\n"); }
-
+/* | lclintassertion {$$ = $1; printf ("Doing stmt lclintassertion\n"); }*/
+/*
lclintassertion
: QSETBUFFERSIZE id CCONSTANT QENDMACRO { printf(" QSETBUFFERSIZE id CCONSTANT HEllo World\n"); uentry_setBufferSize($2, $3); $$ = exprNode_createTok ($4);
}