]> andersk Git - splint.git/blobdiff - src/cgrammar.y
Made allocations involving sizeof work correctly (test/malloc.c).
[splint.git] / src / cgrammar.y
index 33f8cae30634bc59f032aa3c1811e0ff41856154..c9937b38a3346e16081eee7b82b7879bd4b22746 100644 (file)
@@ -409,14 +409,14 @@ namedDeclBase
      $$ = idDecl_replaceCtype ($1, ct);
 
      /*drl 7/25/01 added*/
-     setImplictfcnConstraints();
+     setImplicitfcnConstraints();
 
      DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s",
                      functionClauseList_unparse($6)
                      )
              ));
      
-     fcl = functionClauseList_setImplictConstraints($6);
+     fcl = functionClauseList_setImplicitConstraints($6);
 
      idDecl_addClauses ($$, fcl);
 
@@ -434,7 +434,7 @@ namedDeclBase
    functionClauses
    {
      functionClauseList fcl;
-     setImplictfcnConstraints ();
+     setImplicitfcnConstraints ();
      clearCurrentParams ();
      $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
 
@@ -443,7 +443,7 @@ namedDeclBase
                      )
              )) ;
      
-     fcl = functionClauseList_setImplictConstraints($7);
+     fcl = functionClauseList_setImplicitConstraints($7);
 
      idDecl_addClauses ($$, fcl);
 
@@ -874,14 +874,16 @@ specClauseListExpr
 ;
 
 optSpecClauseList
- : /* empty */ { $$ = sRefSet_undefined }
+ : /* empty */ { DPRINTF ((message("Empty optSpecClauseList") )); $$ = sRefSet_undefined }
  | specClauseList
  ;
 
 specClauseList
   : specClauseListExpr                       
     { if (sRef_isValid ($1)) { $$ = sRefSet_single ($1); } 
-      else { $$ = sRefSet_undefined; } 
+      else {
+       DPRINTF((message("returning sRefSEt_undefined ")  ));
+       $$ = sRefSet_undefined; } 
     }
   | specClauseList TCOMMA specClauseListExpr 
     { if (sRef_isValid ($3))
@@ -936,7 +938,7 @@ unaryExpr
  | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); }
  | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); }
  | TEXCL castExpr  { $$ = exprNode_preOp ($2, $1); }
- | sizeofExpr      { $$ = $1; }
+ | processSizeof sizeofExpr endprocessSizeof      { $$ = $2; }
  | offsetofExpr    { $$ = $1; }
 ;
 
@@ -958,13 +960,21 @@ sizeofExpr
    sizeofExprAux { context_sizeofReleaseVars (); $$ = $3; }
 ;
 
+processSizeof: {context_enterSizeof()};
+
+
+endprocessSizeof: {context_leaveSizeof()};
+
+
 sizeofExprAux 
- : CSIZEOF TLPAREN typeExpression TRPAREN { $$ = exprNode_sizeofType ($3); lltok_free3 ($1, $2, $4); } 
- | CSIZEOF unaryExpr                      { $$ = exprNode_sizeofExpr ($2); lltok_free ($1); }
+ : CSIZEOF TLPAREN typeExpression TRPAREN { $$ = exprNode_sizeofType ($3); lltok_free3 ($1, $2, $4);  
+ | CSIZEOF  unaryExpr                      { $$ = exprNode_sizeofExpr ($2); lltok_free ($1); }
  | CALIGNOF TLPAREN typeExpression TRPAREN { $$ = exprNode_alignofType ($3); lltok_free3 ($1, $2, $4); } 
  | CALIGNOF unaryExpr                      { $$ = exprNode_alignofExpr ($2); lltok_free ($1); }
 ;
+
+
+
 castExpr
  : unaryExpr 
  | TLPAREN typeExpression TRPAREN castExpr 
@@ -1462,7 +1472,7 @@ suSpc
    structDeclList  DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
    TRBRACE 
    optStructInvariant 
-   { ctype ct; ct = declareStruct ($3, $8); context_setGlobalStructInfo(ct, $12); $$ = ct; } 
+   { ctype ct; ct = declareStruct ($3, $8); /* context_setGlobalStructInfo(ct, $12); */ $$ = ct; } 
  | NotType CUNION  newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
    CreateStructInnerScope 
    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } 
This page took 0.035858 seconds and 4 git commands to generate.