]> andersk Git - splint.git/blobdiff - src/exprNode.c
*** empty log message ***
[splint.git] / src / exprNode.c
index ee2dcacc8713b174cd1bbf7e0a5deddaf579e319..e9f4375398ac3b8f0a560dedb45a2f1e0f69b0f9 100644 (file)
@@ -4249,53 +4249,54 @@ exprNode_postOp (/*@only@*/ exprNode e, /*@only@*/ lltok op)
   /*DRL 6/8/01 I decided to disable all LCLint Warning here since the code 
     probably needs a rewrite any way */
 
+  /*@i65234@*/
   /*@ignore@*/
 
-  //  updateEnvironmentForPostOp (e);
-
-       /* start modifications */
-       /* added by Seejo on 4/16/2000 */
-
-       /* Arithmetic operations on pointers wil modify the size/len/null terminated 
-                status */
-       if ((sRef_isPossiblyNullTerminated (e->sref)) || (sRef_isNullTerminated(e->sref))) {
-
-               ret->sref = sRef_copy (e->sref);
-
-               /* Operator : ++ */
-               if (lltok_getTok (op) == INC_OP) {
-                       if (sRef_getSize(e->sref) > 0) {
-
-                               sRef_setSize (ret->sref, sRef_getSize(e->sref) - 1);
-                               
-                               if (sRef_getLen(e->sref) == 1) { /* i.e. the first character is \0 */
-                                       /* Assumption: there is only 1 \0 in the buffer */
-                                       /* This will not be correct if there are 2 \0's in the buffer */
-                                       sRef_setNotNullTerminatedState(ret->sref);
-                                       sRef_resetLen(ret->sref);
-                               } else {
-                                       sRef_setNullTerminatedState(ret->sref);
-                                       sRef_setLen (ret->sref, sRef_getLen(e->sref) - 1);
-                               }
-                               if (sRef_isNullTerminated (ret->sref))
-                                       printf ("ret->sref is Null Terminated\n");
-                               else if (sRef_isPossiblyNullTerminated (ret->sref))
-                                       printf ("ret->sref is Possibly Null Terminated\n");
-                               else if (sRef_isNotNullTerminated (ret->sref))
-                                       printf ("ret->sref is Not Null Terminated\n");
-                       }
-               }
-
-               /* Operator : -- */
-               if (lltok_getTok (op) == DEC_OP) {
-                       if (sRef_getSize(e->sref) >= 0) {
-                               sRef_setSize (ret->sref, sRef_getSize(e->sref) + 1);
-                               sRef_setLen (ret->sref, sRef_getLen(e->sref) + 1);
-                       }
-               }
-       }
-       /*@end@*/
-       /* end modifications */
+  /* updateEnvironmentForPostOp (e); */
+  
+  /* start modifications */
+  /* added by Seejo on 4/16/2000 */
+  
+  /* Arithmetic operations on pointers wil modify the size/len/null terminated 
+     status */
+  if ((sRef_isPossiblyNullTerminated (e->sref)) || (sRef_isNullTerminated(e->sref))) {
+    
+    ret->sref = sRef_copy (e->sref);
+    
+    /* Operator : ++ */
+    if (lltok_getTok (op) == INC_OP) {
+      if (sRef_getSize(e->sref) > 0) {
+       
+       sRef_setSize (ret->sref, sRef_getSize(e->sref) - 1);
+       
+       if (sRef_getLen(e->sref) == 1) { /* i.e. the first character is \0 */
+         /* Assumption: there is only 1 \0 in the buffer */
+         /* This will not be correct if there are 2 \0's in the buffer */
+         sRef_setNotNullTerminatedState(ret->sref);
+         sRef_resetLen(ret->sref);
+       } else {
+         sRef_setNullTerminatedState(ret->sref);
+         sRef_setLen (ret->sref, sRef_getLen(e->sref) - 1);
+       }
+       if (sRef_isNullTerminated (ret->sref))
+         printf ("ret->sref is Null Terminated\n");
+       else if (sRef_isPossiblyNullTerminated (ret->sref))
+         printf ("ret->sref is Possibly Null Terminated\n");
+       else if (sRef_isNotNullTerminated (ret->sref))
+         printf ("ret->sref is Not Null Terminated\n");
+      }
+    }
+    
+    /* Operator : -- */
+    if (lltok_getTok (op) == DEC_OP) {
+      if (sRef_getSize(e->sref) >= 0) {
+       sRef_setSize (ret->sref, sRef_getSize(e->sref) + 1);
+       sRef_setLen (ret->sref, sRef_getLen(e->sref) + 1);
+      }
+    }
+  }
+  /*@end@*/
+  /* end modifications */
 
   return ret;
 }
@@ -5271,10 +5272,6 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
              /* Arithmetic operations on pointers wil modify the size/len/null terminated 
                 status */
              if ((sRef_isPossiblyNullTerminated (e1->sref)) || (sRef_isNullTerminated(e1->sref))) {
-                               //if (sRef_isKnown (e->sref)) {
-                               //ret->sref = sRef_makeAddress (e->sref);
-                               //}
-               
                int val;
                /*drl 1-4-2001
                  added ugly fixed to stop
@@ -5365,56 +5362,52 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
                                 status */
 
            if ((sRef_isPossiblyNullTerminated (e2->sref)) || (sRef_isNullTerminated(e2->sref))) {
-                               //if (sRef_isKnown (e->sref)) {
-                               //ret->sref = sRef_makeAddress (e->sref);
-                               //}
-
-                        int val = (int) multiVal_forceInt (e1->val);
-
-                       /* Operator : + or += */
-                   if ((lltok_getTok (op) == TPLUS) || (lltok_getTok(op) == ADD_ASSIGN)) {
-                               if (sRef_getSize(e2->sref) >= val) {/* Incrementing the pointer by 
-                                                                                                                                          val should not result in a 
-                                                                                                                                                  size < 0 (size = 0 is ok !) */
-                                       
-                                       sRef_setSize (ret->sref, sRef_getSize(e2->sref) - val);
-                                       
-                                       if (sRef_getLen(e2->sref) == val) { /* i.e. the character at posn val is \0 */
-                                               sRef_setNotNullTerminatedState(ret->sref);
-                                               sRef_resetLen (ret->sref);
-                                       } else {
-                                               sRef_setNullTerminatedState(ret->sref);
-                                               sRef_setLen (ret->sref, sRef_getLen(e2->sref) - val);
-                                       }
-                               }
-                       }
-                       
-                       /* Operator : - or -= */
-                        if ((lltok_getTok (op) == TMINUS) || (lltok_getTok (op) == SUB_ASSIGN)) {
-                               if (sRef_getSize(e2->sref) >= 0) {
-                                       sRef_setSize (ret->sref, sRef_getSize(e2->sref) + val);
-                                       sRef_setLen (ret->sref, sRef_getLen(e2->sref) + val);
-                               }
-                       }
-                }
-
-           /* end modifications */
-
-             sRef_setNullError (ret->sref);
-
-             /*
-             ** Fixed for 2.2c: the alias state of ptr + int is dependent,
-             ** since is points to storage that should not be deallocated
-             ** through this pointer.
-             */
-
-             if (sRef_isOnly (ret->sref) 
-                 || sRef_isFresh (ret->sref)) {
-               sRef_setAliasKind (ret->sref, AK_DEPENDENT, exprNode_loc (ret));
+             int val = (int) multiVal_forceInt (e1->val);
+             
+             /* Operator : + or += */
+             if ((lltok_getTok (op) == TPLUS) || (lltok_getTok(op) == ADD_ASSIGN)) {
+               if (sRef_getSize(e2->sref) >= val) {/* Incrementing the pointer by 
+                                                      val should not result in a 
+                                                      size < 0 (size = 0 is ok !) */
+                 
+                 sRef_setSize (ret->sref, sRef_getSize(e2->sref) - val);
+                 
+                 if (sRef_getLen(e2->sref) == val) { /* i.e. the character at posn val is \0 */
+                   sRef_setNotNullTerminatedState(ret->sref);
+                   sRef_resetLen (ret->sref);
+                 } else {
+                   sRef_setNullTerminatedState(ret->sref);
+                   sRef_setLen (ret->sref, sRef_getLen(e2->sref) - val);
+                 }
+               }
              }
-
-             tret = e2->typ;
-             ret->sref = e2->sref;
+             
+             /* Operator : - or -= */
+             if ((lltok_getTok (op) == TMINUS) || (lltok_getTok (op) == SUB_ASSIGN)) {
+               if (sRef_getSize(e2->sref) >= 0) {
+                 sRef_setSize (ret->sref, sRef_getSize(e2->sref) + val);
+                 sRef_setLen (ret->sref, sRef_getLen(e2->sref) + val);
+               }
+             }
+           }
+           
+           /* end modifications */
+           
+           sRef_setNullError (ret->sref);
+           
+           /*
+           ** Fixed for 2.2c: the alias state of ptr + int is dependent,
+           ** since is points to storage that should not be deallocated
+           ** through this pointer.
+           */
+           
+           if (sRef_isOnly (ret->sref) 
+               || sRef_isFresh (ret->sref)) {
+             sRef_setAliasKind (ret->sref, AK_DEPENDENT, exprNode_loc (ret));
+           }
+           
+           tret = e2->typ;
+           ret->sref = e2->sref;
            }
          else
            {
@@ -10746,8 +10739,9 @@ long exprNode_getLongValue (exprNode e) {
     lltok t = exprData_getUopTok (e->edata);
     return fileloc_copy(lltok_getLoc (t));
   } else {
-    //drl possible problem : warning fix
-    //    llcontbug (message ("Cannot get next sequence point: %s", exprNode_unparse (e)));
+    /* drl possible problem : warning fix
+       llcontbug (message ("Cannot get next sequence point: %s", exprNode_unparse (e)));
+    */
     return fileloc_undefined;
   }
  }
This page took 0.163966 seconds and 4 git commands to generate.