From c7bf57168adc18e165b84ea7be15f294a7ea6590 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 9 Jul 2018 22:49:01 +0000 Subject: [PATCH] Fixes for various harmless compiler warnings. FossilOrigin-Name: 5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366 --- ext/misc/json1.c | 2 ++ manifest | 24 ++++++++++++------------ manifest.uuid | 2 +- src/func.c | 8 ++++---- src/main.c | 2 +- src/parse.y | 4 ++-- src/tokenize.c | 6 +++--- src/window.c | 36 +++++++++++++++++++++++++----------- tool/lempar.c | 6 ++++-- 9 files changed, 54 insertions(+), 36 deletions(-) diff --git a/ext/misc/json1.c b/ext/misc/json1.c index 57b0f9c7c5..c7e0aab2d1 100644 --- a/ext/misc/json1.c +++ b/ext/misc/json1.c @@ -1847,6 +1847,8 @@ static void jsonGroupInverse( int inStr = 0; char *z; JsonString *pStr; + UNUSED_PARAM(argc); + UNUSED_PARAM(argv); pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); #ifdef NEVER /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will diff --git a/manifest b/manifest index 7b0030ce3a..b258cece78 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\scomment\sto\srestriction\s(6)\sof\sthe\spush-down\soptimization.\s\sNo\schanges\nto\scode. -D 2018-07-09T20:58:43.825 +C Fixes\sfor\svarious\sharmless\scompiler\swarnings. +D 2018-07-09T22:49:01.906 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6 @@ -281,7 +281,7 @@ F ext/misc/eval.c 6ea9b22a5fa0dd973b67ca4e53555be177bc0b7b263aadf1024429457c82c0 F ext/misc/fileio.c 48c7751c78fc4cdd29d8c862fd2f3f98bbfefa2a3cf1ca1496df4bf02eb8cded F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25 F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c -F ext/misc/json1.c f5dc3b295db0ce88549c3ba13c7433efecfb74b80087663c638e67c9c753e7f6 +F ext/misc/json1.c 933ace99a1880e014f35fbf6444fb24e3cf9920c3a6a75e9aa70f0caf683e3fe F ext/misc/memvfs.c ab36f49e02ebcdf85a1e08dc4d8599ea8f343e073ac9e0bca18a98b7e1ec9567 F ext/misc/mmapwarm.c 70b618f2d0bde43fae288ad0b7498a629f2b6f61b50a27e06fae3cd23c83af29 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 @@ -450,7 +450,7 @@ F src/delete.c 4c8c7604277a2041647f96b78f4b9a47858e9217e4fb333d35e7b5ab32c5b57f F src/expr.c 7e257eeffe9553c10a6ac0a1f0177bf740c4da834e7d6e2cbb7d3ebaa3d7f3e1 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c b1da9ef8dc834603bb0d28972378a7ce65897847f9a1e89ab800bbdf24c788ee -F src/func.c e94214037dbc9d258ece54434fe120b419880550239c80dcd101afe7b2a51131 +F src/func.c 7c288b4ce309b5a8b8473514b88e1f8e69a80134509a8c0db8e39c858e367e7f F src/global.c 9bf034fd560bdd514715170ed8460bb7f823cec113f0569ef3f18a20c7ccd128 F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 @@ -459,7 +459,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c bcacf6a0d277f8fa0e4f9ffecda544a2330ca4478f904cd89564c2dd86d0b16b F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e F src/loadext.c 6aae5739198d96c51ae6eb97c4a5b1744c22ed7a5a565a5399a717780d48a36b -F src/main.c f3d3ec74368c97bd6121bfc5c3bad2c6a4e82dbbd967f45dfaa5a2f33c253ca8 +F src/main.c db7d550fad3a95403f50d25cbdd8ec33037ed100e676f2481d58e0d9cf0f15dc F src/malloc.c 07295435093ce354c6d9063ac05a2eeae28bd251d2e63c48b3d67c12c76f7e18 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de @@ -484,7 +484,7 @@ F src/os_win.c ac29c25cde4cfb4adacc59cdec4aa45698ca0e29164ea127859585ccd9faa354 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f F src/pager.h c571b064df842ec8f2e90855dead9acf4cbe0d1b2c05afe0ef0d0145f7fd0388 -F src/parse.y a7e0fb377d6ef98245cd4adc0b19f5d9216b65a090f29d1974c4feec95b1810b +F src/parse.y 2eee45f4c80cc442b29ae6ca5f174a70cdb669bd0dc25a1a9cad3228a3b01c3d F src/pcache.c 135ef0bc6fb2e3b7178d49ab5c9176254c8a691832c1bceb1156b2fbdd0869bd F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170 F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880 @@ -558,7 +558,7 @@ F src/test_windirent.h 90dfbe95442c9762357fe128dc7ae3dc199d006de93eb33ba3972e0a9 F src/test_window.c 0d19b33e7a262d3b55e85bc0fb84a70f503686cbd769939176162fe866ce7f9e F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c -F src/tokenize.c e0a90f3d594e3db842581543abf157c8e63617655c91ad35d77e339a1bc36ce0 +F src/tokenize.c 01e96d1b639c3eb0b9ef90616e766d453935c554f1f7aa86b6db937b79554b97 F src/treeview.c 2c5c4bc0a443401db5fd621542150452ddf5055d38edd4eef868bc2b6bfb0260 F src/trigger.c 4ace6d1d5ba9a89822deb287317f33c810440526eafe185c2d8a48c31df1e995 F src/update.c 46dc24c6158446aaab45caee09b6d99327cb479268b83ffeb5b701823da3b67b @@ -584,7 +584,7 @@ F src/where.c 0bcbf9e191ca07f9ea2008aa80e70ded46bcdffd26560c83397da501f00aece6 F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4 F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96 F src/whereexpr.c 571618c67a3eb5ce0f1158c2792c1aee9b4a4a264392fc4fb1b35467f80abf9a -F src/window.c 0d5d4bcddd2dacc75eeb191435cdf6b202859ab4e00da60b49473ecf82b310da +F src/window.c 60b374948d2f620dcd75656b5989cc81a9adbfe1a501d56e4ec2ff31b566fab9 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d @@ -1666,7 +1666,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f F tool/lemon.c 33892e2a243865f73e6c6e7cecce3c6eb4bb95db4a3d9d86d146c8064feb92fd -F tool/lempar.c a6ebc2024f2d3ab90b93b4ea8bb39b4a320e7a4a4268e1fdef8ae45e8e714593 +F tool/lempar.c 428a050780425be2d699e939605fcbc54a161c20884f11b476b2eea961394bbe F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca @@ -1746,7 +1746,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 12be361a532df0c22a7e4d97658b82a69b1a205d4cca8d092b9e6b7790c1ee40 -R c48727f54db5812cf689e7e6c4d566ea +P 0c8a2f257fb71b2b053c4a2028db063e92dd9ff585a17fa22a70f9223fb11e75 +R f04a87b92e27af849599e79f96e43d61 U drh -Z c78a3161fc1cafaf82d835b065410dcc +Z 40c0c33790af4ea254b922890c6786fb diff --git a/manifest.uuid b/manifest.uuid index fe601b79ae..b4002a0e18 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c8a2f257fb71b2b053c4a2028db063e92dd9ff585a17fa22a70f9223fb11e75 \ No newline at end of file +5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366 \ No newline at end of file diff --git a/src/func.c b/src/func.c index 61575745ad..0504a8f026 100644 --- a/src/func.c +++ b/src/func.c @@ -1671,13 +1671,13 @@ static void minMaxValueFinalize(sqlite3_context *context, int bValue){ } #ifndef SQLITE_OMIT_WINDOWFUNC static void minMaxValue(sqlite3_context *context){ - return minMaxValueFinalize(context, 1); + minMaxValueFinalize(context, 1); } #else # define minMaxValue 0 #endif /* SQLITE_OMIT_WINDOWFUNC */ static void minMaxFinalize(sqlite3_context *context){ - return minMaxValueFinalize(context, 0); + minMaxValueFinalize(context, 0); } /* @@ -1722,8 +1722,8 @@ static void groupConcatInverse( sqlite3_value **argv ){ int n; - assert( argc==1 || argc==2 ); StrAccum *pAccum; + assert( argc==1 || argc==2 ); if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); /* pAccum is always non-NULL since groupConcatStep() will have always @@ -1735,7 +1735,7 @@ static void groupConcatInverse( }else{ n++; } - if( n>=pAccum->nChar ){ + if( n>=(int)pAccum->nChar ){ pAccum->nChar = 0; }else{ pAccum->nChar -= n; diff --git a/src/main.c b/src/main.c index 1a9dc1b84e..0ce19c579b 100644 --- a/src/main.c +++ b/src/main.c @@ -1740,7 +1740,7 @@ int sqlite3CreateFunc( ** operation to continue but invalidate all precompiled statements. */ p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0); - if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==enc && p->nArg==nArg ){ + if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){ if( db->nVdbeActive ){ sqlite3ErrorWithMsg(db, SQLITE_BUSY, "unable to delete/modify user-function due to active statements"); diff --git a/src/parse.y b/src/parse.y index 0cfba1b3e6..acb8b728e5 100644 --- a/src/parse.y +++ b/src/parse.y @@ -547,7 +547,7 @@ oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y) }else{ sqlite3WindowListDelete(pParse->db, R); } -#endif // SQLITE_OMIT_WINDOWFUNC +#endif /* SQLITE_OMIT_WINDOWFUNC */ #if SELECTTRACE_ENABLED /* Populate the Select.zSelName[] string that is used to help with ** query planner debugging, to differentiate between multiple Select @@ -1702,4 +1702,4 @@ over_opt(A) ::= filter_opt(W) OVER nm(Z). { filter_opt(A) ::= . { A = 0; } filter_opt(A) ::= FILTER LP WHERE expr(X) RP. { A = X; } -%endif // SQLITE_OMIT_WINDOWFUNC +%endif /* SQLITE_OMIT_WINDOWFUNC */ diff --git a/src/tokenize.c b/src/tokenize.c index fc5989cdde..6cdff74d36 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -264,7 +264,7 @@ static int analyzeFilterKeyword(const unsigned char *z, int lastToken){ } return TK_ID; } -#endif // SQLITE_OMIT_WINDOWFUNC +#endif /* SQLITE_OMIT_WINDOWFUNC */ /* ** Return the length (in bytes) of the token that begins at z[0]. @@ -604,7 +604,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ #else if( tokenType>=TK_SPACE ){ assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL ); -#endif // SQLITE_OMIT_WINDOWFUNC +#endif /* SQLITE_OMIT_WINDOWFUNC */ if( db->u1.isInterrupted ){ pParse->rc = SQLITE_INTERRUPT; break; @@ -634,7 +634,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ }else if( tokenType==TK_FILTER ){ assert( n==6 ); tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); -#endif // SQLITE_OMIT_WINDOWFUNC +#endif /* SQLITE_OMIT_WINDOWFUNC */ }else{ sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); break; diff --git a/src/window.c b/src/window.c index 7a3831f978..b531c4b8c3 100644 --- a/src/window.c +++ b/src/window.c @@ -151,6 +151,8 @@ static void row_numberStepFunc( ){ i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) (*p)++; + UNUSED_PARAMETER(nArg); + UNUSED_PARAMETER(apArg); } static void row_numberValueFunc(sqlite3_context *pCtx){ i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); @@ -181,6 +183,8 @@ static void dense_rankStepFunc( struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) p->nStep = 1; + UNUSED_PARAMETER(nArg); + UNUSED_PARAMETER(apArg); } static void dense_rankValueFunc(sqlite3_context *pCtx){ struct CallCount *p; @@ -213,6 +217,8 @@ static void rankStepFunc( p->nValue = p->nStep; } } + UNUSED_PARAMETER(nArg); + UNUSED_PARAMETER(apArg); } static void rankValueFunc(sqlite3_context *pCtx){ struct CallCount *p; @@ -235,7 +241,7 @@ static void percent_rankStepFunc( sqlite3_value **apArg ){ struct CallCount *p; - assert( nArg==1 ); + UNUSED_PARAMETER(nArg); assert( nArg==1 ); p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ @@ -274,7 +280,7 @@ static void cume_distStepFunc( sqlite3_value **apArg ){ struct CallCount *p; - assert( nArg==1 ); + assert( nArg==1 ); UNUSED_PARAMETER(nArg); p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ @@ -314,7 +320,7 @@ static void ntileStepFunc( sqlite3_value **apArg ){ struct NtileCtx *p; - assert( nArg==2 ); + assert( nArg==2 ); UNUSED_PARAMETER(nArg); p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ if( p->nTotal==0 ){ @@ -369,6 +375,7 @@ static void last_valueStepFunc( sqlite3_value **apArg ){ struct LastValueCtx *p; + UNUSED_PARAMETER(nArg); p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ sqlite3_value_free(p->pVal); @@ -386,6 +393,8 @@ static void last_valueInvFunc( sqlite3_value **apArg ){ struct LastValueCtx *p; + UNUSED_PARAMETER(nArg); + UNUSED_PARAMETER(apArg); p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( ALWAYS(p) ){ p->nVal--; @@ -446,16 +455,19 @@ static void noopStepFunc( /*NO_TEST*/ int n, /*NO_TEST*/ sqlite3_value **a /*NO_TEST*/ ){ /*NO_TEST*/ + UNUSED_PARAMETER(p); /*NO_TEST*/ + UNUSED_PARAMETER(n); /*NO_TEST*/ + UNUSED_PARAMETER(a); /*NO_TEST*/ assert(0); /*NO_TEST*/ } /*NO_TEST*/ -static void noopValueFunc(sqlite3_context *p){ /*no-op*/; } +static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } /* Window functions that use all window interfaces: xStep, xFinal, ** xValue, and xInverse */ #define WINDOWFUNCALL(name,nArg,extra) { \ nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ name ## StepFunc, name ## FinalizeFunc, name ## ValueFunc, \ - name ## InvFunc, name ## Name \ + name ## InvFunc, name ## Name, {0} \ } /* Window functions that are implemented using bytecode and thus have @@ -463,7 +475,7 @@ static void noopValueFunc(sqlite3_context *p){ /*no-op*/; } #define WINDOWFUNCNOOP(name,nArg,extra) { \ nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ noopStepFunc, noopValueFunc, noopValueFunc, \ - noopStepFunc, name ## Name \ + noopStepFunc, name ## Name, {0} \ } /* Window functions that use all window interfaces: xStep, the @@ -472,7 +484,7 @@ static void noopValueFunc(sqlite3_context *p){ /*no-op*/; } #define WINDOWFUNCX(name,nArg,extra) { \ nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ name ## StepFunc, name ## ValueFunc, name ## ValueFunc, \ - noopStepFunc, name ## Name \ + noopStepFunc, name ## Name, {0} \ } @@ -631,6 +643,8 @@ static int selectWindowRewriteExprCb(Walker *pWalker, Expr *pExpr){ return WRC_Continue; } static int selectWindowRewriteSelectCb(Walker *pWalker, Select *pSelect){ + UNUSED_PARAMETER(pWalker); + UNUSED_PARAMETER(pSelect); return WRC_Prune; } @@ -1543,8 +1557,8 @@ static void windowCodeRowExprStep( int regEnd; /* Value of FOLLOWING */ int addrGoto; int addrTop; - int addrIfPos1; - int addrIfPos2; + int addrIfPos1 = 0; + int addrIfPos2 = 0; int regSize = 0; assert( pMWin->eStart==TK_PRECEDING @@ -1864,9 +1878,9 @@ static void windowCodeCacheStep( VdbeCoverageNeverTaken(v); if( bReverse ){ - int addr = sqlite3VdbeCurrentAddr(v); + int addr2 = sqlite3VdbeCurrentAddr(v); windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize); - sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr); + sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr2); VdbeCoverage(v); sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty); VdbeCoverageNeverTaken(v); diff --git a/tool/lempar.c b/tool/lempar.c index e19aba4d20..a193df92f9 100644 --- a/tool/lempar.c +++ b/tool/lempar.c @@ -550,7 +550,7 @@ static YYACTIONTYPE yy_find_shift_action( #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT j0 ){ #ifndef NDEBUG @@ -1066,9 +1066,11 @@ void Parse( */ int ParseFallback(int iToken){ #ifdef YYFALLBACK - if( iToken