Do not name variables "operator" because some compilers do not realize that

"operator" is not a reserved word in ANSI-C.  Ticket #1625. (CVS 2997)

FossilOrigin-Name: 1f42a338e2ee90f4c24a9eb19054c4b831dd661f
This commit is contained in:
drh 2006-01-23 13:22:09 +00:00
parent 158ff67b50
commit b52076cd7a
4 changed files with 24 additions and 24 deletions

View File

@ -1,5 +1,5 @@
C Work\saround\sbuggy\smalloc()\simplementations\sthat\scause\sproblems\son\smalloc(0).\nTicket\s#1572.\s(CVS\s2996) C Do\snot\sname\svariables\s"operator"\sbecause\ssome\scompilers\sdo\snot\srealize\sthat\n"operator"\sis\snot\sa\sreserved\sword\sin\sANSI-C.\s\sTicket\s#1625.\s(CVS\s2997)
D 2006-01-23T13:14:55 D 2006-01-23T13:22:09
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -61,7 +61,7 @@ F src/os_win.c 98e4e38db7d4a00647b2bb1c60d28b7ca5034c03
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 184a3045ff5243458f2fff41f0b8d2524da39660 F src/pager.c 184a3045ff5243458f2fff41f0b8d2524da39660
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 83df51fea35f68f7e07384d75dce83d1ed30434c F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
F src/prepare.c 6349208568d7967a3d1b6625e5af736fd0d5d264 F src/prepare.c 6349208568d7967a3d1b6625e5af736fd0d5d264
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812 F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
@ -94,7 +94,7 @@ F src/vdbeapi.c dcb2636f49b4807e34960d52a2fc257b3a751140
F src/vdbeaux.c 1dce6e5f51d6119220e12ecbceccccf97ca8b8be F src/vdbeaux.c 1dce6e5f51d6119220e12ecbceccccf97ca8b8be
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 2034e93b32c14bda6e306bb54e3a8e930b963027 F src/vdbemem.c 2034e93b32c14bda6e306bb54e3a8e930b963027
F src/where.c 4c77a9dc132095a73021186a90fe44ba086f67ce F src/where.c f79bc17f6228f69181da3dfc97986a690bce25ce
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test b854de90f530ae37be68fbfe6de40e111358cbb2 F test/aggerror.test b854de90f530ae37be68fbfe6de40e111358cbb2
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4 F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 6ec8e6b7856a0b394b8497ab9166b882f98124ba P ada5490f12795a8d13d0f42077c463709c677846
R 4458a3ccbcb564e876c75ec6f51ead97 R 4e45df66c826875844a3eaf91a8a5713
U drh U drh
Z 8a56f30daefd849decb2ee9c85f46798 Z 738eabaacc09b208edf518564b3dc665

View File

@ -1 +1 @@
ada5490f12795a8d13d0f42077c463709c677846 1f42a338e2ee90f4c24a9eb19054c4b831dd661f

View File

@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing ** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens. ** numeric codes for all of the tokens.
** **
** @(#) $Id: parse.y,v 1.192 2006/01/07 14:02:27 danielk1977 Exp $ ** @(#) $Id: parse.y,v 1.193 2006/01/23 13:22:09 drh Exp $
*/ */
// All token codes are small integers with #defines that begin with "TK_" // All token codes are small integers with #defines that begin with "TK_"
@ -66,7 +66,7 @@ struct LimitVal {
** GLOB, NOT LIKE, and NOT GLOB operators. ** GLOB, NOT LIKE, and NOT GLOB operators.
*/ */
struct LikeOp { struct LikeOp {
Token operator; /* "like" or "glob" or "regexp" */ Token eOperator; /* "like" or "glob" or "regexp" */
int not; /* True if the NOT keyword is present */ int not; /* True if the NOT keyword is present */
}; };
@ -682,8 +682,8 @@ expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y). {A = sqlite3Expr(@OP, X, Y, 0);}
expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y). {A = sqlite3Expr(@OP, X, Y, 0);} expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y). {A = sqlite3Expr(@OP, X, Y, 0);}
expr(A) ::= expr(X) CONCAT(OP) expr(Y). {A = sqlite3Expr(@OP, X, Y, 0);} expr(A) ::= expr(X) CONCAT(OP) expr(Y). {A = sqlite3Expr(@OP, X, Y, 0);}
%type likeop {struct LikeOp} %type likeop {struct LikeOp}
likeop(A) ::= LIKE_KW(X). {A.operator = X; A.not = 0;} likeop(A) ::= LIKE_KW(X). {A.eOperator = X; A.not = 0;}
likeop(A) ::= NOT LIKE_KW(X). {A.operator = X; A.not = 1;} likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
%type escape {Expr*} %type escape {Expr*}
%destructor escape {sqlite3ExprDelete($$);} %destructor escape {sqlite3ExprDelete($$);}
escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;} escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;}
@ -694,7 +694,7 @@ expr(A) ::= expr(X) likeop(OP) expr(Y) escape(E). [LIKE_KW] {
if( E ){ if( E ){
pList = sqlite3ExprListAppend(pList, E, 0); pList = sqlite3ExprListAppend(pList, E, 0);
} }
A = sqlite3ExprFunction(pList, &OP.operator); A = sqlite3ExprFunction(pList, &OP.eOperator);
if( OP.not ) A = sqlite3Expr(TK_NOT, A, 0, 0); if( OP.not ) A = sqlite3Expr(TK_NOT, A, 0, 0);
sqlite3ExprSpan(A, &X->span, &Y->span); sqlite3ExprSpan(A, &X->span, &Y->span);
} }

View File

@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting ** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer". ** indices, you might also think of this module as the "query optimizer".
** **
** $Id: where.c,v 1.201 2006/01/23 13:00:38 drh Exp $ ** $Id: where.c,v 1.202 2006/01/23 13:22:10 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -83,7 +83,7 @@ struct WhereTerm {
i16 iParent; /* Disable pWC->a[iParent] when this term disabled */ i16 iParent; /* Disable pWC->a[iParent] when this term disabled */
i16 leftCursor; /* Cursor number of X in "X <op> <expr>" */ i16 leftCursor; /* Cursor number of X in "X <op> <expr>" */
i16 leftColumn; /* Column number of X in "X <op> <expr>" */ i16 leftColumn; /* Column number of X in "X <op> <expr>" */
u16 operator; /* A WO_xx value describing <op> */ u16 eOperator; /* A WO_xx value describing <op> */
u8 flags; /* Bit flags. See below */ u8 flags; /* Bit flags. See below */
u8 nChild; /* Number of children that must disable us */ u8 nChild; /* Number of children that must disable us */
WhereClause *pWC; /* The clause this term is part of */ WhereClause *pWC; /* The clause this term is part of */
@ -418,7 +418,7 @@ static WhereTerm *findTerm(
if( pTerm->leftCursor==iCur if( pTerm->leftCursor==iCur
&& (pTerm->prereqRight & notReady)==0 && (pTerm->prereqRight & notReady)==0
&& pTerm->leftColumn==iColumn && pTerm->leftColumn==iColumn
&& (pTerm->operator & op)!=0 && (pTerm->eOperator & op)!=0
){ ){
if( iCur>=0 && pIdx ){ if( iCur>=0 && pIdx ){
Expr *pX = pTerm->pExpr; Expr *pX = pTerm->pExpr;
@ -573,14 +573,14 @@ static void exprAnalyze(
pTerm->prereqAll = prereqAll; pTerm->prereqAll = prereqAll;
pTerm->leftCursor = -1; pTerm->leftCursor = -1;
pTerm->iParent = -1; pTerm->iParent = -1;
pTerm->operator = 0; pTerm->eOperator = 0;
if( allowedOp(pExpr->op) && (pTerm->prereqRight & prereqLeft)==0 ){ if( allowedOp(pExpr->op) && (pTerm->prereqRight & prereqLeft)==0 ){
Expr *pLeft = pExpr->pLeft; Expr *pLeft = pExpr->pLeft;
Expr *pRight = pExpr->pRight; Expr *pRight = pExpr->pRight;
if( pLeft->op==TK_COLUMN ){ if( pLeft->op==TK_COLUMN ){
pTerm->leftCursor = pLeft->iTable; pTerm->leftCursor = pLeft->iTable;
pTerm->leftColumn = pLeft->iColumn; pTerm->leftColumn = pLeft->iColumn;
pTerm->operator = operatorMask(pExpr->op); pTerm->eOperator = operatorMask(pExpr->op);
} }
if( pRight && pRight->op==TK_COLUMN ){ if( pRight && pRight->op==TK_COLUMN ){
WhereTerm *pNew; WhereTerm *pNew;
@ -605,7 +605,7 @@ static void exprAnalyze(
pNew->leftColumn = pLeft->iColumn; pNew->leftColumn = pLeft->iColumn;
pNew->prereqRight = prereqLeft; pNew->prereqRight = prereqLeft;
pNew->prereqAll = prereqAll; pNew->prereqAll = prereqAll;
pNew->operator = operatorMask(pDup->op); pNew->eOperator = operatorMask(pDup->op);
} }
} }
@ -664,7 +664,7 @@ static void exprAnalyze(
iCursor = sOr.a[j].leftCursor; iCursor = sOr.a[j].leftCursor;
ok = iCursor>=0; ok = iCursor>=0;
for(i=sOr.nTerm-1, pOrTerm=sOr.a; i>=0 && ok; i--, pOrTerm++){ for(i=sOr.nTerm-1, pOrTerm=sOr.a; i>=0 && ok; i--, pOrTerm++){
if( pOrTerm->operator!=WO_EQ ){ if( pOrTerm->eOperator!=WO_EQ ){
goto or_not_possible; goto or_not_possible;
} }
if( pOrTerm->leftCursor==iCursor && pOrTerm->leftColumn==iColumn ){ if( pOrTerm->leftCursor==iCursor && pOrTerm->leftColumn==iColumn ){
@ -935,7 +935,7 @@ static double bestIndex(
Expr *pExpr; Expr *pExpr;
*ppIndex = 0; *ppIndex = 0;
bestFlags = WHERE_ROWID_EQ; bestFlags = WHERE_ROWID_EQ;
if( pTerm->operator & WO_EQ ){ if( pTerm->eOperator & WO_EQ ){
/* Rowid== is always the best pick. Look no further. Because only /* Rowid== is always the best pick. Look no further. Because only
** a single row is generated, output is always in sorted order */ ** a single row is generated, output is always in sorted order */
*pFlags = WHERE_ROWID_EQ | WHERE_UNIQUE; *pFlags = WHERE_ROWID_EQ | WHERE_UNIQUE;
@ -1016,7 +1016,7 @@ static double bestIndex(
pTerm = findTerm(pWC, iCur, j, notReady, WO_EQ|WO_IN, pProbe); pTerm = findTerm(pWC, iCur, j, notReady, WO_EQ|WO_IN, pProbe);
if( pTerm==0 ) break; if( pTerm==0 ) break;
flags |= WHERE_COLUMN_EQ; flags |= WHERE_COLUMN_EQ;
if( pTerm->operator & WO_IN ){ if( pTerm->eOperator & WO_IN ){
Expr *pExpr = pTerm->pExpr; Expr *pExpr = pTerm->pExpr;
flags |= WHERE_COLUMN_IN; flags |= WHERE_COLUMN_IN;
if( pExpr->pSelect!=0 ){ if( pExpr->pSelect!=0 ){
@ -1783,7 +1783,7 @@ WhereInfo *sqlite3WhereBegin(
pX = pTerm->pExpr; pX = pTerm->pExpr;
assert( (pTerm->flags & TERM_CODED)==0 ); assert( (pTerm->flags & TERM_CODED)==0 );
sqlite3ExprCode(pParse, pX->pRight); sqlite3ExprCode(pParse, pX->pRight);
topEq = pTerm->operator & (WO_LE|WO_GE); topEq = pTerm->eOperator & (WO_LE|WO_GE);
disableTerm(pLevel, pTerm); disableTerm(pLevel, pTerm);
testOp = OP_IdxGE; testOp = OP_IdxGE;
}else{ }else{
@ -1821,7 +1821,7 @@ WhereInfo *sqlite3WhereBegin(
pX = pTerm->pExpr; pX = pTerm->pExpr;
assert( (pTerm->flags & TERM_CODED)==0 ); assert( (pTerm->flags & TERM_CODED)==0 );
sqlite3ExprCode(pParse, pX->pRight); sqlite3ExprCode(pParse, pX->pRight);
btmEq = pTerm->operator & (WO_LE|WO_GE); btmEq = pTerm->eOperator & (WO_LE|WO_GE);
disableTerm(pLevel, pTerm); disableTerm(pLevel, pTerm);
}else{ }else{
btmEq = 1; btmEq = 1;