fix warnings compiling sqllite with latest gcc version

This commit is contained in:
Paul Gardner-Stephen 2020-07-10 08:53:56 +09:30
parent 77bdbd9cf1
commit 338c9bed1f

View File

@ -25023,6 +25023,7 @@ SQLITE_PRIVATE void sqlite3VXPrintf(
flag_longlong = sizeof(char*)==sizeof(i64); flag_longlong = sizeof(char*)==sizeof(i64);
flag_long = sizeof(char*)==sizeof(long int); flag_long = sizeof(char*)==sizeof(long int);
/* Fall through into the next case */ /* Fall through into the next case */
// Fall through
case etORDINAL: case etORDINAL:
case etRADIX: case etRADIX:
if( infop->flags & FLAG_SIGNED ){ if( infop->flags & FLAG_SIGNED ){
@ -27391,7 +27392,9 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *z
va_start(ap, zFormat); va_start(ap, zFormat);
z = sqlite3VMPrintf(db, zFormat, ap); z = sqlite3VMPrintf(db, zFormat, ap);
va_end(ap); va_end(ap);
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
} }
@ -69553,7 +69556,9 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
return SQLITE_NOMEM_BKPT; return SQLITE_NOMEM_BKPT;
} }
memcpy(pMem->z, z, nAlloc); memcpy(pMem->z, z, nAlloc);
#pragma GCC diagnostic ignored "-Wcast-function-type"
}else if( xDel==SQLITE_DYNAMIC ){ }else if( xDel==SQLITE_DYNAMIC ){
#pragma GCC diagnostic pop
sqlite3VdbeMemRelease(pMem); sqlite3VdbeMemRelease(pMem);
pMem->zMalloc = pMem->z = (char *)z; pMem->zMalloc = pMem->z = (char *)z;
pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
@ -69965,7 +69970,9 @@ static int valueFromExpr(
}else{ }else{
zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken);
if( zVal==0 ) goto no_mem; if( zVal==0 ) goto no_mem;
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){ if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
@ -70006,8 +70013,10 @@ static int valueFromExpr(
zVal = &pExpr->u.zToken[2]; zVal = &pExpr->u.zToken[2];
nVal = sqlite3Strlen30(zVal)-1; nVal = sqlite3Strlen30(zVal)-1;
assert( zVal[nVal]=='\'' ); assert( zVal[nVal]=='\'' );
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
0, SQLITE_DYNAMIC); 0, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
#endif #endif
@ -70920,8 +70929,8 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
switch( pOp->opcode ){ switch( pOp->opcode ){
case OP_Transaction: { case OP_Transaction: {
if( pOp->p2!=0 ) p->readOnly = 0; if( pOp->p2!=0 ) p->readOnly = 0;
/* fall thru */
} }
/* fall thru */
case OP_AutoCommit: case OP_AutoCommit:
case OP_Savepoint: { case OP_Savepoint: {
p->bIsReader = 1; p->bIsReader = 1;
@ -78083,6 +78092,7 @@ case OP_HaltIfNull: { /* in3 */
** every program. So a jump past the last instruction of the program ** every program. So a jump past the last instruction of the program
** is the same as executing Halt. ** is the same as executing Halt.
*/ */
// Fall through
case OP_Halt: { case OP_Halt: {
VdbeFrame *pFrame; VdbeFrame *pFrame;
int pcx; int pcx;
@ -78233,6 +78243,7 @@ case OP_String8: { /* same as TK_STRING, out2 */
** **
** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) ** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB)
*/ */
// Fall through
case OP_String: { /* out2 */ case OP_String: { /* out2 */
assert( pOp->p4.z!=0 ); assert( pOp->p4.z!=0 );
pOut = out2Prerelease(p, pOp); pOut = out2Prerelease(p, pOp);
@ -78789,6 +78800,7 @@ case OP_Function0: {
pOp->opcode = OP_Function; pOp->opcode = OP_Function;
/* Fall through into OP_Function */ /* Fall through into OP_Function */
} }
// Fall through
case OP_Function: { case OP_Function: {
int i; int i;
sqlite3_context *pCtx; sqlite3_context *pCtx;
@ -80485,6 +80497,7 @@ case OP_ReopenIdx: {
} }
/* If the cursor is not currently open or is open on a different /* If the cursor is not currently open or is open on a different
** index, then fall through into OP_OpenRead to force a reopen */ ** index, then fall through into OP_OpenRead to force a reopen */
// Fall through
case OP_OpenRead: case OP_OpenRead:
case OP_OpenWrite: case OP_OpenWrite:
@ -81209,6 +81222,7 @@ case OP_SeekRowid: { /* jump, in3 */
if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2; if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2;
} }
/* Fall through into OP_NotExists */ /* Fall through into OP_NotExists */
// Fall through
case OP_NotExists: /* jump, in3 */ case OP_NotExists: /* jump, in3 */
pIn3 = &aMem[pOp->p3]; pIn3 = &aMem[pOp->p3];
assert( pIn3->flags & MEM_Int ); assert( pIn3->flags & MEM_Int );
@ -81954,6 +81968,7 @@ case OP_Sort: { /* jump */
** from the beginning toward the end. In other words, the cursor is ** from the beginning toward the end. In other words, the cursor is
** configured to use Next, not Prev. ** configured to use Next, not Prev.
*/ */
// Fall through
case OP_Rewind: { /* jump */ case OP_Rewind: { /* jump */
VdbeCursor *pC; VdbeCursor *pC;
BtCursor *pCrsr; BtCursor *pCrsr;
@ -83170,8 +83185,8 @@ case OP_AggStep0: {
pOp->p4type = P4_FUNCCTX; pOp->p4type = P4_FUNCCTX;
pOp->p4.pCtx = pCtx; pOp->p4.pCtx = pCtx;
pOp->opcode = OP_AggStep; pOp->opcode = OP_AggStep;
/* Fall through into OP_AggStep */
} }
// Fall through
case OP_AggStep: { case OP_AggStep: {
int i; int i;
sqlite3_context *pCtx; sqlite3_context *pCtx;
@ -92183,6 +92198,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
} }
/* Otherwise, fall thru into the TK_COLUMN case */ /* Otherwise, fall thru into the TK_COLUMN case */
} }
// Fall through
case TK_COLUMN: { case TK_COLUMN: {
int iTab = pExpr->iTable; int iTab = pExpr->iTable;
if( iTab<0 ){ if( iTab<0 ){
@ -93924,7 +93940,9 @@ static void renameTableFunc(
zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql), zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql),
zSql, zTableName, tname.z+tname.n); zSql, zTableName, tname.z+tname.n);
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
} }
@ -93987,8 +94005,10 @@ static void renameParentFunc(
} }
} }
#pragma GCC diagnostic ignored "-Wcast-function-type"
zResult = sqlite3MPrintf(db, "%s%s", (zOutput?zOutput:""), zInput), zResult = sqlite3MPrintf(db, "%s%s", (zOutput?zOutput:""), zInput),
sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC); sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
sqlite3DbFree(db, zOutput); sqlite3DbFree(db, zOutput);
} }
#endif #endif
@ -94065,7 +94085,9 @@ static void renameTriggerFunc(
*/ */
zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql), zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql),
zSql, zTableName, tname.z+tname.n); zSql, zTableName, tname.z+tname.n);
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
} }
#endif /* !SQLITE_OMIT_TRIGGER */ #endif /* !SQLITE_OMIT_TRIGGER */
@ -103457,8 +103479,10 @@ static void printfFunc(
str.printfFlags = SQLITE_PRINTF_SQLFUNC; str.printfFlags = SQLITE_PRINTF_SQLFUNC;
sqlite3XPrintf(&str, zFormat, &x); sqlite3XPrintf(&str, zFormat, &x);
n = str.nChar; n = str.nChar;
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
SQLITE_DYNAMIC); SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
} }
@ -106384,6 +106408,7 @@ static Trigger *fkActionTrigger(
pStep->op = TK_DELETE; pStep->op = TK_DELETE;
break; break;
} }
// Fall through
default: default:
pStep->op = TK_UPDATE; pStep->op = TK_UPDATE;
} }
@ -107871,6 +107896,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
onError = OE_Abort; onError = OE_Abort;
/* Fall thru into the next case */ /* Fall thru into the next case */
} }
// Fall through
case OE_Rollback: case OE_Rollback:
case OE_Abort: case OE_Abort:
case OE_Fail: { case OE_Fail: {
@ -115089,19 +115115,25 @@ static void generateColumnNames(
zCol = pTab->aCol[iCol].zName; zCol = pTab->aCol[iCol].zName;
} }
if( !shortNames && !fullNames ){ if( !shortNames && !fullNames ){
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3VdbeSetColName(v, i, COLNAME_NAME, sqlite3VdbeSetColName(v, i, COLNAME_NAME,
sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC); sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
}else if( fullNames ){ }else if( fullNames ){
char *zName = 0; char *zName = 0;
zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol); zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC); sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
}else{ }else{
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT); sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
} }
}else{ }else{
const char *z = pEList->a[i].zSpan; const char *z = pEList->a[i].zSpan;
z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z); z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z);
#pragma GCC diagnostic ignored "-Wcast-function-type"
sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC); sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC);
#pragma GCC diagnostic pop
} }
} }
generateColumnTypes(pParse, pTabList, pEList); generateColumnTypes(pParse, pTabList, pEList);
@ -135877,6 +135909,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If the next character is a digit, this is a floating point /* If the next character is a digit, this is a floating point
** number that begins with ".". Fall thru into the next case */ ** number that begins with ".". Fall thru into the next case */
} }
// fall through
case CC_DIGIT: { case CC_DIGIT: {
testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' ); testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' );
testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' ); testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' );
@ -135981,6 +136014,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If it is not a BLOB literal, then it must be an ID, since no /* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */ ** SQL keywords start with the letter 'x'. Fall through */
} }
// Fall through
case CC_ID: { case CC_ID: {
i = 1; i = 1;
break; break;