diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-11-10 23:12:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-11-10 23:12:44 +0000 |
commit | fd20a349c4c3e1b46b0fe81b369e0f877259d9ee (patch) | |
tree | 6c27e8e5908515a2fecda51ae477a9c29f904961 | |
parent | 0b9ed725d1c4bca8b675239a3e1a3c808b4b39ee (diff) | |
download | postgresql-fd20a349c4c3e1b46b0fe81b369e0f877259d9ee.tar.gz postgresql-fd20a349c4c3e1b46b0fe81b369e0f877259d9ee.zip |
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.
-rw-r--r-- | src/bin/psql/Makefile | 7 | ||||
-rw-r--r-- | src/bin/psql/mainloop.c | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile index efd9c4b4d38..2b57599f70c 100644 --- a/src/bin/psql/Makefile +++ b/src/bin/psql/Makefile @@ -5,7 +5,7 @@ # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.54 2005/05/24 16:45:23 tgl Exp $ +# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.54.2.1 2009/11/10 23:12:44 tgl Exp $ # #------------------------------------------------------------------------- @@ -21,7 +21,7 @@ override CPPFLAGS := -DFRONTEND -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS) 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 \ - psqlscan.o tab-complete.o mbprint.o $(WIN32RES) + tab-complete.o mbprint.o $(WIN32RES) FLEXFLAGS = -Cfe @@ -41,6 +41,9 @@ $(srcdir)/sql_help.h: @echo "*** Perl is needed to build psql help." endif +# psqlscan is compiled as part of mainloop +mainloop.o: psqlscan.c + $(srcdir)/psqlscan.c: psqlscan.l ifdef FLEX $(FLEX) $(FLEXFLAGS) -o'$@' $< diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index 775701a0106..4f2c8e8dff8 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.68 2005/10/15 02:49:40 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.68.2.1 2009/11/10 23:12:44 tgl Exp $ */ #include "postgres_fe.h" #include "mainloop.h" @@ -342,3 +342,13 @@ MainLoop(FILE *source) return successResult; } /* 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" |