/*@only@*/ modifiesClause modsclause;
/*@only@*/ warnClause warnclause;
/*@only@*/ stateClause stateclause;
- /*@only@*/ pointers pointers;
+
/*@only@*/ functionConstraint fcnconstraint;
/*@only@*/ metaStateConstraint msconstraint;
%token <tok> QNOTREACHED
/* type qualifiers: */
-%token <tok> QCONST QRESTRICT QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER
+%token <tok> QCONST QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER
%token <tok> QOUT QIN QYIELD QONLY QTEMP QSHARED QREF QUNIQUE
%token <tok> QCHECKED QUNCHECKED QCHECKEDSTRICT QCHECKMOD
%token <tok> QKEEP QKEPT QPARTIAL QSPECIAL QOWNED QDEPENDENT
%token <msinfo> METASTATE_NAME
%type <msinfo> metaStateName
%type <cname> enumerator newId /*@-varuse@*/ /* yacc declares yytranslate here */
-%type <pointers> pointers /*@=varuse@*/
+%type <count> pointers /*@=varuse@*/
%type <tok> doHeader stateTag conditionTag startConditionClause
%type <typequal> exitsQualifier checkQualifier stateQualifier
%type <ntyp> namedDecl namedDeclBase optNamedDecl
%type <ntyp> plainNamedDecl plainNamedDeclBase
%type <ntyp> structNamedDecl
-%type <ntyp> fcnDefHdrAux plainFcn
+%type <ntyp> fcnDefHdrAux plainFcn fcnDefHdr
%type <oentry> paramDecl
%type <entry> id
%type <expr> designator designatorList designation
-%type <typequal> storageSpecifier typeQualifier typeModifier globQual innerMods
-%type <tquallist> optGlobQuals innerModsList
+%type <typequal> storageSpecifier typeQualifier typeModifier globQual
+%type <tquallist> optGlobQuals
%type <qtyp> completeType completeTypeSpecifier optCompleteType
%type <qtyp> completeTypeSpecifierAux altType typeExpression
| externalDefs externalDef { context_checkGlobalScope (); }
externalDef
- : fcnDef optSemi { uentry_clearDecl (); }
+: fcnDef optSemi { uentry_clearDecl (); }
| constantDecl { uentry_clearDecl (); }
| fcnDecl { uentry_clearDecl (); }
| iterDecl { uentry_clearDecl (); }
| macroDef { uentry_clearDecl (); }
- | initializer { uentry_checkDecl (); exprNode_free ($1); }
+ | initializer { //drl added 04/02/2002
+ if (willOutputCode )
+ {
+ exprNode_unparse($1);
+
+ if (exprNode_isDefined($1) && ( ($1)->kind == XPR_INIT) )
+ {
+ if ( ctype_isFunctionPointer (($1)->edata->init->id->typ->type ) )
+ {
+ outputCode(message("%s;\n", ctype_unparseFunctionPointer (($1)->edata->init->id->typ->type, qualList_unparse(($1)->edata->init->id->typ->quals), cstring_copy( ($1)->edata->init->id->id ) ))
+ );
+ }
+ else if ( ctype_isFunction (($1)->edata->init->id->typ->type ) )
+ {
+ outputCode(message("%s;\n", ctype_unparseFunction (($1)->edata->init->id->typ->type, cstring_copy( ($1)->edata->init->id->id ) ))
+ );
+ }
+ else
+ {
+ outputCode(message("%s;\n", exprNode_unparse(($1) ) ));
+ }
+ }
+
+ else if (exprNode_isDefined($1) )
+ {
+ outputCode(message("%s;\n", exprNode_unparse(($1) ) ));
+ }
+ else
+ {
+ /*drl try outputing nothing so that there is not an unnecessary semicolon*/
+ // outputCode(message("%s;\n", exprNode_unparse(($1) ) ));
+ }
+
+ }
+
+uentry_checkDecl (); exprNode_free ($1); }
| TSEMI { uentry_clearDecl (); /* evans 2002-02-08: okay to have a null statement */ }
| error { uentry_clearDecl (); }
| LLMACRO TENDMACRO /* no stmt */ { exprChecks_checkEmptyMacroBody (); }
fcnDefHdr
- : fcnDefHdrAux { clabstract_declareFunction ($1); }
+ : fcnDefHdrAux { clabstract_declareFunction ($1);
+ DPRINTF (message ("fcnDefHdr is: %s", idDecl_unparseC($1) ) );
+ $$ = $1; }
metaStateConstraint
: metaStateSpecifier TASSIGN metaStateExpression
BufConstraint
: BufConstraintExpr relationalOp BufConstraintExpr {
- $$ = makeConstraintParse3 ($1, $2, $3);
+ $$ = constraint_makeConstraintLltok ($1, $2, $3);
DPRINTF(("Done BufConstraint1\n")); }
bufferModifier
context_setFunctionDefined (exprNode_loc ($2));
exprNode_checkFunction (context_getHeader (), $2);
/* DRL 8 8 2000 */
-
+ DPRINTF(message ("Header: %s\n", idDecl_unparseC($1) ) );
context_exitFunction ();
}
}
primaryExpr
- : id { $$ = exprNode_fromIdentifier ($1); }
+ : id { int tmpMark1; $$ = exprNode_fromIdentifier ($1); }
| NEW_IDENTIFIER { $$ = exprNode_fromUIO ($1); }
| cconstantExpr
| TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); }
| postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); }
| postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
| VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN { $$ = exprNode_vaArg ($1, $3, $5); }
- | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); }
+ | postfixExpr NotType TDOT newId IsType {int tmpMark2; $$ = exprNode_fieldAccess ($1, $3, $4); }
| postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); }
| postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
| postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
| offsetofExpr { $$ = $1; }
fieldDesignator
- : fieldDesignator TDOT newId { $$ = cstringList_add ($1, $3); }
- | fieldDesignator TLSQBR expr TRSQBR { $$ = $1; }
- /* evans 2002-07-02: offsetof designators can use array indexes */
- | newId { $$ = cstringList_single ($1); }
+ : fieldDesignator TDOT newId { $$ = cstringList_add ($1, $3); }
+ | newId { $$ = cstringList_single ($1); }
offsetofExpr
: COFFSETOF IsType TLPAREN typeExpression NotType TCOMMA fieldDesignator TRPAREN IsType
instanceDecl
: completeTypeSpecifier IsType TSEMI
- { $$ = exprNode_makeError (); }
- /*
+{
+ if (willOutputCode )
+ outputCode(message( "%s;\n", qtypetryToPrintStruct($1) ));
+
+ $$ = exprNode_makeError (); }
+ /*
** This causes r/r conflicts with function definitions.
** Instead we need to snarf one first. (gack)
**
processNamedDecl ($3);
}
IsType optDeclarators TSEMI IsType
- {
- unsetProcessingVars ();
- $$ = exprNode_makeEmptyInitialization ($3);
+ {
+ ctype ct;
+
+ ct = idDecl_getCtype ($3);
+ idDecl_setTyp ($3, qtype_copy ($1) );
+ idDecl_replaceCtype($3, ct);
+
+ unsetProcessingVars ();
+ /*drl 04-17-2002 added exprNode_concat */
+ $$ = exprNode_concat ($7, exprNode_makeEmptyInitialization ($3) );
DPRINTF (("Empty initialization: %s", exprNode_unparse ($$)));
}
| completeTypeSpecifier NotType namedDecl NotType TASSIGN
{ setProcessingVars ($1); processNamedDecl ($3); }
IsType init optDeclarators TSEMI IsType
- { $$ = exprNode_concat ($9, exprNode_makeInitialization ($3, $8));
+ {
+ ctype ct;
+
+ ct = idDecl_getCtype ($3);
+ idDecl_setTyp ($3, qtype_copy ($1) );
+ idDecl_replaceCtype($3, ct);
+
+ $$ = exprNode_concat ($9, exprNode_makeInitialization ($3, $8));
unsetProcessingVars ();
}
typeDecl
: CTYPEDEF completeTypeSpecifier { setProcessingTypedef ($2); }
NotType namedInitializerList IsType optWarnClause TSEMI
- { clabstract_declareType ($5, $7); }
+ {
+ if ( willOutputCode )
+ {
+ outputCode(message( "typedef %s;",
+ // qtypetryToPrintStruct($2),
+ exprNode_unparse(exprNodeList_head ($5) )
+ )
+ );
+ }
+ clabstract_declareType ($5, $7); }
| CTYPEDEF completeTypeSpecifier IsType TSEMI { /* in the ANSI grammar, semantics unclear */ }
| CTYPEDEF namedInitializerList IsType TSEMI { /* in the ANSI grammar, semantics unclear */ }
typeQualifier
: QCONST IsType { $$ = qual_createConst (); }
| QVOLATILE IsType { $$ = qual_createVolatile (); }
- | QRESTRICT IsType { $$ = qual_createRestrict (); }
| definedQualifier IsType { $$ = $1; }
| stateQualifier IsType { $$ = $1; }
| exitsQualifier IsType { $$ = $1; }
| pointers TYPE_NAME
{
qtype qt = qtype_unknown ();
+
qtype_adjustPointers ($1, qt);
$$ = idDecl_create (cstring_copy (LastIdentifier ()), qt);
}
| NotType paramIdList { $$ = handleParamIdList ($2); }
innerMods
- : QCONST { $$ = qual_createConst (); }
- | QRESTRICT { $$ = qual_createRestrict (); }
- | QVOLATILE { $$ = qual_createVolatile (); }
+ : QCONST {setInnerConstQual(); /* ignored for now */; }
+ | QVOLATILE { ; }
innerModsList
- : innerMods { $$ = qualList_single ($1); }
- | innerModsList innerMods { $$ = qualList_add ($1, $2); }
+ : innerMods { ; }
+ | innerModsList innerMods { ; }
pointers
- : TMULT { $$ = pointers_create ($1); }
- | TMULT innerModsList { $$ = pointers_createMods ($1, $2); }
- | TMULT pointers { $$ = pointers_extend (pointers_create ($1), $2); }
- | TMULT innerModsList pointers { $$ = pointers_extend (pointers_createMods ($1, $2), $3); }
+ : TMULT { $$ = 1; }
+ | TMULT innerModsList { $$ = 1; }
+ | TMULT pointers { $$ = 1 + $2; }
+ | TMULT innerModsList pointers { $$ = 1 + $3; }
paramIdList
: idList
| postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
| VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN
{ $$ = exprNode_vaArg ($1, $3, $5); }
- | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); }
+ | postfixExpr NotType TDOT newId IsType {int tmpMark1; $$ = exprNode_fieldAccess ($1, $3, $4); }
| postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); }
| postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
| postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
| TCOMMA { ; }
id
- : IDENTIFIER
+: IDENTIFIER {
+ ; }
newId
: NEW_IDENTIFIER