Skip to content

Commit 550b9d2

Browse files
committed
Get rid of jsonpath_gram.h and jsonpath_scanner.h
Jsonpath grammar and scanner are both quite small. It doesn't worth complexity to compile them separately. This commit makes grammar and scanner be compiled at once. Therefore, jsonpath_gram.h and jsonpath_gram.h are no longer needed. This commit also does some reorganization of code in jsonpath_gram.y. Discussion: https://postgr.es/m/d47b2023-3ecb-5f04-d253-d557547cf74f%402ndQuadrant.com
1 parent 641fde2 commit 550b9d2

File tree

9 files changed

+268
-311
lines changed

9 files changed

+268
-311
lines changed

src/backend/Makefile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ parser/gram.h: parser/gram.y
136136
storage/lmgr/lwlocknames.h: storage/lmgr/generate-lwlocknames.pl storage/lmgr/lwlocknames.txt
137137
$(MAKE) -C storage/lmgr lwlocknames.h lwlocknames.c
138138

139-
utils/adt/jsonpath_gram.h: utils/adt/jsonpath_gram.y
140-
$(MAKE) -C utils/adt jsonpath_gram.h
141-
142139
# run this unconditionally to avoid needing to know its dependencies here:
143140
submake-catalog-headers:
144141
$(MAKE) -C catalog distprep generated-header-symlinks
@@ -162,7 +159,7 @@ submake-utils-headers:
162159

163160
.PHONY: generated-headers
164161

165-
generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/storage/lwlocknames.h $(top_builddir)/src/include/utils/jsonpath_gram.h submake-catalog-headers submake-utils-headers
162+
generated-headers: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/storage/lwlocknames.h submake-catalog-headers submake-utils-headers
166163

167164
$(top_builddir)/src/include/parser/gram.h: parser/gram.h
168165
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
@@ -174,11 +171,6 @@ $(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h
174171
cd '$(dir $@)' && rm -f $(notdir $@) && \
175172
$(LN_S) "$$prereqdir/$(notdir $<)" .
176173

177-
$(top_builddir)/src/include/utils/jsonpath_gram.h: utils/adt/jsonpath_gram.h
178-
prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
179-
cd '$(dir $@)' && rm -f $(notdir $@) && \
180-
$(LN_S) "$$prereqdir/$(notdir $<)" .
181-
182174
utils/probes.o: utils/probes.d $(SUBDIROBJS)
183175
$(DTRACE) $(DTRACEFLAGS) -C -G -s $(call expand_subsys,$^) -o $@
184176

@@ -193,7 +185,7 @@ distprep:
193185
$(MAKE) -C replication repl_gram.c repl_scanner.c syncrep_gram.c syncrep_scanner.c
194186
$(MAKE) -C storage/lmgr lwlocknames.h lwlocknames.c
195187
$(MAKE) -C utils distprep
196-
$(MAKE) -C utils/adt jsonpath_gram.c jsonpath_gram.h jsonpath_scan.c
188+
$(MAKE) -C utils/adt jsonpath_gram.c jsonpath_scan.c
197189
$(MAKE) -C utils/misc guc-file.c
198190
$(MAKE) -C utils/sort qsort_tuple.c
199191

@@ -316,7 +308,6 @@ maintainer-clean: distclean
316308
storage/lmgr/lwlocknames.c \
317309
storage/lmgr/lwlocknames.h \
318310
utils/adt/jsonpath_gram.c \
319-
utils/adt/jsonpath_gram.h \
320311
utils/adt/jsonpath_scan.c \
321312
utils/misc/guc-file.c \
322313
utils/sort/qsort_tuple.c

src/backend/utils/adt/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/jsonpath_gram.h
21
/jsonpath_gram.c
32
/jsonpath_scan.c

src/backend/utils/adt/Makefile

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ OBJS = acl.o amutils.o arrayfuncs.o array_expanded.o array_selfuncs.o \
1717
float.o format_type.o formatting.o genfile.o \
1818
geo_ops.o geo_selfuncs.o geo_spgist.o inet_cidr_ntop.o inet_net_pton.o \
1919
int.o int8.o json.o jsonb.o jsonb_gin.o jsonb_op.o jsonb_util.o \
20-
jsonfuncs.o jsonpath_gram.o jsonpath_scan.o jsonpath.o jsonpath_exec.o \
20+
jsonfuncs.o jsonpath_gram.o jsonpath.o jsonpath_exec.o \
2121
like.o like_support.o lockfuncs.o mac.o mac8.o misc.o name.o \
2222
network.o network_gist.o network_selfuncs.o network_spgist.o \
2323
numeric.o numutils.o oid.o oracle_compat.o \
@@ -33,26 +33,13 @@ OBJS = acl.o amutils.o arrayfuncs.o array_expanded.o array_selfuncs.o \
3333
txid.o uuid.o varbit.o varchar.o varlena.o version.o \
3434
windowfuncs.o xid.o xml.o
3535

36-
# There is no correct way to write a rule that generates two files.
37-
# See comment in src/backend/parser/Makefile for the explanation of
38-
# the trick used here.
39-
40-
jsonpath_gram.h: jsonpath_gram.c
41-
touch $@
42-
43-
jsonpath_gram.c: BISONFLAGS += -d
44-
4536
jsonpath_scan.c: FLEXFLAGS = -CF -p -p
4637

47-
4838
# Force these dependencies to be known even without dependency info built:
49-
jsonpath_gram.o jsonpath_scan.o jsonpath_parser.o: jsonpath_gram.h
50-
51-
# jsonpath_gram.c, jsonpath_gram.h, and jsonpath_scan.c are in the
52-
# distribution tarball, so they are not cleaned here.
53-
clean distclean maintainer-clean:
54-
rm -f lex.backup
39+
jsonpath_gram.o: jsonpath_scan.c
5540

41+
# jsonpath_gram.c and jsonpath_scan.c are in the distribution tarball,
42+
# so they are not cleaned here.
5643

5744
like.o: like.c like_match.c
5845

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy