]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Attempt to silence harmless static analyzer warnings in Lemon and in the
authordrh <drh@noemail.net>
Sun, 20 Sep 2020 12:10:28 +0000 (12:10 +0000)
committerdrh <drh@noemail.net>
Sun, 20 Sep 2020 12:10:28 +0000 (12:10 +0000)
Lemon-generated parser.

FossilOrigin-Name: de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec

manifest
manifest.uuid
tool/lemon.c
tool/lempar.c

index 7a7c93c1438d81d9fdeb0c7e23abc0081686861b..dcc766b9644ae3f561cdcc4764479bde347c751b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stypo\sin\sthe\sdocumentation\scomment\sfor\ssqlite3_preupdate_hook().
-D 2020-09-17T21:11:25.177
+C Attempt\sto\ssilence\sharmless\sstatic\sanalyzer\swarnings\sin\sLemon\sand\sin\sthe\nLemon-generated\sparser.
+D 2020-09-20T12:10:28.961
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1799,8 +1799,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
 F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
 F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
-F tool/lemon.c 28a0641683fa8786dd52d401f2b99727a0137832ebe97d822de6a493fe658abc
-F tool/lempar.c 70243f14640759cb1a8f048024daa5e54505e80e79ec02bc979edfd1a7c5e810
+F tool/lemon.c a20eb41b9acd452211e10e769d7b679db0b023e2f1722bcd571c7142353ba812
+F tool/lempar.c 3de93047419c03240e680ab4d47f15aabb136e728540a07efbe9eee867fa4b31
 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
 F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca
@@ -1880,7 +1880,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c666c85a433fbc83edef4dbfb0399672e570f5d7979ab61cb39ff5488595d822
-R e4b1233394b3f971fe6857532e618b21
-U dan
-Z b4f246e815a6b5019523f3bd510ab2ce
+P 4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
+R 124e67bad8553faf5aee7db449f4027c
+U drh
+Z f070be8086929fecf605cec35180f31a
index a591dd9ce20dc3663dc155d25720a4e825e3c758..c8292e44a1af85b84cb91f6b528fc3a4d37c98fc 100644 (file)
@@ -1 +1 @@
-4542d194e2fef5e21e1c3679914bd9e21fab31cfb111cf640524fb3514a8afa3
\ No newline at end of file
+de8ce22a46c90afa5475cd24c28b7a82b26410dc72d662af2f9d9e5e528e0eec
\ No newline at end of file
index 82531362e70eb0c1c1e568f446579ca5bf3a9343..a2796c94f2b5af11d7ad9d27fbd4b1cfe63e7279 100644 (file)
@@ -1598,7 +1598,7 @@ static struct rule *Rule_sort(struct rule *rp){
   while( rp ){
     pNext = rp->next;
     rp->next = 0;
-    for(i=0; i<sizeof(x)/sizeof(x[0]) && x[i]; i++){
+    for(i=0; i<sizeof(x)/sizeof(x[0])-1 && x[i]; i++){
       rp = Rule_merge(x[i], rp);
       x[i] = 0;
     }
@@ -3518,7 +3518,7 @@ PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
 {
   const char *pathlist;
   char *pathbufptr;
-  char *pathbuf;
+  char *pathbuf = 0;
   char *path,*cp;
   char c;
 
@@ -3552,8 +3552,8 @@ PRIVATE char *pathsearch(char *argv0, char *name, int modemask)
         else pathbuf = &cp[1];
         if( access(path,modemask)==0 ) break;
       }
-      free(pathbufptr);
     }
+    free(pathbufptr);
   }
   return path;
 }
@@ -3637,6 +3637,7 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
   char buf[1000];
   FILE *in;
   char *tpltname;
+  char *toFree = 0;
   char *cp;
 
   /* first, see if user specified a template filename on the command line. */
@@ -3668,7 +3669,7 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
   }else if( access(templatename,004)==0 ){
     tpltname = templatename;
   }else{
-    tpltname = pathsearch(lemp->argv0,templatename,0);
+    toFree = tpltname = pathsearch(lemp->argv0,templatename,0);
   }
   if( tpltname==0 ){
     fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
@@ -3678,10 +3679,10 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
   }
   in = fopen(tpltname,"rb");
   if( in==0 ){
-    fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
+    fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname);
     lemp->errorcnt++;
-    return 0;
   }
+  free(toFree);
   return in;
 }
 
index 079635b21f0ee3bcc23399ae500435074f69d509..9a4854857445f20bcc81df42718d0d75f36642eb 100644 (file)
@@ -718,8 +718,10 @@ static YYACTIONTYPE yy_reduce(
   (void)yyLookahead;
   (void)yyLookaheadToken;
   yymsp = yypParser->yytos;
+  assert( yyruleno>=0 );
+  assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
 #ifndef NDEBUG
-  if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+  if( yyTraceFILE ){
     yysize = yyRuleInfoNRhs[yyruleno];
     if( yysize ){
       fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",