Re: [sqlite] Compiler warning: Unused variable 'pFd'

2014-01-09 Thread Hick Gunter
This is my list of disabled compiler warnings (using GCC in "absolutely most 
pedantic" mode) required to compile sqlite (and even omitting FTS and some 
other stuff).

-Wno-aggregate-return
-Wno-bad-function-cast
-Wno-cast-qual
-Wno-empty-body
-Wno-format-extra-args
-Wno-format-nonliteral
-Wno-format-security
-Wno-old-style-definitions
-Wno-parentheses
-Wno-pointer-sign
-Wno-return-type
-Wno-shadow
-Wno-sign-compare
-Wno-strict-prototypes
-Wno-switch-default
-Wno-undef
-Wno-uninitialized
-Wno-unused-function
-Wno-write-strings

See gcc docs for explanation of which constructs lead to these warnings

-Ursprüngliche Nachricht-
Von: Matthias Schmitt [mailto:freak...@mmp.lu]
Gesendet: Donnerstag, 09. Jänner 2014 11:09
An: General Discussion of SQLite Database
Betreff: [sqlite] Compiler warning: Unused variable 'pFd'

Hello,

I am using SQLite 3.8.2 for my iOS projects in Xcode 5.0.2. After updating to 
version 3.8.2 I am getting the following compiler warning:

sqlite3.c:28141:13: Unused variable 'pFd'

When looking into the code I see starting at line 28141:

static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
  UNUSED_PARAMETER(iOff);

#if SQLITE_MAX_MMAP_SIZE>0
  . the code of the function
#endif
  return SQLITE_OK;
}

Obviously the compiler switch "#if SQLITE_MAX_MMAP_SIZE>0" instructs the 
compiler to ignore the code inside the switch on my platform. As a result the 
variable "pFd" is never used and results in an ugly warning message. Would it 
be better to include the variable declaration inside the compiler switch to 
protect from this warning? So the code would look like this:

static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ #if 
SQLITE_MAX_MMAP_SIZE>0
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
  UNUSED_PARAMETER(iOff);
  . the code of the function
#endif
  return SQLITE_OK;
}

Best regards

Matthias Schmitt

magic moving pixel s.a.
23, Avenue Grande-Duchesse Charlotte
L-3441 Dudelange
Luxembourg
Phone: +352 54 75 75 - 0
http://www.mmp.lu




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


--
 Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any person as to do so could be a breach of confidence. Thank you 
for your cooperation.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Compiler warning: Unused variable ‘pFd'

2014-01-09 Thread Matthias Schmitt
Hello,

I am using SQLite 3.8.2 for my iOS projects in Xcode 5.0.2. After updating to 
version 3.8.2 I am getting the following compiler warning:

sqlite3.c:28141:13: Unused variable ‘pFd’

When looking into the code I see starting at line 28141:

static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
  UNUSED_PARAMETER(iOff);

#if SQLITE_MAX_MMAP_SIZE>0
  … the code of the function
#endif
  return SQLITE_OK;
}

Obviously the compiler switch “#if SQLITE_MAX_MMAP_SIZE>0” instructs the 
compiler to ignore the code inside the switch on my platform. As a result the 
variable “pFd” is never used and results in an ugly warning message. Would it 
be better to include the variable declaration inside the compiler switch to 
protect from this warning? So the code would look like this:

static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
#if SQLITE_MAX_MMAP_SIZE>0
  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */
  UNUSED_PARAMETER(iOff);
  … the code of the function
#endif
  return SQLITE_OK;
}

Best regards

Matthias Schmitt

magic moving pixel s.a.
23, Avenue Grande-Duchesse Charlotte
L-3441 Dudelange
Luxembourg
Phone: +352 54 75 75 - 0
http://www.mmp.lu




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users