mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Add makefile rules to check for backtracking in backend and psql lexers.
Per discussion, we should enforce the policy of "no backtracking" in these performance-sensitive scanners.
This commit is contained in:
parent
77ce50a403
commit
ecf248737a
@ -17,7 +17,7 @@ OBJS= analyze.o gram.o keywords.o kwlookup.o parser.o \
|
|||||||
parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
|
parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
|
||||||
parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
|
parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
|
||||||
|
|
||||||
FLEXFLAGS = -CF
|
FLEXFLAGS = -CF -b -p -p
|
||||||
|
|
||||||
include $(top_srcdir)/src/backend/common.mk
|
include $(top_srcdir)/src/backend/common.mk
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ endif
|
|||||||
scan.c: scan.l
|
scan.c: scan.l
|
||||||
ifdef FLEX
|
ifdef FLEX
|
||||||
$(FLEX) $(FLEXFLAGS) -o'$@' $<
|
$(FLEX) $(FLEXFLAGS) -o'$@' $<
|
||||||
|
@if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup, see lex.backup."; exit 1; fi
|
||||||
else
|
else
|
||||||
@$(missing) flex $< $@
|
@$(missing) flex $< $@
|
||||||
endif
|
endif
|
||||||
@ -62,3 +63,5 @@ gram.o keywords.o parser.o: gram.h
|
|||||||
|
|
||||||
# gram.c, gram.h, and scan.c are in the distribution tarball, so they
|
# gram.c, gram.h, and scan.c are in the distribution tarball, so they
|
||||||
# are not cleaned here.
|
# are not cleaned here.
|
||||||
|
clean distclean maintainer-clean:
|
||||||
|
rm -f lex.backup
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
* for handling float numbers and continued string literals. If you change
|
* for handling float numbers and continued string literals. If you change
|
||||||
* the lexical rules, verify that you haven't broken the no-backtrack
|
* the lexical rules, verify that you haven't broken the no-backtrack
|
||||||
* property by running flex with the "-b" option and checking that the
|
* property by running flex with the "-b" option and checking that the
|
||||||
* resulting "lex.backup" file says that no backing up is needed.
|
* resulting "lex.backup" file says that no backing up is needed. (As of
|
||||||
|
* Postgres 9.2, this check is made automatically by the Makefile.)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
|
||||||
|
@ -26,7 +26,7 @@ OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
|
|||||||
sql_help.o \
|
sql_help.o \
|
||||||
$(WIN32RES)
|
$(WIN32RES)
|
||||||
|
|
||||||
FLEXFLAGS = -Cfe
|
FLEXFLAGS = -Cfe -b -p -p
|
||||||
|
|
||||||
|
|
||||||
all: psql
|
all: psql
|
||||||
@ -52,6 +52,7 @@ mainloop.o: psqlscan.c
|
|||||||
psqlscan.c: psqlscan.l
|
psqlscan.c: psqlscan.l
|
||||||
ifdef FLEX
|
ifdef FLEX
|
||||||
$(FLEX) $(FLEXFLAGS) -o'$@' $<
|
$(FLEX) $(FLEXFLAGS) -o'$@' $<
|
||||||
|
@if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup, see lex.backup."; exit 1; fi
|
||||||
else
|
else
|
||||||
@$(missing) flex $< $@
|
@$(missing) flex $< $@
|
||||||
endif
|
endif
|
||||||
@ -70,7 +71,7 @@ uninstall:
|
|||||||
|
|
||||||
# psqlscan.c is in the distribution tarball, so is not cleaned here
|
# psqlscan.c is in the distribution tarball, so is not cleaned here
|
||||||
clean distclean:
|
clean distclean:
|
||||||
rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c
|
rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c lex.backup
|
||||||
|
|
||||||
maintainer-clean: distclean
|
maintainer-clean: distclean
|
||||||
rm -f sql_help.h sql_help.c psqlscan.c
|
rm -f sql_help.h sql_help.c psqlscan.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user