summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-01-30 18:09:25 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-01-31 09:52:40 +0100
commit37d0f7d3b3e9d87c4cc2ad1ca5bc26d77f49df38 (patch)
treee8fee00a06e8a132ed4cc2f2e8bd196a4d8545bb /sapi
parentb915d68852625b5d67443013f8282764b9cf89f3 (diff)
downloadphp-git-37d0f7d3b3e9d87c4cc2ad1ca5bc26d77f49df38.tar.gz
Use "%empty" in the parsers, instead of comments
The annotation %empty is properly enforced: warnings when it's missing, and errors when it's inappropriate. Support for %empty was introduced in Bison 3.0. Pass -Wempty-rule to Bison. Closes GH-5134
Diffstat (limited to 'sapi')
-rw-r--r--sapi/phpdbg/Makefile.frag2
-rw-r--r--sapi/phpdbg/phpdbg_parser.y5
2 files changed, 4 insertions, 3 deletions
diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag
index 65377e608a..448cc3676b 100644
--- a/sapi/phpdbg/Makefile.frag
+++ b/sapi/phpdbg/Makefile.frag
@@ -18,7 +18,7 @@ $(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
- @$(YACC) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@
+ @$(YACC) $(YFLAGS) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@
install-phpdbg: $(BUILD_BINARY)
@echo "Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/"
diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y
index 3031ce5a80..1384abe6fb 100644
--- a/sapi/phpdbg/phpdbg_parser.y
+++ b/sapi/phpdbg/phpdbg_parser.y
@@ -1,3 +1,4 @@
+%require "3.0"
%{
/*
@@ -65,7 +66,7 @@ typedef void* yyscan_t;
input
: command { $$ = $1; }
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
- | /* empty */
+ | %empty
;
command
@@ -143,7 +144,7 @@ parameter
req_id
: T_REQ_ID { PHPDBG_G(req_id) = $1.num; }
- | /* empty */
+ | %empty
;
full_expression