aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg')
-rw-r--r--src/interfaces/ecpg/preproc/.gitignore1
-rw-r--r--src/interfaces/ecpg/preproc/Makefile7
-rw-r--r--src/interfaces/ecpg/preproc/extern.h3
-rw-r--r--src/interfaces/ecpg/preproc/keywords.c16
4 files changed, 17 insertions, 10 deletions
diff --git a/src/interfaces/ecpg/preproc/.gitignore b/src/interfaces/ecpg/preproc/.gitignore
index 6fca9aff590..aacfb844bda 100644
--- a/src/interfaces/ecpg/preproc/.gitignore
+++ b/src/interfaces/ecpg/preproc/.gitignore
@@ -4,4 +4,3 @@
/pgc.c
/ecpg
-/kwlookup.c
diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile
index ee3b13a4afa..30db5a049af 100644
--- a/src/interfaces/ecpg/preproc/Makefile
+++ b/src/interfaces/ecpg/preproc/Makefile
@@ -27,7 +27,7 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
override CFLAGS += $(PTHREAD_CFLAGS) -DECPG_COMPILE
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 \
+ keywords.o c_keywords.o ecpg_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
$(WIN32RES)
# Suppress parallel build to avoid a bug in GNU make 3.82
@@ -53,9 +53,6 @@ preproc.y: ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg.
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) $< .
-
distprep: preproc.y preproc.c preproc.h pgc.c
install: all installdirs
@@ -68,7 +65,7 @@ uninstall:
rm -f '$(DESTDIR)$(bindir)/ecpg$(X)'
clean distclean:
- rm -f kwlookup.c *.o ecpg$(X)
+ rm -f *.o ecpg$(X)
# garbage from development
@rm -f core a.out
diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h
index ea8fd8ed98c..f6841726e4a 100644
--- a/src/interfaces/ecpg/preproc/extern.h
+++ b/src/interfaces/ecpg/preproc/extern.h
@@ -4,7 +4,8 @@
#define _ECPG_PREPROC_EXTERN_H
#include "type.h"
-#include "parser/keywords.h"
+
+#include "common/keywords.h"
#include <errno.h>
#ifndef CHAR_BIT
diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c
index 2f17f0c5c02..cffdaed67b0 100644
--- a/src/interfaces/ecpg/preproc/keywords.c
+++ b/src/interfaces/ecpg/preproc/keywords.c
@@ -15,13 +15,23 @@
*/
#include "postgres_fe.h"
-#include "parser/keywords.h"
-#include "type.h"
+/*
+ * This is much trickier than it looks. We are #include'ing kwlist.h
+ * but the "value" numbers that go into the table are from preproc.h
+ * not the backend's gram.h. Therefore this table will recognize all
+ * keywords known to the backend, but will supply the token numbers used
+ * by ecpg's grammar, which is what we need. The ecpg grammar must
+ * define all the same token names the backend does, else we'll get
+ * undefined-symbol failures in this compile.
+ */
+
+#include "common/keywords.h"
+
#include "extern.h"
#include "preproc.h"
-#define PG_KEYWORD(a,b,c) {a,b,c},
+#define PG_KEYWORD(a,b,c) {a,b,c},
const ScanKeyword SQLScanKeywords[] = {
#include "parser/kwlist.h"