8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 00:03:03 +01:00

Solve macro conflicts on win 32 when using bison and msvc

This commit is contained in:
brodsom 2003-07-02 00:16:56 +00:00
parent 721d982f49
commit 30ccb0a20b
4 changed files with 75 additions and 88 deletions

View File

@ -42,7 +42,7 @@
#define DECIMAL 298
#define DECLARE 299
#define DEFAULT 300
#define DELETE 301
#define KW_DELETE 301
#define DESC 302
#define DISTINCT 303
#define DO 304
@ -74,7 +74,7 @@
#define GTR 330
#define HAVING 331
#define IF 332
#define IN 333
#define KW_IN 333
#define INACTIVE 334
#define INNER 335
#define INPUT_TYPE 336
@ -161,7 +161,7 @@
#define SELECT 417
#define SET 418
#define SHADOW 419
#define SHARED 420
#define KW_SHARED 420
#define SINGULAR 421
#define KW_SIZE 422
#define SMALLINT 423
@ -254,3 +254,6 @@
#define INSERTING 510
#define UPDATING 511
#define DELETING 512
#define KW_INSERTING 513
#define KW_UPDATING 514
#define KW_DELETING 515

View File

@ -28,7 +28,7 @@
* Contributor(s):
*
*
* $Id: keywords.cpp,v 1.17 2003-06-10 13:39:05 dimitr Exp $
* $Id: keywords.cpp,v 1.18 2003-07-02 00:16:56 brodsom Exp $
*
*/
@ -115,7 +115,7 @@ static const TOK tokens [] = {
{DECIMAL, "DECIMAL", 1},
{DECLARE, "DECLARE", 1},
{DEFAULT, "DEFAULT", 1},
{DELETE, "DELETE", 1},
{KW_DELETE, "DELETE", 1},
{DELETING, "DELETING", 2},
{DESC, "DESC", 1}, /* Alias of DESCENDING */
{DESC, "DESCENDING", 1},
@ -154,7 +154,7 @@ static const TOK tokens [] = {
{HAVING, "HAVING", 1},
{HOUR, "HOUR", 2},
{IF, "IF", 1},
{IN, "IN", 1},
{KW_IN, "IN", 1},
{INACTIVE, "INACTIVE", 1},
{INDEX, "INDEX", 1},
{INNER, "INNER", 1},
@ -246,7 +246,7 @@ static const TOK tokens [] = {
{SELECT, "SELECT", 1},
{SET, "SET", 1},
{SHADOW, "SHADOW", 1},
{SHARED, "SHARED", 1},
{KW_SHARED, "SHARED", 1},
{SINGULAR, "SINGULAR", 1},
{KW_SIZE, "SIZE", 1},
{SKIP, "SKIP", 2},

View File

@ -73,6 +73,7 @@ static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
* 2003.02.10 Mike Nordell : Undefined Microsoft introduced macros to get a clean compile.
* 2003.05.24 Nickolay Samofatov: Make SKIP and FIRST non-reserved keywords
* 2003.06.13 Nickolay Samofatov: Make INSERTING/UPDATING/DELETING non-reserved keywords
* 2003.07.01 Blas Rodriguez Somoza: Change DEBUG and IN to avoid conflicts in win32 build/bison
*/
#if defined(DEV_BUILD) && defined(WIN_NT) && defined(SUPERSERVER)
@ -128,17 +129,6 @@ static void yyerror (TEXT *);
#define MIN_CACHE_BUFFERS 250
#define DEF_CACHE_BUFFERS 1000
/* TMN: Remove Microsoft introduced defines*/
#ifdef DELETE
#undef DELETE
#endif
#ifdef IN
#undef IN
#endif
#ifdef SHARED /* sys/mman.h */
#undef SHARED
#endif
/* Fix 69th procedure problem - solution from Oleg Loa */
#define YYSTACKSIZE 2048
#define YYMAXDEPTH 2048
@ -275,7 +265,7 @@ static struct LexerState lex;
#define DECIMAL 298
#define DECLARE 299
#define DEFAULT 300
#define DELETE 301
#define KW_DELETE 301
#define DESC 302
#define DISTINCT 303
#define DO 304
@ -307,7 +297,7 @@ static struct LexerState lex;
#define GTR 330
#define HAVING 331
#define IF 332
#define IN 333
#define KW_IN 333
#define INACTIVE 334
#define INNER 335
#define INPUT_TYPE 336
@ -394,7 +384,7 @@ static struct LexerState lex;
#define SELECT 417
#define SET 418
#define SHADOW 419
#define SHARED 420
#define KW_SHARED 420
#define SINGULAR 421
#define KW_SIZE 422
#define SMALLINT 423
@ -3910,26 +3900,26 @@ char *yyname[] = {
"CACHE","CAST","CHARACTER","CHECK","CHECK_POINT_LEN","COLLATE","COMMA","COMMIT",
"COMMITTED","COMPUTED","CONCATENATE","CONDITIONAL","CONSTRAINT","CONTAINING",
"COUNT","CREATE","CSTRING","CURRENT","CURSOR","DATABASE","DATE","DB_KEY",
"KW_DEBUG","DECIMAL","DECLARE","DEFAULT","DELETE","DESC","DISTINCT","DO",
"KW_DEBUG","DECIMAL","DECLARE","DEFAULT","KW_DELETE","DESC","DISTINCT","DO",
"DOMAIN","DROP","ELSE","END","ENTRY_POINT","EQL","ESCAPE","EXCEPTION","EXECUTE",
"EXISTS","EXIT","EXTERNAL","FILTER","FOR","FOREIGN","FROM","FULL","FUNCTION",
"GDSCODE","GEQ","GENERATOR","GEN_ID","GRANT","GROUP","GROUP_COMMIT_WAIT","GTR",
"HAVING","IF","IN","INACTIVE","INNER","INPUT_TYPE","INDEX","INSERT","INTEGER",
"INTO","IS","ISOLATION","JOIN","KEY","KW_CHAR","KW_DEC","KW_DOUBLE","KW_FILE",
"KW_FLOAT","KW_INT","KW_LONG","KW_NULL","KW_NUMERIC","KW_UPPER","KW_VALUE",
"LENGTH","LOGFILE","LPAREN","LEFT","LEQ","LEVEL","LIKE","LOG_BUF_SIZE","LSS",
"MANUAL","MAXIMUM","MAX_SEGMENT","MERGE","MESSAGE","MINIMUM","MODULE_NAME",
"NAMES","NATIONAL","NATURAL","NCHAR","NEQ","NO","NOT","NOT_GTR","NOT_LSS",
"NUM_LOG_BUFS","OF","ON","ONLY","OPTION","OR","ORDER","OUTER","OUTPUT_TYPE",
"OVERFLOW","PAGE","PAGES","PAGE_SIZE","PARAMETER","PASSWORD","PLAN","POSITION",
"POST_EVENT","PRECISION","PRIMARY","PRIVILEGES","PROCEDURE","PROTECTED",
"RAW_PARTITIONS","READ","REAL","REFERENCES","RESERVING","RETAIN",
"RETURNING_VALUES","RETURNS","REVOKE","RIGHT","RPAREN","ROLLBACK","SEGMENT",
"SELECT","SET","SHADOW","SHARED","SINGULAR","KW_SIZE","SMALLINT","SNAPSHOT",
"SOME","SORT","SQLCODE","STABILITY","STARTING","STATISTICS","SUB_TYPE",
"SUSPEND","SUM","TABLE","THEN","TO","TRANSACTION","TRIGGER","UNCOMMITTED",
"UNION","UNIQUE","UPDATE","USER","VALUES","VARCHAR","VARIABLE","VARYING",
"VERSION","VIEW","WAIT","WHEN","WHERE","WHILE","WITH","WORK","WRITE",
"HAVING","IF","KW_IN","INACTIVE","INNER","INPUT_TYPE","INDEX","INSERT",
"INTEGER","INTO","IS","ISOLATION","JOIN","KEY","KW_CHAR","KW_DEC","KW_DOUBLE",
"KW_FILE","KW_FLOAT","KW_INT","KW_LONG","KW_NULL","KW_NUMERIC","KW_UPPER",
"KW_VALUE","LENGTH","LOGFILE","LPAREN","LEFT","LEQ","LEVEL","LIKE",
"LOG_BUF_SIZE","LSS","MANUAL","MAXIMUM","MAX_SEGMENT","MERGE","MESSAGE",
"MINIMUM","MODULE_NAME","NAMES","NATIONAL","NATURAL","NCHAR","NEQ","NO","NOT",
"NOT_GTR","NOT_LSS","NUM_LOG_BUFS","OF","ON","ONLY","OPTION","OR","ORDER",
"OUTER","OUTPUT_TYPE","OVERFLOW","PAGE","PAGES","PAGE_SIZE","PARAMETER",
"PASSWORD","PLAN","POSITION","POST_EVENT","PRECISION","PRIMARY","PRIVILEGES",
"PROCEDURE","PROTECTED","RAW_PARTITIONS","READ","REAL","REFERENCES","RESERVING",
"RETAIN","RETURNING_VALUES","RETURNS","REVOKE","RIGHT","RPAREN","ROLLBACK",
"SEGMENT","SELECT","SET","SHADOW","KW_SHARED","SINGULAR","KW_SIZE","SMALLINT",
"SNAPSHOT","SOME","SORT","SQLCODE","STABILITY","STARTING","STATISTICS",
"SUB_TYPE","SUSPEND","SUM","TABLE","THEN","TO","TRANSACTION","TRIGGER",
"UNCOMMITTED","UNION","UNIQUE","UPDATE","USER","VALUES","VARCHAR","VARIABLE",
"VARYING","VERSION","VIEW","WAIT","WHEN","WHERE","WHILE","WITH","WORK","WRITE",
"FLOAT_NUMBER","NUMBER","NUMERIC","SYMBOL","STRING","INTRODUCER","ACTION",
"ADMIN","CASCADE","FREE_IT","RESTRICT","ROLE","COLUMN","TYPE","EXTRACT","YEAR",
"MONTH","DAY","HOUR","MINUTE","SECOND","WEEKDAY","YEARDAY","TIME","TIMESTAMP",
@ -3978,7 +3968,7 @@ char *yyrule[] = {
"proc_privileges : EXECUTE",
"privilege : SELECT",
"privilege : INSERT",
"privilege : DELETE",
"privilege : KW_DELETE",
"privilege : UPDATE column_parens_opt",
"privilege : REFERENCES column_parens_opt",
"grant_option : WITH GRANT OPTION",
@ -4199,7 +4189,7 @@ char *yyrule[] = {
"referential_trigger_action : update_rule delete_rule",
"referential_trigger_action :",
"update_rule : ON UPDATE referential_action",
"delete_rule : ON DELETE referential_action",
"delete_rule : ON KW_DELETE referential_action",
"referential_action : CASCADE",
"referential_action : SET DEFAULT",
"referential_action : SET KW_NULL",
@ -4322,19 +4312,19 @@ char *yyrule[] = {
"trigger_type_prefix : AFTER",
"trigger_type_suffix : INSERT",
"trigger_type_suffix : UPDATE",
"trigger_type_suffix : DELETE",
"trigger_type_suffix : KW_DELETE",
"trigger_type_suffix : INSERT OR UPDATE",
"trigger_type_suffix : INSERT OR DELETE",
"trigger_type_suffix : INSERT OR KW_DELETE",
"trigger_type_suffix : UPDATE OR INSERT",
"trigger_type_suffix : UPDATE OR DELETE",
"trigger_type_suffix : DELETE OR INSERT",
"trigger_type_suffix : DELETE OR UPDATE",
"trigger_type_suffix : INSERT OR UPDATE OR DELETE",
"trigger_type_suffix : INSERT OR DELETE OR UPDATE",
"trigger_type_suffix : UPDATE OR INSERT OR DELETE",
"trigger_type_suffix : UPDATE OR DELETE OR INSERT",
"trigger_type_suffix : DELETE OR INSERT OR UPDATE",
"trigger_type_suffix : DELETE OR UPDATE OR INSERT",
"trigger_type_suffix : UPDATE OR KW_DELETE",
"trigger_type_suffix : KW_DELETE OR INSERT",
"trigger_type_suffix : KW_DELETE OR UPDATE",
"trigger_type_suffix : INSERT OR UPDATE OR KW_DELETE",
"trigger_type_suffix : INSERT OR KW_DELETE OR UPDATE",
"trigger_type_suffix : UPDATE OR INSERT OR KW_DELETE",
"trigger_type_suffix : UPDATE OR KW_DELETE OR INSERT",
"trigger_type_suffix : KW_DELETE OR INSERT OR UPDATE",
"trigger_type_suffix : KW_DELETE OR UPDATE OR INSERT",
"trigger_position : POSITION nonneg_short_integer",
"trigger_position :",
"trigger_action : AS begin_trigger var_declaration_list full_proc_block",
@ -4538,7 +4528,7 @@ char *yyrule[] = {
"version_mode : NO VERSION",
"version_mode :",
"tbl_reserve_options : RESERVING restr_list",
"lock_type : SHARED",
"lock_type : KW_SHARED",
"lock_type : PROTECTED",
"lock_type :",
"lock_mode : READ",
@ -4665,8 +4655,8 @@ char *yyrule[] = {
"insert_value_list : insert_value_list ',' rhs",
"delete : delete_searched",
"delete : delete_positioned",
"delete_searched : DELETE FROM table_name where_clause",
"delete_positioned : DELETE FROM table_name cursor_clause",
"delete_searched : KW_DELETE FROM table_name where_clause",
"delete_positioned : KW_DELETE FROM table_name cursor_clause",
"cursor_clause : WHERE CURRENT OF symbol_cursor_name",
"update : update_searched",
"update : update_positioned",
@ -4761,8 +4751,8 @@ char *yyrule[] = {
"like_predicate : value NOT LIKE value",
"like_predicate : value LIKE value ESCAPE value",
"like_predicate : value NOT LIKE value ESCAPE value",
"in_predicate : value IN in_predicate_value",
"in_predicate : value NOT IN in_predicate_value",
"in_predicate : value KW_IN in_predicate_value",
"in_predicate : value NOT KW_IN in_predicate_value",
"containing_predicate : value CONTAINING value",
"containing_predicate : value NOT CONTAINING value",
"starting_predicate : value STARTING value",
@ -4955,12 +4945,16 @@ typedef int YYSTYPE;
#endif
#endif
static int yynerrs;
#ifndef SHLIB_DEFS
int DSQL_yyerrflag;
#endif
#ifndef SHLIB_DEFS
int DSQL_yychar;
#endif
short *DSQL_DSQL_yyssp;
static YYSTYPE *yyvsp;
static YYSTYPE yyval;

View File

@ -64,6 +64,7 @@
* 2003.02.10 Mike Nordell : Undefined Microsoft introduced macros to get a clean compile.
* 2003.05.24 Nickolay Samofatov: Make SKIP and FIRST non-reserved keywords
* 2003.06.13 Nickolay Samofatov: Make INSERTING/UPDATING/DELETING non-reserved keywords
* 2003.07.01 Blas Rodriguez Somoza: Change DEBUG and IN to avoid conflicts in win32 build/bison
*/
#if defined(DEV_BUILD) && defined(WIN_NT) && defined(SUPERSERVER)
@ -119,17 +120,6 @@ static void yyerror (TEXT *);
#define MIN_CACHE_BUFFERS 250
#define DEF_CACHE_BUFFERS 1000
// TMN: Remove Microsoft introduced defines
#ifdef DELETE
#undef DELETE
#endif
#ifdef IN
#undef IN
#endif
#ifdef SHARED /* sys/mman.h */
#undef SHARED
#endif
/* Fix 69th procedure problem - solution from Oleg Loa */
#define YYSTACKSIZE 2048
#define YYMAXDEPTH 2048
@ -276,7 +266,7 @@ static struct LexerState lex;
%token DECIMAL
%token DECLARE
%token DEFAULT
%token DELETE
%token KW_DELETE
%token DESC
%token DISTINCT
%token DO
@ -308,7 +298,7 @@ static struct LexerState lex;
%token GTR
%token HAVING
%token IF
%token IN
%token KW_IN
%token INACTIVE
%token INNER
%token INPUT_TYPE
@ -395,7 +385,7 @@ static struct LexerState lex;
%token SELECT
%token SET
%token SHADOW
%token SHARED
%token KW_SHARED
%token SINGULAR
%token KW_SIZE
%token SMALLINT
@ -611,7 +601,7 @@ privilege : SELECT
{ $$ = make_node (nod_select, (int) 0, NULL); }
| INSERT
{ $$ = make_node (nod_insert, (int) 0, NULL); }
| DELETE
| KW_DELETE
{ $$ = make_node (nod_delete, (int) 0, NULL); }
| UPDATE column_parens_opt
{ $$ = make_node (nod_update, (int) 1, $2); }
@ -1414,7 +1404,7 @@ referential_trigger_action:
update_rule : ON UPDATE referential_action
{ $$ = $3;}
;
delete_rule : ON DELETE referential_action
delete_rule : ON KW_DELETE referential_action
{ $$ = $3;}
;
@ -1874,31 +1864,31 @@ trigger_type_suffix : INSERT
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (1, 0, 0), CONSTANT_SLONG); }
| UPDATE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (2, 0, 0), CONSTANT_SLONG); }
| DELETE
| KW_DELETE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (3, 0, 0), CONSTANT_SLONG); }
| INSERT OR UPDATE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (1, 2, 0), CONSTANT_SLONG); }
| INSERT OR DELETE
| INSERT OR KW_DELETE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (1, 3, 0), CONSTANT_SLONG); }
| UPDATE OR INSERT
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (2, 1, 0), CONSTANT_SLONG); }
| UPDATE OR DELETE
| UPDATE OR KW_DELETE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (2, 3, 0), CONSTANT_SLONG); }
| DELETE OR INSERT
| KW_DELETE OR INSERT
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (3, 1, 0), CONSTANT_SLONG); }
| DELETE OR UPDATE
| KW_DELETE OR UPDATE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (3, 2, 0), CONSTANT_SLONG); }
| INSERT OR UPDATE OR DELETE
| INSERT OR UPDATE OR KW_DELETE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (1, 2, 3), CONSTANT_SLONG); }
| INSERT OR DELETE OR UPDATE
| INSERT OR KW_DELETE OR UPDATE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (1, 3, 2), CONSTANT_SLONG); }
| UPDATE OR INSERT OR DELETE
| UPDATE OR INSERT OR KW_DELETE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (2, 1, 3), CONSTANT_SLONG); }
| UPDATE OR DELETE OR INSERT
| UPDATE OR KW_DELETE OR INSERT
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (2, 3, 1), CONSTANT_SLONG); }
| DELETE OR INSERT OR UPDATE
| KW_DELETE OR INSERT OR UPDATE
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (3, 1, 2), CONSTANT_SLONG); }
| DELETE OR UPDATE OR INSERT
| KW_DELETE OR UPDATE OR INSERT
{ $$ = MAKE_constant ((STR) TRIGGER_TYPE_SUFFIX (3, 2, 1), CONSTANT_SLONG); }
;
@ -2740,7 +2730,7 @@ tbl_reserve_options: RESERVING restr_list
{ $$ = make_node (nod_reserve, 1, make_list ($2)); }
;
lock_type : SHARED
lock_type : KW_SHARED
{ $$ = (DSQL_NOD) NOD_SHARED; }
| PROTECTED
{ $$ = (DSQL_NOD) NOD_PROTECTED ; }
@ -3137,11 +3127,11 @@ delete : delete_searched
| delete_positioned
;
delete_searched : DELETE FROM table_name where_clause
delete_searched : KW_DELETE FROM table_name where_clause
{ $$ = make_node (nod_delete, e_del_count, $3, $4, NULL); }
;
delete_positioned : DELETE FROM table_name cursor_clause
delete_positioned : KW_DELETE FROM table_name cursor_clause
{ $$ = make_node (nod_delete, e_del_count, $3, NULL, $4); }
;
@ -3396,9 +3386,9 @@ like_predicate : value LIKE value
3, $1, $4, $6)); }
;
in_predicate : value IN in_predicate_value
in_predicate : value KW_IN in_predicate_value
{ $$ = make_node (nod_eql_any, 2, $1, $3); }
| value NOT IN in_predicate_value
| value NOT KW_IN in_predicate_value
{ $$ = make_node (nod_not, 1, make_node (nod_eql_any, 2, $1, $4)); }
;