A few warnings compiling sqlite (-Wextra)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

A few warnings compiling sqlite (-Wextra)

J Decker
gcc version 8.2.1 20181127 (GCC)

sqlite-amalgamation-3260000

gcc -Wextra -c sqlite3.c  (-Wno-fallthrough)

the last one ( sqlite3_trace ) is actually a pretty bad conversion,
changing a pointer to a u32 and vice versa; but it is only an internal
function so maybe it doesn't matter.

The rest are because SQLITE_TRANSIENT : SQLITE_DYNAMIC aren't just simple
values, but are function pointers with different signatures...



--------------
sqlite3.c: In function ‘strftimeFunc’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:21921:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
                       z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
                                                    ^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3ErrorWithMsg’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:30178:54: note: in expansion of macro ‘SQLITE_DYNAMIC’
     sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);
                                                      ^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3VdbeMemSetStr’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:75014:19: note: in expansion of macro ‘SQLITE_DYNAMIC’
   }else if( xDel==SQLITE_DYNAMIC ){
                   ^~~~~~~~~~~~~~
sqlite3.c: In function ‘valueFromExpr’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:75419:55: note: in expansion of macro ‘SQLITE_DYNAMIC’
       sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
                                                       ^~~~~~~~~~~~~~
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:75462:29: note: in expansion of macro ‘SQLITE_DYNAMIC’
                          0, SQLITE_DYNAMIC);
                             ^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3VdbeExec’:
sqlite3.c:90356:38: warning: cast between incompatible function types from
‘int (*)(u32,  void *, void *, void *)’ {aka ‘int (*)(unsigned int,  void
*, void *, void *)’} to ‘void (*)(void *, const char *)’
[-Wcast-function-type]
       void (*x)(void*,const char*) = (void(*)(void*,const
char*))db->xTrace;
                                      ^
sqlite3.c: In function ‘printfFunc’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:112292:25: note: in expansion of macro ‘SQLITE_DYNAMIC’
                         SQLITE_DYNAMIC);
                         ^~~~~~~~~~~~~~
sqlite3.c: In function ‘generateColumnNames’:
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:125795:58: note: in expansion of macro ‘SQLITE_DYNAMIC’
         sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
                                                          ^~~~~~~~~~~~~~
sqlite3.c:14080:27: warning: cast between incompatible function types from
‘int (*)(void *)’ to ‘void (*)(void *)’ [-Wcast-function-type]
 #define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)
                           ^
sqlite3.c:125802:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
       sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC);
                                                    ^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3InvokeBusyHandler’:
sqlite3.c:154304:12: warning: cast between incompatible function types from
‘int (*)(void *, int)’ to ‘int (*)(void *, int,  sqlite3_file *)’ {aka ‘int
(*)(void *, int,  struct sqlite3_file *)’} [-Wcast-function-type]
     xTra = (int(*)(void*,int,sqlite3_file*))p->xBusyHandler;
            ^
sqlite3.c: In function ‘sqlite3_busy_timeout’:
sqlite3.c:154382:30: warning: cast between incompatible function types from
‘int (*)(void *, int,  sqlite3_file *)’ {aka ‘int (*)(void *, int,  struct
sqlite3_file *)’} to ‘int (*)(void *, int)’ [-Wcast-function-type]
     sqlite3_busy_handler(db, (int(*)(void*,int))sqliteDefaultBusyCallback,
                              ^
sqlite3.c: In function ‘sqlite3_trace’:
sqlite3.c:154723:16: warning: cast between incompatible function types from
‘void (*)(void *, const char *)’ to ‘int (*)(u32,  void *, void *, void *)’
{aka ‘int (*)(unsigned int,  void *, void *, void *)’}
[-Wcast-function-type]
   db->xTrace = (int(*)(u32,void*,void*,void*))xTrace;
                ^
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users