Alvaro Herrera wrote:
> Alvaro Herrera wrote:
> > Tom Lane wrote:
>
> > > What I'd suggest is something similar to the design of the errcodes.h
> > > header: create a header file containing just the list of PG_KEYWORD
> > > macro calls, and have the different users #include it after defining
> > > that macro appropriately. Having .c files include other .c files is
> > > usually best avoided on least-surprise grounds.
> >
> > Seems doable.
>
> Attached.
Minor fixes over the previous patch.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
diff -u src/bin/pg_dump/Makefile src/bin/pg_dump/Makefile
--- src/bin/pg_dump/Makefile 4 Mar 2009 15:25:11 -0000
+++ src/bin/pg_dump/Makefile 4 Mar 2009 17:02:19 -0000
@@ -27,13 +27,13 @@
all: submake-libpq submake-libpgport pg_dump pg_restore pg_dumpall
-pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
+pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(KEYWRDOBJS)
$(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(KEYWRDOBJS) $(OBJS)
$(libpq_pgport) $(LDFLAGS) $(LIBS) -o $...@$(X)
-pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
+pg_restore: pg_restore.o $(OBJS) $(KEYWRDOBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_restore.o $(KEYWRDOBJS) $(OBJS) $(libpq_pgport)
$(LDFLAGS) $(LIBS) -o $...@$(X)
-pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
+pg_dumpall: pg_dumpall.o dumputils.o $(KEYWRDOBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(KEYWRDOBJS) $(WIN32RES)
$(libpq_pgport) $(LDFLAGS) $(LIBS) -o $...@$(X)
install: all installdirs
diff -u src/bin/pg_dump/keywords.c src/bin/pg_dump/keywords.c
--- src/bin/pg_dump/keywords.c 4 Mar 2009 16:08:22 -0000
+++ src/bin/pg_dump/keywords.c 4 Mar 2009 17:03:08 -0000
@@ -15,18 +15,11 @@
*/
#include "postgres_fe.h"
-/*
- * This macro definition overrides the YYSTYPE union definition in gram.h.
- * We don't need that struct in this file, and including the real definition
- * would require sucking in some backend-only include files.
- */
-#define YYSTYPE int
-
#include "parser/keywords.h"
/*
- * We don't need the token number, so leave it out to avoid requiring extra
- * object files from the backend.
+ * We don't need the token number, so leave it out to avoid requiring other
+ * backend headers.
*/
#define PG_KEYWORD(a,b,c) {a,c}
#define TWO_MEMBER_SCANKEYWORD
only in patch2:
unchanged:
--- src/backend/parser/gram.y 24 Feb 2009 10:06:33 -0000 2.659
+++ src/backend/parser/gram.y 4 Mar 2009 17:04:39 -0000
@@ -423,7 +423,7 @@ static TypeName *TableFuncTypeName(List
/*
* If you make any token changes, update the keyword table in
- * parser/keywords.c and add new keywords to the appropriate one of
+ * src/include/parser/kwlist.h and add new keywords to the appropriate one of
* the reserved-or-not-so-reserved keyword lists, below; search
* this file for "Name classification hierarchy".
*/
@@ -516,7 +516,7 @@ static TypeName *TableFuncTypeName(List
ZONE
-/* The grammar thinks these are keywords, but they are not in the keywords.c
+/* The grammar thinks these are keywords, but they are not in the kwlist.h
* list and so can never be entered directly. The filter in parser.c
* creates these tokens when required.
*/
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers