提交 3b0d57eb 编写于 作者: T Tom Lane

Do not build psql's flex module on its own, but instead include it in

mainloop.c.  This ensures that postgres_fe.h is read before including
any system headers, which is necessary to avoid problems on some platforms
where we make nondefault selections of feature macros for stdio.h or
other headers.  We have had this policy for flex modules in the backend
for many years, but for some reason it was not applied to psql.
Per trouble report from Alexandra Roy and diagnosis by Albe Laurenz.
上级 fa40685b
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.60 2008/01/01 19:45:55 momjian Exp $ # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.60.2.1 2009/11/10 23:12:29 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -21,7 +21,7 @@ override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_du ...@@ -21,7 +21,7 @@ override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_du
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \ OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
startup.o prompt.o variables.o large_obj.o print.o describe.o \ startup.o prompt.o variables.o large_obj.o print.o describe.o \
psqlscan.o tab-complete.o mbprint.o dumputils.o $(WIN32RES) tab-complete.o mbprint.o dumputils.o $(WIN32RES)
EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
...@@ -46,6 +46,9 @@ $(srcdir)/sql_help.h: ...@@ -46,6 +46,9 @@ $(srcdir)/sql_help.h:
@echo "*** Perl is needed to build psql help." @echo "*** Perl is needed to build psql help."
endif endif
# psqlscan is compiled as part of mainloop
mainloop.o: psqlscan.c
$(srcdir)/psqlscan.c: psqlscan.l $(srcdir)/psqlscan.c: psqlscan.l
ifdef FLEX ifdef FLEX
$(FLEX) $(FLEXFLAGS) -o'$@' $< $(FLEX) $(FLEXFLAGS) -o'$@' $<
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2008, PostgreSQL Global Development Group * Copyright (c) 2000-2008, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.87 2008/01/01 19:45:56 momjian Exp $ * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.87.2.1 2009/11/10 23:12:29 tgl Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "mainloop.h" #include "mainloop.h"
...@@ -370,3 +370,13 @@ MainLoop(FILE *source) ...@@ -370,3 +370,13 @@ MainLoop(FILE *source)
return successResult; return successResult;
} /* MainLoop() */ } /* MainLoop() */
/*
* psqlscan.c is #include'd here instead of being compiled on its own.
* This is because we need postgres_fe.h to be read before any system
* include files, else things tend to break on platforms that have
* multiple infrastructures for stdio.h and so on. flex is absolutely
* uncooperative about that, so we can't compile psqlscan.c on its own.
*/
#include "psqlscan.c"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册