mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Build all Flex files standalone
The proposed Meson build system will need a way to ignore certain
generated files in order to coexist with the autoconf build system,
and C files generated by Flex which are #include'd into .y files make
this more difficult. In similar vein to 72b1e3a21, arrange for all Flex
C files to compile to their own .o targets.
Reviewed by Andres Freund
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com
This commit is contained in:
2
src/backend/replication/.gitignore
vendored
2
src/backend/replication/.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
/repl_gram.h
|
||||
/repl_gram.c
|
||||
/repl_scanner.c
|
||||
/syncrep_gram.h
|
||||
/syncrep_gram.c
|
||||
/syncrep_scanner.c
|
||||
|
||||
@@ -16,10 +16,12 @@ override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
|
||||
|
||||
OBJS = \
|
||||
repl_gram.o \
|
||||
repl_scanner.o \
|
||||
slot.o \
|
||||
slotfuncs.o \
|
||||
syncrep.o \
|
||||
syncrep_gram.o \
|
||||
syncrep_scanner.o \
|
||||
walreceiver.o \
|
||||
walreceiverfuncs.o \
|
||||
walsender.o
|
||||
@@ -28,11 +30,23 @@ SUBDIRS = logical
|
||||
|
||||
include $(top_srcdir)/src/backend/common.mk
|
||||
|
||||
# repl_scanner is compiled as part of repl_gram
|
||||
repl_gram.o: repl_scanner.c
|
||||
# See notes in src/backend/parser/Makefile about the following two rules
|
||||
repl_gram.h: repl_gram.c
|
||||
touch $@
|
||||
|
||||
# syncrep_scanner is compiled as part of syncrep_gram
|
||||
syncrep_gram.o: syncrep_scanner.c
|
||||
repl_gram.c: BISONFLAGS += -d
|
||||
|
||||
# Force these dependencies to be known even without dependency info built:
|
||||
repl_gram.o repl_scanner.o: repl_gram.h
|
||||
|
||||
# See notes in src/backend/parser/Makefile about the following two rules
|
||||
syncrep_gram.h: syncrep_gram.c
|
||||
touch $@
|
||||
|
||||
syncrep_gram.c: BISONFLAGS += -d
|
||||
|
||||
# Force these dependencies to be known even without dependency info built:
|
||||
syncrep_gram.o syncrep_scanner.o: syncrep_gram.h
|
||||
|
||||
# repl_gram.c, repl_scanner.c, syncrep_gram.c and syncrep_scanner.c
|
||||
# are in the distribution tarball, so they are not cleaned here.
|
||||
|
||||
@@ -416,5 +416,3 @@ ident_or_keyword:
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
#include "repl_scanner.c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%{
|
||||
%top{
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* repl_scanner.l
|
||||
@@ -18,6 +18,15 @@
|
||||
#include "utils/builtins.h"
|
||||
#include "parser/scansup.h"
|
||||
|
||||
/*
|
||||
* NB: include repl_gram.h only AFTER including walsender_private.h, because
|
||||
* walsender_private includes headers that define XLogRecPtr.
|
||||
*/
|
||||
#include "replication/walsender_private.h"
|
||||
#include "repl_gram.h"
|
||||
}
|
||||
|
||||
%{
|
||||
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
|
||||
#undef fprintf
|
||||
#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
|
||||
@@ -130,7 +139,7 @@ WAIT { return K_WAIT; }
|
||||
{space}+ { /* do nothing */ }
|
||||
|
||||
{digit}+ {
|
||||
yylval.uintval = strtoul(yytext, NULL, 10);
|
||||
replication_yylval.uintval = strtoul(yytext, NULL, 10);
|
||||
return UCONST;
|
||||
}
|
||||
|
||||
@@ -138,8 +147,8 @@ WAIT { return K_WAIT; }
|
||||
uint32 hi,
|
||||
lo;
|
||||
if (sscanf(yytext, "%X/%X", &hi, &lo) != 2)
|
||||
yyerror("invalid streaming start location");
|
||||
yylval.recptr = ((uint64) hi) << 32 | lo;
|
||||
replication_yyerror("invalid streaming start location");
|
||||
replication_yylval.recptr = ((uint64) hi) << 32 | lo;
|
||||
return RECPTR;
|
||||
}
|
||||
|
||||
@@ -151,7 +160,7 @@ WAIT { return K_WAIT; }
|
||||
<xq>{quotestop} {
|
||||
yyless(1);
|
||||
BEGIN(INITIAL);
|
||||
yylval.str = litbufdup();
|
||||
replication_yylval.str = litbufdup();
|
||||
return SCONST;
|
||||
}
|
||||
|
||||
@@ -173,9 +182,9 @@ WAIT { return K_WAIT; }
|
||||
|
||||
yyless(1);
|
||||
BEGIN(INITIAL);
|
||||
yylval.str = litbufdup();
|
||||
len = strlen(yylval.str);
|
||||
truncate_identifier(yylval.str, len, true);
|
||||
replication_yylval.str = litbufdup();
|
||||
len = strlen(replication_yylval.str);
|
||||
truncate_identifier(replication_yylval.str, len, true);
|
||||
return IDENT;
|
||||
}
|
||||
|
||||
@@ -186,7 +195,7 @@ WAIT { return K_WAIT; }
|
||||
{identifier} {
|
||||
int len = strlen(yytext);
|
||||
|
||||
yylval.str = downcase_truncate_identifier(yytext, len, true);
|
||||
replication_yylval.str = downcase_truncate_identifier(yytext, len, true);
|
||||
return IDENT;
|
||||
}
|
||||
|
||||
@@ -195,7 +204,7 @@ WAIT { return K_WAIT; }
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
<xq,xd><<EOF>> { yyerror("unterminated quoted string"); }
|
||||
<xq,xd><<EOF>> { replication_yyerror("unterminated quoted string"); }
|
||||
|
||||
|
||||
<<EOF>> {
|
||||
@@ -231,7 +240,7 @@ addlitchar(unsigned char ychar)
|
||||
}
|
||||
|
||||
void
|
||||
yyerror(const char *message)
|
||||
replication_yyerror(const char *message)
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
|
||||
@@ -112,5 +112,3 @@ create_syncrep_config(const char *num_sync, List *members, uint8 syncrep_method)
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
#include "syncrep_scanner.c"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%{
|
||||
%top{
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* syncrep_scanner.l
|
||||
@@ -17,6 +17,15 @@
|
||||
|
||||
#include "lib/stringinfo.h"
|
||||
|
||||
/*
|
||||
* NB: include syncrep_gram.h only AFTER including syncrep.h, because syncrep.h
|
||||
* includes node definitions needed for YYSTYPE.
|
||||
*/
|
||||
#include "replication/syncrep.h"
|
||||
#include "syncrep_gram.h"
|
||||
}
|
||||
|
||||
%{
|
||||
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
|
||||
#undef fprintf
|
||||
#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
|
||||
@@ -82,28 +91,28 @@ xdinside [^"]+
|
||||
appendStringInfoString(&xdbuf, yytext);
|
||||
}
|
||||
<xd>{xdstop} {
|
||||
yylval.str = xdbuf.data;
|
||||
syncrep_yylval.str = xdbuf.data;
|
||||
xdbuf.data = NULL;
|
||||
BEGIN(INITIAL);
|
||||
return NAME;
|
||||
}
|
||||
<xd><<EOF>> {
|
||||
yyerror("unterminated quoted identifier");
|
||||
syncrep_yyerror("unterminated quoted identifier");
|
||||
return JUNK;
|
||||
}
|
||||
|
||||
{identifier} {
|
||||
yylval.str = pstrdup(yytext);
|
||||
syncrep_yylval.str = pstrdup(yytext);
|
||||
return NAME;
|
||||
}
|
||||
|
||||
{digit}+ {
|
||||
yylval.str = pstrdup(yytext);
|
||||
syncrep_yylval.str = pstrdup(yytext);
|
||||
return NUM;
|
||||
}
|
||||
|
||||
"*" {
|
||||
yylval.str = "*";
|
||||
syncrep_yylval.str = "*";
|
||||
return NAME;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user