Patch to remove some "unused variable" warnings

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch to remove some "unused variable" warnings

Andy Gibbs
Hi,

I've attached a very small patch that eliminates a few "unused variable"
warnings that occur when compiled with various OMIT_* options.

Cheers,
Andy

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Patch to remove some "unused variable" warnings

Andy Gibbs
On Tuesday 02 Aug 2016 22:07:32 Andy wrote:
> Hi,
>
> I've attached a very small patch that eliminates a few "unused variable"
> warnings that occur when compiled with various OMIT_* options.
>
> Cheers,
> Andy

Sorry, this time with inline patch...

Index: src/build.c
==================================================================
--- src/build.c
+++ src/build.c
@@ -2130,11 +2130,13 @@
   Table *pSelTab;   /* A fake table from which we get the result set */
   Select *pSel;     /* Copy of the SELECT that implements the view */
   int nErr = 0;     /* Number of errors encountered */
   int n;            /* Temporarily holds the number of cursors assigned */
   sqlite3 *db = pParse->db;  /* Database connection for malloc errors */
+#ifndef SQLITE_OMIT_AUTHORIZATION
   sqlite3_xauth xAuth;       /* Saved xAuth pointer */
+#endif
 
   assert( pTable );
 
 #ifndef SQLITE_OMIT_VIRTUALTABLE
   if( sqlite3VtabCallConnect(pParse, pTable) ){

Index: src/date.c
==================================================================
--- src/date.c
+++ src/date.c
@@ -1110,11 +1110,10 @@
   int argc,
   sqlite3_value **argv
 ){
   time_t t;
   char *zFormat = (char *)sqlite3_user_data(context);
-  sqlite3 *db;
   sqlite3_int64 iT;
   struct tm *pTm;
   struct tm sNow;
   char zBuf[20];
 

Index: src/resolve.c
==================================================================
--- src/resolve.c
+++ src/resolve.c
@@ -644,11 +644,13 @@
       ExprList *pList = pExpr->x.pList;    /* The argument list */
       int n = pList ? pList->nExpr : 0;    /* Number of arguments */
       int no_such_func = 0;       /* True if no such function exists */
       int wrong_num_args = 0;     /* True if wrong number of arguments */
       int is_agg = 0;             /* True if is an aggregate function */
+#ifndef SQLITE_OMIT_AUTHORIZATION
       int auth;                   /* Authorization to use the function */
+#endif
       int nId;                    /* Number of characters in function name */
       const char *zId;            /* The function name. */
       FuncDef *pDef;              /* Information about the function */
       u8 enc = ENC(pParse->db);   /* The database encoding */
 


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Patch to remove some "unused variable" warnings

Richard Hipp-3
On 8/2/16, Andy Gibbs <[hidden email]> wrote:
> On Tuesday 02 Aug 2016 22:07:32 Andy wrote:
>> Hi,
>>
>> I've attached a very small patch that eliminates a few "unused variable"
>> warnings that occur when compiled with various OMIT_* options.
>>

Thanks for the patch, Andy.  It is appreciated.

However, my current thinking is that we will not apply it.  Here's why:

(1) The patch only fixes a harmless warning.  The code still works
fine without the patch.

(2) The warning only comes up when compiling with
SQLITE_OMIT_AUTHORIZER, which is an obscure (and technically
unsupported) compile-time option.

(3) It is important to try to keep the amount of #ifdef-ery to a
minimum.  Some (many?) will argument that I'm already too late - that
the amount of #ifdef-ery in SQLite is way out of control.  But in any
event, I want to try to keep it from getting unnecessarily worse.

Please do not let this discourage you from making further suggestions
in the future.
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Patch to remove some "unused variable" warnings

Richard Hipp-3
In reply to this post by Andy Gibbs
Actually, this one part of the patch does not involve #ifdef-ery and
so it can be (and has been) applied.

On 8/2/16, Andy Gibbs <[hidden email]> wrote:

>
> Index: src/date.c
> ==================================================================
> --- src/date.c
> +++ src/date.c
> @@ -1110,11 +1110,10 @@
>    int argc,
>    sqlite3_value **argv
>  ){
>    time_t t;
>    char *zFormat = (char *)sqlite3_user_data(context);
> -  sqlite3 *db;
>    sqlite3_int64 iT;
>    struct tm *pTm;
>    struct tm sNow;
>    char zBuf[20];
>

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users