/ Check-in [5023b1b8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes for various harmless compiler warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366
User & Date: drh 2018-07-09 22:49:01
Context
2018-07-10
05:11
New VDBE comments and coverage macros. check-in: a9a30726 user: drh tags: trunk
2018-07-09
22:49
Fixes for various harmless compiler warnings. check-in: 5023b1b8 user: drh tags: trunk
20:58
Add a comment to restriction (6) of the push-down optimization. No changes to code. check-in: 0c8a2f25 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/json1.c.

  1843   1843     int argc,
  1844   1844     sqlite3_value **argv
  1845   1845   ){
  1846   1846     int i;
  1847   1847     int inStr = 0;
  1848   1848     char *z;
  1849   1849     JsonString *pStr;
         1850  +  UNUSED_PARAM(argc);
         1851  +  UNUSED_PARAM(argv);
  1850   1852     pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
  1851   1853   #ifdef NEVER
  1852   1854     /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
  1853   1855     ** always have been called to initalize it */
  1854   1856     if( NEVER(!pStr) ) return;
  1855   1857   #endif
  1856   1858     z = pStr->zBuf;

Changes to src/func.c.

  1667   1667         sqlite3_result_value(context, pRes);
  1668   1668       }
  1669   1669       if( bValue==0 ) sqlite3VdbeMemRelease(pRes);
  1670   1670     }
  1671   1671   }
  1672   1672   #ifndef SQLITE_OMIT_WINDOWFUNC
  1673   1673   static void minMaxValue(sqlite3_context *context){
  1674         -  return minMaxValueFinalize(context, 1);
         1674  +  minMaxValueFinalize(context, 1);
  1675   1675   }
  1676   1676   #else
  1677   1677   # define minMaxValue 0
  1678   1678   #endif /* SQLITE_OMIT_WINDOWFUNC */
  1679   1679   static void minMaxFinalize(sqlite3_context *context){
  1680         -  return minMaxValueFinalize(context, 0);
         1680  +  minMaxValueFinalize(context, 0);
  1681   1681   }
  1682   1682   
  1683   1683   /*
  1684   1684   ** group_concat(EXPR, ?SEPARATOR?)
  1685   1685   */
  1686   1686   static void groupConcatStep(
  1687   1687     sqlite3_context *context,
................................................................................
  1718   1718   #ifndef SQLITE_OMIT_WINDOWFUNC
  1719   1719   static void groupConcatInverse(
  1720   1720     sqlite3_context *context,
  1721   1721     int argc,
  1722   1722     sqlite3_value **argv
  1723   1723   ){
  1724   1724     int n;
  1725         -  assert( argc==1 || argc==2 );
  1726   1725     StrAccum *pAccum;
         1726  +  assert( argc==1 || argc==2 );
  1727   1727     if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  1728   1728     pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum));
  1729   1729     /* pAccum is always non-NULL since groupConcatStep() will have always
  1730   1730     ** run frist to initialize it */
  1731   1731     if( ALWAYS(pAccum) ){
  1732   1732       n = sqlite3_value_bytes(argv[0]);
  1733   1733       if( argc==2 ){
  1734   1734         n += sqlite3_value_bytes(argv[1]);
  1735   1735       }else{
  1736   1736         n++;
  1737   1737       }
  1738         -    if( n>=pAccum->nChar ){
         1738  +    if( n>=(int)pAccum->nChar ){
  1739   1739         pAccum->nChar = 0;
  1740   1740       }else{
  1741   1741         pAccum->nChar -= n;
  1742   1742         memmove(pAccum->zText, &pAccum->zText[n], pAccum->nChar);
  1743   1743       }
  1744   1744       if( pAccum->nChar==0 ) pAccum->mxAlloc = 0;
  1745   1745     }

Changes to src/main.c.

  1736   1736     
  1737   1737     /* Check if an existing function is being overridden or deleted. If so,
  1738   1738     ** and there are active VMs, then return SQLITE_BUSY. If a function
  1739   1739     ** is being overridden/deleted but there are no active VMs, allow the
  1740   1740     ** operation to continue but invalidate all precompiled statements.
  1741   1741     */
  1742   1742     p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0);
  1743         -  if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==enc && p->nArg==nArg ){
         1743  +  if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){
  1744   1744       if( db->nVdbeActive ){
  1745   1745         sqlite3ErrorWithMsg(db, SQLITE_BUSY, 
  1746   1746           "unable to delete/modify user-function due to active statements");
  1747   1747         assert( !db->mallocFailed );
  1748   1748         return SQLITE_BUSY;
  1749   1749       }else{
  1750   1750         sqlite3ExpirePreparedStatements(db);

Changes to src/parse.y.

   543    543     A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L);
   544    544   #ifndef SQLITE_OMIT_WINDOWFUNC
   545    545     if( A ){
   546    546       A->pWinDefn = R;
   547    547     }else{
   548    548       sqlite3WindowListDelete(pParse->db, R);
   549    549     }
   550         -#endif // SQLITE_OMIT_WINDOWFUNC
          550  +#endif /* SQLITE_OMIT_WINDOWFUNC */
   551    551   #if SELECTTRACE_ENABLED
   552    552     /* Populate the Select.zSelName[] string that is used to help with
   553    553     ** query planner debugging, to differentiate between multiple Select
   554    554     ** objects in a complex query.
   555    555     **
   556    556     ** If the SELECT keyword is immediately followed by a C-style comment
   557    557     ** then extract the first few alphanumeric characters from within that
................................................................................
  1698   1698     }else{
  1699   1699       sqlite3ExprDelete(pParse->db, W);
  1700   1700     }
  1701   1701   }
  1702   1702   
  1703   1703   filter_opt(A) ::= .                            { A = 0; }
  1704   1704   filter_opt(A) ::= FILTER LP WHERE expr(X) RP.  { A = X; }
  1705         -%endif // SQLITE_OMIT_WINDOWFUNC
         1705  +%endif /* SQLITE_OMIT_WINDOWFUNC */

Changes to src/tokenize.c.

   260    260   }
   261    261   static int analyzeFilterKeyword(const unsigned char *z, int lastToken){
   262    262     if( lastToken==TK_RP && getToken(&z)==TK_LP ){
   263    263       return TK_FILTER;
   264    264     }
   265    265     return TK_ID;
   266    266   }
   267         -#endif // SQLITE_OMIT_WINDOWFUNC
          267  +#endif /* SQLITE_OMIT_WINDOWFUNC */
   268    268   
   269    269   /*
   270    270   ** Return the length (in bytes) of the token that begins at z[0]. 
   271    271   ** Store the token type in *tokenType before returning.
   272    272   */
   273    273   int sqlite3GetToken(const unsigned char *z, int *tokenType){
   274    274     int i, c;
................................................................................
   600    600       if( tokenType>=TK_WINDOW ){
   601    601         assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER
   602    602              || tokenType==TK_ILLEGAL || tokenType==TK_WINDOW 
   603    603         );
   604    604   #else
   605    605       if( tokenType>=TK_SPACE ){
   606    606         assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );
   607         -#endif // SQLITE_OMIT_WINDOWFUNC
          607  +#endif /* SQLITE_OMIT_WINDOWFUNC */
   608    608         if( db->u1.isInterrupted ){
   609    609           pParse->rc = SQLITE_INTERRUPT;
   610    610           break;
   611    611         }
   612    612         if( tokenType==TK_SPACE ){
   613    613           zSql += n;
   614    614           continue;
................................................................................
   630    630           tokenType = analyzeWindowKeyword((const u8*)&zSql[6]);
   631    631         }else if( tokenType==TK_OVER ){
   632    632           assert( n==4 );
   633    633           tokenType = analyzeOverKeyword((const u8*)&zSql[4], lastTokenParsed);
   634    634         }else if( tokenType==TK_FILTER ){
   635    635           assert( n==6 );
   636    636           tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed);
   637         -#endif // SQLITE_OMIT_WINDOWFUNC
          637  +#endif /* SQLITE_OMIT_WINDOWFUNC */
   638    638         }else{
   639    639           sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql);
   640    640           break;
   641    641         }
   642    642       }
   643    643       pParse->sLastToken.z = zSql;
   644    644       pParse->sLastToken.n = n;

Changes to src/window.c.

   147    147   static void row_numberStepFunc(
   148    148     sqlite3_context *pCtx, 
   149    149     int nArg,
   150    150     sqlite3_value **apArg
   151    151   ){
   152    152     i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   153    153     if( p ) (*p)++;
          154  +  UNUSED_PARAMETER(nArg);
          155  +  UNUSED_PARAMETER(apArg);
   154    156   }
   155    157   static void row_numberValueFunc(sqlite3_context *pCtx){
   156    158     i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   157    159     sqlite3_result_int64(pCtx, (p ? *p : 0));
   158    160   }
   159    161   
   160    162   /*
................................................................................
   177    179     sqlite3_context *pCtx, 
   178    180     int nArg,
   179    181     sqlite3_value **apArg
   180    182   ){
   181    183     struct CallCount *p;
   182    184     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   183    185     if( p ) p->nStep = 1;
          186  +  UNUSED_PARAMETER(nArg);
          187  +  UNUSED_PARAMETER(apArg);
   184    188   }
   185    189   static void dense_rankValueFunc(sqlite3_context *pCtx){
   186    190     struct CallCount *p;
   187    191     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   188    192     if( p ){
   189    193       if( p->nStep ){
   190    194         p->nValue++;
................................................................................
   209    213     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   210    214     if( p ){
   211    215       p->nStep++;
   212    216       if( p->nValue==0 ){
   213    217         p->nValue = p->nStep;
   214    218       }
   215    219     }
          220  +  UNUSED_PARAMETER(nArg);
          221  +  UNUSED_PARAMETER(apArg);
   216    222   }
   217    223   static void rankValueFunc(sqlite3_context *pCtx){
   218    224     struct CallCount *p;
   219    225     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   220    226     if( p ){
   221    227       sqlite3_result_int64(pCtx, p->nValue);
   222    228       p->nValue = 0;
................................................................................
   231    237   */
   232    238   static void percent_rankStepFunc(
   233    239     sqlite3_context *pCtx, 
   234    240     int nArg,
   235    241     sqlite3_value **apArg
   236    242   ){
   237    243     struct CallCount *p;
   238         -  assert( nArg==1 );
          244  +  UNUSED_PARAMETER(nArg); assert( nArg==1 );
   239    245   
   240    246     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   241    247     if( p ){
   242    248       if( p->nTotal==0 ){
   243    249         p->nTotal = sqlite3_value_int64(apArg[0]);
   244    250       }
   245    251       p->nStep++;
................................................................................
   270    276   */
   271    277   static void cume_distStepFunc(
   272    278     sqlite3_context *pCtx, 
   273    279     int nArg,
   274    280     sqlite3_value **apArg
   275    281   ){
   276    282     struct CallCount *p;
   277         -  assert( nArg==1 );
          283  +  assert( nArg==1 ); UNUSED_PARAMETER(nArg);
   278    284   
   279    285     p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   280    286     if( p ){
   281    287       if( p->nTotal==0 ){
   282    288         p->nTotal = sqlite3_value_int64(apArg[0]);
   283    289       }
   284    290       p->nStep++;
................................................................................
   310    316   */
   311    317   static void ntileStepFunc(
   312    318     sqlite3_context *pCtx, 
   313    319     int nArg,
   314    320     sqlite3_value **apArg
   315    321   ){
   316    322     struct NtileCtx *p;
   317         -  assert( nArg==2 );
          323  +  assert( nArg==2 ); UNUSED_PARAMETER(nArg);
   318    324     p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   319    325     if( p ){
   320    326       if( p->nTotal==0 ){
   321    327         p->nParam = sqlite3_value_int64(apArg[0]);
   322    328         p->nTotal = sqlite3_value_int64(apArg[1]);
   323    329         if( p->nParam<=0 ){
   324    330           sqlite3_result_error(
................................................................................
   365    371   */
   366    372   static void last_valueStepFunc(
   367    373     sqlite3_context *pCtx, 
   368    374     int nArg,
   369    375     sqlite3_value **apArg
   370    376   ){
   371    377     struct LastValueCtx *p;
          378  +  UNUSED_PARAMETER(nArg);
   372    379     p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   373    380     if( p ){
   374    381       sqlite3_value_free(p->pVal);
   375    382       p->pVal = sqlite3_value_dup(apArg[0]);
   376    383       if( p->pVal==0 ){
   377    384         sqlite3_result_error_nomem(pCtx);
   378    385       }else{
................................................................................
   382    389   }
   383    390   static void last_valueInvFunc(
   384    391     sqlite3_context *pCtx, 
   385    392     int nArg,
   386    393     sqlite3_value **apArg
   387    394   ){
   388    395     struct LastValueCtx *p;
          396  +  UNUSED_PARAMETER(nArg);
          397  +  UNUSED_PARAMETER(apArg);
   389    398     p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p));
   390    399     if( ALWAYS(p) ){
   391    400       p->nVal--;
   392    401       if( p->nVal==0 ){
   393    402         sqlite3_value_free(p->pVal);
   394    403         p->pVal = 0;
   395    404       }
................................................................................
   442    451   ** invoked.
   443    452   */
   444    453   static void noopStepFunc(    /*NO_TEST*/
   445    454     sqlite3_context *p,        /*NO_TEST*/
   446    455     int n,                     /*NO_TEST*/
   447    456     sqlite3_value **a          /*NO_TEST*/
   448    457   ){                           /*NO_TEST*/
          458  +  UNUSED_PARAMETER(p);       /*NO_TEST*/
          459  +  UNUSED_PARAMETER(n);       /*NO_TEST*/
          460  +  UNUSED_PARAMETER(a);       /*NO_TEST*/
   449    461     assert(0);                 /*NO_TEST*/
   450    462   }                            /*NO_TEST*/
   451         -static void noopValueFunc(sqlite3_context *p){ /*no-op*/; }
          463  +static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ }
   452    464   
   453    465   /* Window functions that use all window interfaces: xStep, xFinal,
   454    466   ** xValue, and xInverse */
   455    467   #define WINDOWFUNCALL(name,nArg,extra) {                                   \
   456    468     nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0,                      \
   457    469     name ## StepFunc, name ## FinalizeFunc, name ## ValueFunc,               \
   458         -  name ## InvFunc, name ## Name                                            \
          470  +  name ## InvFunc, name ## Name, {0}                                       \
   459    471   }
   460    472   
   461    473   /* Window functions that are implemented using bytecode and thus have
   462    474   ** no-op routines for their methods */
   463    475   #define WINDOWFUNCNOOP(name,nArg,extra) {                                  \
   464    476     nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0,                      \
   465    477     noopStepFunc, noopValueFunc, noopValueFunc,                              \
   466         -  noopStepFunc, name ## Name                                               \
          478  +  noopStepFunc, name ## Name, {0}                                          \
   467    479   }
   468    480   
   469    481   /* Window functions that use all window interfaces: xStep, the
   470    482   ** same routine for xFinalize and xValue and which never call
   471    483   ** xInverse. */
   472    484   #define WINDOWFUNCX(name,nArg,extra) {                                     \
   473    485     nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0,                      \
   474    486     name ## StepFunc, name ## ValueFunc, name ## ValueFunc,                  \
   475         -  noopStepFunc, name ## Name                                               \
          487  +  noopStepFunc, name ## Name, {0}                                          \
   476    488   }
   477    489   
   478    490   
   479    491   /*
   480    492   ** Register those built-in window functions that are not also aggregates.
   481    493   */
   482    494   void sqlite3WindowFunctions(void){
................................................................................
   627    639       default: /* no-op */
   628    640         break;
   629    641     }
   630    642   
   631    643     return WRC_Continue;
   632    644   }
   633    645   static int selectWindowRewriteSelectCb(Walker *pWalker, Select *pSelect){
          646  +  UNUSED_PARAMETER(pWalker);
          647  +  UNUSED_PARAMETER(pSelect);
   634    648     return WRC_Prune;
   635    649   }
   636    650   
   637    651   
   638    652   /*
   639    653   ** Iterate through each expression in expression-list pEList. For each:
   640    654   **
................................................................................
  1539   1553     int addr;
  1540   1554     int csrStart = pParse->nTab++;
  1541   1555     int csrEnd = pParse->nTab++;
  1542   1556     int regStart;                    /* Value of <expr> PRECEDING */
  1543   1557     int regEnd;                      /* Value of <expr> FOLLOWING */
  1544   1558     int addrGoto;
  1545   1559     int addrTop;
  1546         -  int addrIfPos1;
  1547         -  int addrIfPos2;
         1560  +  int addrIfPos1 = 0;
         1561  +  int addrIfPos2 = 0;
  1548   1562     int regSize = 0;
  1549   1563   
  1550   1564     assert( pMWin->eStart==TK_PRECEDING 
  1551   1565          || pMWin->eStart==TK_CURRENT 
  1552   1566          || pMWin->eStart==TK_FOLLOWING 
  1553   1567          || pMWin->eStart==TK_UNBOUNDED 
  1554   1568     );
................................................................................
  1860   1874     sqlite3VdbeAddOp2(v, OP_Integer, 0, regCtr);
  1861   1875     sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
  1862   1876     VdbeCoverage(v);
  1863   1877     sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblEmpty);
  1864   1878     VdbeCoverageNeverTaken(v);
  1865   1879   
  1866   1880     if( bReverse ){
  1867         -    int addr = sqlite3VdbeCurrentAddr(v);
         1881  +    int addr2 = sqlite3VdbeCurrentAddr(v);
  1868   1882       windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize);
  1869         -    sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr);
         1883  +    sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr2);
  1870   1884       VdbeCoverage(v);
  1871   1885       sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty);
  1872   1886       VdbeCoverageNeverTaken(v);
  1873   1887     }
  1874   1888     addrNext = sqlite3VdbeCurrentAddr(v);
  1875   1889   
  1876   1890     if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){

Changes to tool/lempar.c.

   546    546           if( 
   547    547   #if YY_SHIFT_MIN+YYWILDCARD<0
   548    548             j>=0 &&
   549    549   #endif
   550    550   #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
   551    551             j<YY_ACTTAB_COUNT &&
   552    552   #endif
   553         -          j<sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) &&
          553  +          j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) &&
   554    554             yy_lookahead[j]==YYWILDCARD && iLookAhead>0
   555    555           ){
   556    556   #ifndef NDEBUG
   557    557             if( yyTraceFILE ){
   558    558               fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
   559    559                  yyTracePrompt, yyTokenName[iLookAhead],
   560    560                  yyTokenName[YYWILDCARD]);
................................................................................
  1062   1062   
  1063   1063   /*
  1064   1064   ** Return the fallback token corresponding to canonical token iToken, or
  1065   1065   ** 0 if iToken has no fallback.
  1066   1066   */
  1067   1067   int ParseFallback(int iToken){
  1068   1068   #ifdef YYFALLBACK
  1069         -  if( iToken<sizeof(yyFallback)/sizeof(yyFallback[0]) ){
         1069  +  if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
  1070   1070       return yyFallback[iToken];
  1071   1071     }
         1072  +#else
         1073  +  (void)iToken;
  1072   1074   #endif
  1073   1075     return 0;
  1074   1076   }