]> andersk Git - splint.git/commitdiff
Fixed bug preventing +showconstraintlocation from being the default.
authordrl7x <drl7x>
Tue, 5 Feb 2002 02:36:57 +0000 (02:36 +0000)
committerdrl7x <drl7x>
Tue, 5 Feb 2002 02:36:57 +0000 (02:36 +0000)
Update the test cases accordingly.

14 files changed:
src/Headers/cstring.h
src/constraint.c
src/context.c
src/cstring.c
src/flags.def
test/constannot.expect
test/for.expect
test/maxset.expect
test/moreBufferTests.expect
test/moreBufferTests2.expect
test/mystrncat.expect
test/null6.lcd
test/simplebufferConstraintTests.expect
test/tests2.5/newlint.lcd

index 76a127cc2486bc7ea98ca0d72387043fd14281b2..cc1bcbd760c34f56f2d81da1a5f8807f5562d372 100644 (file)
@@ -211,6 +211,12 @@ extern int cstring_compareLit (/*@unique@*/ cstring p_c, char *p_sub) /*@*/ ;
 # define cstring_compareLit(c,sub) \
   (cstring_compare (c, cstring_fromChars (sub)))
 
+/*drl added 2/4/2002*/
+/*replaces every instance of the character old with the character new
+  old can not be '\0'
+*/
+cstring cstring_replaceChar(/*@returned@*/ cstring p_c, char p_oldChar, char p_newChar);
+
 # else
 # error "Multiple include"
 # endif
index 24596df56a1ef4810d35ba78871df9fce4b2f97f..605875daf7fc34c49f7d1e7f79616d1e0294f761 100644 (file)
@@ -666,6 +666,12 @@ void constraint_printErrorPostCondition (constraint c, fileloc loc)
 
   temp = constraint_getFileloc (c);
 
+    
+  if (context_getFlag (FLG_BOUNDSCOMPACTERRORMESSAGES ) )
+    {
+      string = cstring_replaceChar(string, '\n', ' ');
+    }
+  
   if (fileloc_isDefined (temp))
     {
       errorLoc = temp;
@@ -727,7 +733,14 @@ void constraint_printError (constraint c, fileloc loc)
       fileloc_free (temp);
       errorLoc = fileloc_copy (errorLoc);
     }
-      
+
+  
+  if (context_getFlag (FLG_BOUNDSCOMPACTERRORMESSAGES ) )
+    {
+      string = cstring_replaceChar(string, '\n', ' ');
+    }
+
+
   if (c->post)
     {
       voptgenerror (FLG_FUNCTIONPOST, string, errorLoc);
@@ -814,7 +827,7 @@ cstring  constraint_printDetailed (constraint c)
 {
   cstring st = cstring_undefined;
   cstring temp = cstring_undefined;
-    cstring genExpr;
+  cstring genExpr;
   
   if (!c->post)
     {
index 361692a8f820e29f4b778b3336498129c9452504..d91d0ab09ad495fab2ca263738194c9d3feb8c89 100644 (file)
@@ -914,7 +914,10 @@ context_resetAllFlags (void)
   /*
     Changed for 3.0.0.19
    */
-  gc.flags[FLG_ORCONSTRAINT] = TRUE;
+
+  /* commenting ou until some output issues are fixed */
+  /*  gc.flags[FLG_ORCONSTRAINT] = TRUE;*/
+  
   gc.flags[FLG_CONSTRAINTLOCATION] = TRUE;
 
   /*drl 1/18/2002*/
index 987e58b470408185f37c191e2b134b8188d83c1d..a0d08659e843f8a44269d6346ca4d23079e324d4 100644 (file)
@@ -1074,3 +1074,23 @@ int  cstring_lengthExpandEscapes (cstring s)
 
 
 
+cstring cstring_replaceChar(/*@returned@*/ cstring c, char oldChar, char newChar)
+{
+  char *ptr;
+  llassert(oldChar != '\0');
+  if (cstring_isUndefined(c) )
+    {
+      llcontbug(cstring_makeLiteral("cstring_replaceChar called with undefined string"));
+      return c;
+    }
+  
+  ptr = c;
+  while (*ptr != '\0')
+    {
+      if (*ptr == oldChar)
+       *ptr = newChar;
+      ptr++;
+    }
+
+  return c;
+}
index 3b0295935a6a0f71155ce24266cebbda31c97a86..2ef3bce8772edeb1dfc5303cc26ac5cc31fc2b94 100644 (file)
@@ -1854,7 +1854,7 @@ static flaglist flags =
     "Memory read or write may be out of bounds of allocated storage.", 0, 0
   },
   {
-    FK_BOUNDS, FK_MEMORY, modeFlag,
+    FK_BOUNDS, FK_MEMORY, plainFlag,
     "boundsread",
     FLG_BOUNDSREAD,
     "possible out of bounds read",
@@ -1862,7 +1862,7 @@ static flaglist flags =
     0, 0
   },
   {
-    FK_BOUNDS, FK_MEMORY, modeFlag,
+    FK_BOUNDS, FK_MEMORY, plainFlag,
     "boundswrite",
     FLG_BOUNDSWRITE,
     "possible buffer overflow from an out of bounds write",
@@ -1871,7 +1871,7 @@ static flaglist flags =
   },
   
   {
-    FK_BOUNDS, FK_DISPLAY, modeFlag,
+    FK_BOUNDS, FK_DISPLAY, plainFlag,
     "fcnpost",
     FLG_FUNCTIONPOST,
     "display function post conditions",
@@ -1879,7 +1879,7 @@ static flaglist flags =
     0, 0
   },
   {
-    FK_BOUNDS, FK_DISPLAY, modeFlag,
+    FK_BOUNDS, FK_DISPLAY, plainFlag,
     "redundantconstraints",
     FLG_REDUNDANTCONSTRAINTS,
     "display seemingly redundant constraints",
@@ -1897,7 +1897,7 @@ static flaglist flags =
   },
 
   {
-    FK_BOUNDS, FK_MEMORY, modeFlag,
+    FK_BOUNDS, FK_MEMORY, plainFlag,
     "implictconstraint",
     FLG_IMPLICTCONSTRAINT,
     "generate implicit constraints for functions",
@@ -1906,7 +1906,7 @@ static flaglist flags =
   },
   /*drl7x added 4/29/01 */    
   {
-    FK_BOUNDS, FK_MEMORY, modeFlag,
+    FK_BOUNDS, FK_MEMORY, plainFlag,
     "orconstraint",
     FLG_ORCONSTRAINT,
     "use limited OR expressions to resolve constraints",
@@ -1915,7 +1915,7 @@ static flaglist flags =
   },
   
   {
-    FK_BOUNDS, FK_MEMORY, modeFlag,
+    FK_BOUNDS, FK_MEMORY, plainFlag,
     "nullterminated",
     FLG_NULLTERMINATEDWARNING,
     "misuse of nullterminated allocation",
@@ -1924,15 +1924,24 @@ static flaglist flags =
   },
   
   {
-    FK_BOUNDS, FK_DISPLAY, modeFlag,
+    FK_BOUNDS, FK_DISPLAY, plainFlag,
     "showconstraintparens",
     FLG_PARENCONSTRAINT,
     "display parentheses around constraint terms",
     NULL,
     0, 0
   },  
+  /*drl added 2/4/2002*/
+  {
+    FK_BOUNDS, FK_DISPLAY, plainFlag,
+    "boundscompacterrormessages",
+    FLG_BOUNDSCOMPACTERRORMESSAGES,
+    "Display fewer new lines in bounds checking error messages",
+    NULL,
+    0, 0
+  },  
   {
-    FK_BOUNDS, FK_DISPLAY, modeFlag,
+    FK_BOUNDS, FK_DISPLAY, plainFlag,
     "showconstraintlocation",
     FLG_CONSTRAINTLOCATION,
     "display location for every constraint generated",
@@ -4154,7 +4163,7 @@ static flaglist flags =
     NULL, 0, 0
   },
   {
-    FK_DEBUG, FK_BOUNDS, modeFlag,
+    FK_DEBUG, FK_BOUNDS, plainFlag,
     "debugfcnconstraint",
     FLG_DEBUGFUNCTIONCONSTRAINT,
     "debug function constraints",
index 1c530c40201719e4caee569a3989588fbf1316f7..6cb0756339a74f3cce8ea1dad755371f04af1289 100644 (file)
@@ -1,12 +1,14 @@
 
 constannot.c: (in function foo2)
 constannot.c:11:3: Possible out-of-bounds store:
+    str[20]
     Unable to resolve constraint:
     requires maxSet(str @ constannot.c:11:3) >= 20
      needed to satisfy precondition:
     requires maxSet(str @ constannot.c:11:3) >= 20
 constannot.c: (in function foo3)
 constannot.c:20:3: Possible out-of-bounds store:
+    foo(buf)
     Unable to resolve constraint:
     requires <const int=20> <= 19
      needed to satisfy precondition:
index cccbaf1065c96aa60c33ec98db885f2ae1a1737d..e75990d2de3f28b254fbf0c67db3df51efa56171 100644 (file)
@@ -1,6 +1,7 @@
 
 for.c: (in function f)
 for.c:13:5: Possible out-of-bounds store:
+    t[i]
     Unable to resolve constraint:
     requires i @ for.c:13:7 <= 10
      needed to satisfy precondition:
index 33755b2405ea083b490f6c52d94c386c0ffd56c0..6a34ab0d7a6eab3950ca2cde0269387e4fb0f5ec 100644 (file)
@@ -3,6 +3,7 @@ Finished checking --- no warnings
 
 maxsetnoannotations.c: (in function noancopy)
 maxsetnoannotations.c:2:3: Possible out-of-bounds store:
+    strcpy(a, b)
     Unable to resolve constraint:
     requires maxSet(a @ maxsetnoannotations.c:2:11) >= maxRead(b @
     maxsetnoannotations.c:2:13)
index a3e9829a0f250372dda6f94ca8d4d70c97a653e4..4ac254252371e02207a2468220107391635cd7e5 100644 (file)
@@ -4,23 +4,27 @@ unrecogCall.c:8:3: Unrecognized identifier: bar
 initialization.c: (in function initialization)
 initialization.c:5:10: Variable g declared but not used
 initialization.c:5:14: Possible out-of-bounds read:
+    e[22]
     Unable to resolve constraint:
     requires maxRead(d @ initialization.c:3:14) >= 22
      needed to satisfy precondition:
     requires maxRead(e @ initialization.c:5:14) >= 22
 initialization.c:8:3: Possible out-of-bounds store:
+    f[2]
     Unable to resolve constraint:
     requires maxSet(d @ initialization.c:3:14) >= 2
      needed to satisfy precondition:
     requires maxSet(f @ initialization.c:8:3) >= 2
 simplifyTest.c: (in function fooSub)
 simplifyTest.c:3:3: Possible out-of-bounds store:
+    s[i]
     Unable to resolve constraint:
     requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5
      needed to satisfy precondition:
     requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5
 simplifyTest.c: (in function fooAdd)
 simplifyTest.c:10:3: Possible out-of-bounds store:
+    s[i + 2]
     Unable to resolve constraint:
     requires maxSet(s @ simplifyTest.c:10:3) >= i @ simplifyTest.c:10:5 + 2
      needed to satisfy precondition:
@@ -29,6 +33,7 @@ strncatNotReallyGood.c: (in function NotGoodfunc)
 strncatNotReallyGood.c:4:29: Passed storage buffer not completely defined
                                 (*buffer is undefined): strncat (buffer, ...)
 strncatNotReallyGood.c:4:21: Possible out-of-bounds store:
+    strncat(buffer, str, sizeof((buffer)) - 1)
     Unable to resolve constraint:
     requires maxRead(buffer @ strncatNotReallyGood.c:4:29) <= 0
      needed to satisfy precondition:
index c95ca7d03bc58d1be4ee8313420bdb3ce12a4dd7..78bc399897e0ac957d538aa6e283893ff2da131c 100644 (file)
@@ -1,6 +1,7 @@
 
 unknownsize.c: (in function uknSize1)
 unknownsize.c:9:3: Possible out-of-bounds store:
+    c[9]
     Unable to resolve constraint:
     requires maxSet(c @ unknownsize.c:9:3) >= 9
      needed to satisfy precondition:
@@ -10,6 +11,7 @@ Finished checking --- 1 code warning, as expected
 
 fixedArrayType.c: (in function fixedArrayTouch)
 fixedArrayType.c:9:3: Possible out-of-bounds store:
+    buffer[sizeof(Array) - 1]
     Unable to resolve constraint:
     requires sizeof(Array) @ fixedArrayType.c:9:23 <= 10
      needed to satisfy precondition:
index 848c8dd74e47ed2ead748886c603dc7dae6fe277..065c32c49edf3a6e947621e5c2d5bc45af5230d0 100644 (file)
@@ -5,6 +5,7 @@ mystrncat.c:12:13: Passed storage buffer not completely defined (*buffer is
 mystrncat.c:13:13: Passed storage b not completely defined (*b is undefined):
                       mystrncat (b, ...)
 mystrncat.c:12:3: Possible out-of-bounds store:
+    mystrncat(buffer, str, sizeof((buffer)) - 1)
     Unable to resolve constraint:
     requires maxRead(buffer @ mystrncat.c:12:13) <= 0
      needed to satisfy precondition:
@@ -13,6 +14,7 @@ mystrncat.c:12:3: Possible out-of-bounds store:
      derived from mystrncat precondition:
     requires maxSet(<parameter 1>) >= maxRead(<parameter 1>) + <parameter 3>
 mystrncat.c:13:3: Possible out-of-bounds store:
+    mystrncat(b, str, sizeof((buffer)) - 1)
     Unable to resolve constraint:
     requires maxRead(malloc(256) @ mystrncat.c:10:7) <= 0
      needed to satisfy precondition:
index cb73b87cd3df51c2a255c3940853207992ceddfb..76befd8f6f8c7422eaf40f253f74111a39204cf4 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Splint Library  null6.lcd
 ;;Splint 3.0.1.4 --- 19 Jan 2002
-;;lib:298
+;;lib:299
 ;;ctTable
 0 u-2 19 38
 0 p1|-2 20 39
index c81ec83d3513e707ba106fcd5bb31975fada0253..e5e79d450575f9ba9fe39271585c0a2886f52b7f 100644 (file)
@@ -4,6 +4,7 @@ m.c:9:1: Index of possibly null pointer f: f
    m.c:8:5: Storage f may become null
 sizeof.c: (in function f)
 sizeof.c:17:1: Possible out-of-bounds store:
+    x[(sizeof(x))]
     Unable to resolve constraint:
     requires 2 >= 3
      needed to satisfy precondition:
@@ -12,6 +13,7 @@ test3.c:2:6: Function t defined more than once
    m.c:11:1: Previous definition of t
 test3.c: (in function t)
 test3.c:9:3: Possible out-of-bounds store:
+    g[101]
     Unable to resolve constraint:
     requires 99 >= 101
      needed to satisfy precondition:
@@ -20,11 +22,13 @@ test7.c:2:6: Function t defined more than once
    m.c:11:1: Previous definition of t
 test7.c: (in function t)
 test7.c:6:3: Possible out-of-bounds store:
+    g[2]
     Unable to resolve constraint:
     requires maxSet(g @ test7.c:4:3) >= 4
      needed to satisfy precondition:
     requires maxSet(g @ test7.c:6:3) >= 2
 test7.c:8:3: Possible out-of-bounds store:
+    j[0]
     Unable to resolve constraint:
     requires maxSet(j @ test7.c:8:3) >= 0
      needed to satisfy precondition:
index 0a47c7945298312ff0631d0e1bedd7115b31cd2a..24272eaaf88b0537117c6d528b7fb8351bf9649e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Splint Library  newlint.lcd
 ;;Splint 3.0.1.4 --- 19 Jan 2002
-;;lib:298
+;;lib:299
 ;;ctTable
 0 u-2 19 38
 0 p1|-2 20 39
This page took 0.321618 seconds and 5 git commands to generate.