diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-03-19 12:07:16 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-03-19 12:07:24 -0400 |
commit | 72b1e3a21f0540ffa5c1f8f474b6c52097a368bb (patch) | |
tree | d674d146a01972573c9db10fc4a61906d40a87e4 /src/interfaces/ecpg | |
parent | 7bafffea647e21864cb857ab5b6fe266f2d0976a (diff) | |
download | postgresql-72b1e3a21f0540ffa5c1f8f474b6c52097a368bb.tar.gz postgresql-72b1e3a21f0540ffa5c1f8f474b6c52097a368bb.zip |
Build backend/parser/scan.l and interfaces/ecpg/preproc/pgc.l standalone.
Now that we know about the %top{} trick, we can revert to building flex
lexers as separate .o files. This is worth doing for a couple of reasons
besides sheer cleanliness. We can narrow the scope of the -Wno-error flag
that's forced on scan.c. Also, since these grammar and lexer files are
so large, splitting them into separate build targets should have some
advantages in build speed, particularly in parallel or ccache'd builds.
We have quite a few other .l files that could be changed likewise, but the
above arguments don't apply to them, so the benefit of fixing them seems
pretty minimal. Leave the rest for some other day.
Diffstat (limited to 'src/interfaces/ecpg')
-rw-r--r-- | src/interfaces/ecpg/preproc/Makefile | 7 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.trailer | 8 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/pgc.l | 14 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index ca13c1faa88..ee3b13a4afa 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -26,7 +26,7 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ override CFLAGS += $(PTHREAD_CFLAGS) -DECPG_COMPILE -OBJS= preproc.o type.o ecpg.o output.o parser.o \ +OBJS= preproc.o pgc.o type.o ecpg.o output.o parser.o \ keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \ $(WIN32RES) @@ -44,9 +44,6 @@ ecpg: $(OBJS) | submake-libpgport ../ecpglib/typename.o: ../ecpglib/typename.c $(MAKE) -C $(dir $@) $(notdir $@) -# pgc is compiled as part of preproc -preproc.o: pgc.c - preproc.h: preproc.c ; preproc.c: BISONFLAGS += -d @@ -54,7 +51,7 @@ preproc.y: ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg. $(PERL) $(srcdir)/parse.pl $(srcdir) < $< > $@ $(PERL) $(srcdir)/check_rules.pl $(srcdir) $< -ecpg_keywords.o c_keywords.o keywords.o preproc.o parser.o: preproc.h +ecpg_keywords.o c_keywords.o keywords.o preproc.o pgc.o parser.o: preproc.h kwlookup.c: % : $(top_srcdir)/src/backend/parser/% rm -f $@ && $(LN_S) $< . diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 16359a309b7..de0df7440f0 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1916,11 +1916,3 @@ void parser_init(void) { /* This function is empty. It only exists for compatibility with the backend parser right now. */ } - -/* - * Must undefine base_yylex before including pgc.c, since we want it - * to create the function base_yylex not filtered_base_yylex. - */ -#undef base_yylex - -#include "pgc.c" diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 397f14ef26f..ec71bbd2afb 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -1,4 +1,4 @@ -%{ +%top{ /*------------------------------------------------------------------------- * * pgc.l @@ -23,7 +23,19 @@ #include <limits.h> #include "extern.h" +#include "preproc.h" + +/* + * Change symbol names as expected by preproc.l. It'd be better to do this + * with %option prefix="base_yy", but that affects some other names that + * various files expect *not* to be prefixed with "base_". Cleaning it up + * is not worth the trouble right now. + */ +#define yylex base_yylex +#define yylval base_yylval +} +%{ extern YYSTYPE yylval; static int xcdepth = 0; /* depth of nesting in slash-star comments */ |