Use #ifdefs to disable unused code when SQLITE_OMIT_FLOATING_POINT is defined.

FossilOrigin-Name: 66bab8561926963a87f15ad559cba36545c9892c
This commit is contained in:
drh 2010-01-12 17:04:07 +00:00
parent ab2f1f9560
commit 13573c71d8
4 changed files with 34 additions and 18 deletions

View File

@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Add\sa\sfew\sdocumentation\sevidence\scomments\sto\sthe\sbuilt-in\sfunction\s\nimplementations.
D 2010-01-11T18:26:42
C Use\s#ifdefs\sto\sdisable\sunused\scode\swhen\sSQLITE_OMIT_FLOATING_POINT\sis\sdefined.
D 2010-01-12T17:04:08
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -119,7 +119,7 @@ F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f
F src/complete.c 4c8a742c4a4a6d9c835912648f5c8f032ea36c7b
F src/date.c a79c0a8f219370b972e320741f995a3bef9df33f
F src/delete.c 610dc008e88a9599f905f5cbe9577ac9c36e0581
F src/expr.c b186cb2a2bab8fae4bbee4582a1c92cfc8d6aad3
F src/expr.c e6f042e88b3603f9ca698c0453c4ee0b91506788
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0
F src/func.c 7cd1b3abad8bcccf555fad9274d608da972467a3
@ -212,7 +212,7 @@ F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052
F src/util.c ad4f03079ba0fe83590d1cc9197e8e4844e38592
F src/vacuum.c db6415fd0f1be191e16228457a6deb9f232e6ad6
F src/vdbe.c e05765736504d9dbcbb3dfa8964932780002ec39
F src/vdbe.c 9035d0ec1ba8e9268d024c9c08fd258479a7fdb6
F src/vdbe.h bea1f0cd530775bdb58a340265f3cf3ee920e9b2
F src/vdbeInt.h d7ea821ac7813c9bea0fe87558c35e07b2c7c44d
F src/vdbeapi.c fc3787eb2f5487d4cc3444de42d56f2e39d311f5
@ -788,14 +788,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P a2b1183d9e9898d06d623b342bbb552e85a9b3f6
R 46f4dcf6ec2cb691894cdd8d9b71e8a0
P 8bd0f8147dbf75367243b3eecfb705da6e794ab7
R 2f049c9b0458cd4d56b0979326210233
U drh
Z cf904688820a6d52eba284b60c049013
Z 56a3411ed01b97bc47b7776cdc99d804
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLS21moxKgR168RlERAv4fAJ9y6E6zgCvqUiDBxAI3g4LOWdeIzQCfRTyH
M+noBTgcZxBSkO+AmAlxTVk=
=gvnT
iD8DBQFLTKuKoxKgR168RlERArj5AJ9MklFLlBTCDE3gwJo/U2R4JCBGqQCfeywI
MozPgxZX2+OOhsyGOcvPvws=
=hPv2
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
8bd0f8147dbf75367243b3eecfb705da6e794ab7
66bab8561926963a87f15ad559cba36545c9892c

View File

@ -1882,6 +1882,7 @@ static char *dup8bytes(Vdbe *v, const char *in){
return out;
}
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** Generate an instruction that will put the floating point
** value described by z[0..n-1] into register iMem.
@ -1901,6 +1902,7 @@ static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){
sqlite3VdbeAddOp4(v, OP_Real, 0, iMem, 0, zV, P4_REAL);
}
}
#endif
/*
@ -1911,7 +1913,8 @@ static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){
** z[n] character is guaranteed to be something that does not look
** like the continuation of the number.
*/
static void codeInteger(Vdbe *v, Expr *pExpr, int negFlag, int iMem){
static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){
Vdbe *v = pParse->pVdbe;
if( pExpr->flags & EP_IntValue ){
int i = pExpr->u.iValue;
if( negFlag ) i = -i;
@ -1927,7 +1930,11 @@ static void codeInteger(Vdbe *v, Expr *pExpr, int negFlag, int iMem){
zV = dup8bytes(v, (char*)&value);
sqlite3VdbeAddOp4(v, OP_Int64, 0, iMem, 0, zV, P4_INT64);
}else{
#ifdef SQLITE_OMIT_FLOATING_POINT
sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z);
#else
codeReal(v, z, negFlag, iMem);
#endif
}
}
}
@ -2314,14 +2321,16 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
break;
}
case TK_INTEGER: {
codeInteger(v, pExpr, 0, target);
codeInteger(pParse, pExpr, 0, target);
break;
}
#ifndef SQLITE_OMIT_FLOATING_POINT
case TK_FLOAT: {
assert( !ExprHasProperty(pExpr, EP_IntValue) );
codeReal(v, pExpr->u.zToken, 0, target);
break;
}
#endif
case TK_STRING: {
assert( !ExprHasProperty(pExpr, EP_IntValue) );
sqlite3VdbeAddOp4(v, OP_String8, 0, target, 0, pExpr->u.zToken, 0);
@ -2491,11 +2500,13 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
case TK_UMINUS: {
Expr *pLeft = pExpr->pLeft;
assert( pLeft );
if( pLeft->op==TK_FLOAT ){
if( pLeft->op==TK_INTEGER ){
codeInteger(pParse, pLeft, 1, target);
#ifndef SQLITE_OMIT_FLOATING_POINT
}else if( pLeft->op==TK_FLOAT ){
assert( !ExprHasProperty(pExpr, EP_IntValue) );
codeReal(v, pLeft->u.zToken, 1, target);
}else if( pLeft->op==TK_INTEGER ){
codeInteger(v, pLeft, 1, target);
#endif
}else{
regFree1 = r1 = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_Integer, 0, r1);

View File

@ -884,6 +884,7 @@ case OP_Int64: { /* out2-prerelease */
break;
}
#ifndef SQLITE_OMIT_FLOATING_POINT
/* Opcode: Real * P2 * P4 *
**
** P4 is a pointer to a 64-bit floating point value.
@ -895,6 +896,7 @@ case OP_Real: { /* same as TK_FLOAT, out2-prerelease */
pOut->r = *pOp->p4.pReal;
break;
}
#endif
/* Opcode: String8 * P2 * P4 *
**
@ -1530,6 +1532,7 @@ case OP_MustBeInt: { /* jump, in1 */
break;
}
#ifndef SQLITE_OMIT_FLOATING_POINT
/* Opcode: RealAffinity P1 * * * *
**
** If register P1 holds an integer convert it to a real value.
@ -1546,6 +1549,7 @@ case OP_RealAffinity: { /* in1 */
}
break;
}
#endif
#ifndef SQLITE_OMIT_CAST
/* Opcode: ToText P1 * * * *
@ -1629,7 +1633,7 @@ case OP_ToInt: { /* same as TK_TO_INT, in1 */
break;
}
#ifndef SQLITE_OMIT_CAST
#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT)
/* Opcode: ToReal P1 * * * *
**
** Force the value in register P1 to be a floating point number.
@ -1646,7 +1650,7 @@ case OP_ToReal: { /* same as TK_TO_REAL, in1 */
}
break;
}
#endif /* SQLITE_OMIT_CAST */
#endif /* !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT) */
/* Opcode: Lt P1 P2 P3 P4 P5
**
@ -5664,6 +5668,7 @@ case OP_Trace: {
** the same as a no-op. This opcodesnever appears in a real VM program.
*/
default: { /* This is really OP_Noop and OP_Explain */
assert( pOp->opcode==OP_Noop || pOp->opcode==OP_Explain );
break;
}