Skip to content

Commit ecaf7c5

Browse files
committed
Move gramparse.h to src/backend/parser
This header is semi-private, being used only in files related to raw parsing, so move to the backend directory where those files live. This allows removal of Makefile rules that symlink gram.h to src/include/parser, since gramparse.h can now include gram.h from within the same directory. This has the side-effect of no longer installing gram.h and gramparse.h, but there doesn't seem to be a good reason to continue doing so. Per suggestion from Andres Freund and Peter Eisentraut Discussion: https://www.postgresql.org/message-id/20220904181759.px6uosll6zbxcum5%40awork3.anarazel.de
1 parent f352e2d commit ecaf7c5

File tree

10 files changed

+8
-20
lines changed

10 files changed

+8
-20
lines changed

src/backend/Makefile

+1-6
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,7 @@ submake-utils-headers:
153153

154154
.PHONY: generated-headers
155155

156-
generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/storage/lwlocknames.h submake-catalog-headers submake-nodes-headers submake-utils-headers
157-
158-
$(top_builddir)/src/include/parser/gram.h: parser/gram.h
159-
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
160-
cd '$(dir $@)' && rm -f $(notdir $@) && \
161-
$(LN_S) "$$prereqdir/$(notdir $<)" .
156+
generated-headers: $(top_builddir)/src/include/storage/lwlocknames.h submake-catalog-headers submake-nodes-headers submake-utils-headers
162157

163158
$(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h
164159
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \

src/backend/parser/gram.y

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
#include "catalog/pg_trigger.h"
5656
#include "commands/defrem.h"
5757
#include "commands/trigger.h"
58+
#include "gramparse.h"
5859
#include "nodes/makefuncs.h"
5960
#include "nodes/nodeFuncs.h"
60-
#include "parser/gramparse.h"
6161
#include "parser/parser.h"
6262
#include "storage/lmgr.h"
6363
#include "utils/date.h"

src/include/parser/gramparse.h renamed to src/backend/parser/gramparse.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* src/include/parser/gramparse.h
14+
* src/backend/parser/gramparse.h
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -26,7 +26,7 @@
2626
* NB: include gram.h only AFTER including scanner.h, because scanner.h
2727
* is what #defines YYLTYPE.
2828
*/
29-
#include "parser/gram.h"
29+
#include "gram.h"
3030

3131
/*
3232
* The YY_EXTRA data that a flex scanner allows us to pass around. Private

src/backend/parser/parser.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "postgres.h"
2323

2424
#include "mb/pg_wchar.h"
25-
#include "parser/gramparse.h"
25+
#include "gramparse.h"
2626
#include "parser/parser.h"
2727
#include "parser/scansup.h"
2828

src/backend/parser/scan.l

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <unistd.h>
3737

3838
#include "common/string.h"
39-
#include "parser/gramparse.h"
39+
#include "gramparse.h"
4040
#include "parser/parser.h" /* only needed for GUC variables */
4141
#include "parser/scansup.h"
4242
#include "port/pg_bitutils.h"

src/include/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ install: all installdirs
5353
$(INSTALL_DATA) $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir || exit; \
5454
done
5555
ifeq ($(vpath_build),yes)
56-
for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \
56+
for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h storage/lwlocknames.h utils/probes.h; do \
5757
$(INSTALL_DATA) $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \
5858
done
5959
endif
@@ -72,7 +72,7 @@ uninstall:
7272

7373
clean:
7474
rm -f utils/fmgroids.h utils/fmgrprotos.h utils/errcodes.h utils/header-stamp
75-
rm -f parser/gram.h storage/lwlocknames.h utils/probes.h
75+
rm -f storage/lwlocknames.h utils/probes.h
7676
rm -f catalog/schemapg.h catalog/system_fk_info.h
7777
rm -f catalog/pg_*_d.h catalog/header-stamp
7878
rm -f nodes/nodetags.h nodes/header-stamp

src/include/parser/.gitignore

-1
This file was deleted.

src/tools/msvc/Install.pm

-4
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,6 @@ sub CopyIncludeFiles
618618
'Server headers',
619619
$target . '/include/server/',
620620
'src/include/', 'pg_config.h', 'pg_config_ext.h', 'pg_config_os.h');
621-
CopyFiles(
622-
'Grammar header',
623-
$target . '/include/server/parser/',
624-
'src/backend/parser/', 'gram.h');
625621
CopySetOfFiles(
626622
'',
627623
[ glob("src\\include\\*.h") ],

src/tools/pginclude/cpluspluscheck

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ do
125125
test "$f" = contrib/cube/cubeparse.h && continue
126126
test "$f" = contrib/seg/segparse.h && continue
127127
test "$f" = src/backend/bootstrap/bootparse.h && continue
128-
test "$f" = src/include/parser/gram.h && continue
129128
test "$f" = src/backend/parser/gram.h && continue
130129
test "$f" = src/backend/replication/repl_gram.h && continue
131130
test "$f" = src/backend/replication/syncrep_gram.h && continue

src/tools/pginclude/headerscheck

-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ do
120120
test "$f" = contrib/cube/cubeparse.h && continue
121121
test "$f" = contrib/seg/segparse.h && continue
122122
test "$f" = src/backend/bootstrap/bootparse.h && continue
123-
test "$f" = src/include/parser/gram.h && continue
124123
test "$f" = src/backend/parser/gram.h && continue
125124
test "$f" = src/backend/replication/repl_gram.h && continue
126125
test "$f" = src/backend/replication/syncrep_gram.h && continue

0 commit comments

Comments
 (0)