]> granicus.if.org Git - php/commitdiff
Bison: enable all the warnings and fix them
authorAkim Demaille <akim.demaille@gmail.com>
Sat, 1 Feb 2020 06:03:13 +0000 (07:03 +0100)
committerkocsismate <kocsismate@woohoolabs.com>
Sat, 1 Feb 2020 13:21:21 +0000 (14:21 +0100)
First, fix 5547d361208d90e12d53bb62bb2ffbbff9b93ca0: the definition of
YFLAGS was not passed into the Makefile: AC_SUBST does not suffice, we
need PHP_SUBST_OLD.  While at it, allow to pass variable and value at
the same time.

Then pass -Wall to bison, rather than only -Wempty-rules.

Use %precedence where associativity is useless.

Remove useless %precedence.
GH-5138

Zend/zend_ini_parser.y
Zend/zend_language_parser.y
build/php.m4

index 9e350664ba1fbbeb9fdc8b655824693e1bbf7989..6b69aec7d91363eb6b321d2b65363b84bcd3440b 100644 (file)
@@ -309,7 +309,7 @@ static void zval_ini_dtor(zval *zv)
 %token END_OF_LINE
 %token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}'
 %left '|' '&' '^'
-%right '~' '!'
+%precedence '~' '!'
 
 %destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL cfg_var_ref constant_literal constant_string encapsed_list expr option_offset section_string_or_value string_or_value var_string_list var_string_list_section
 
index 4fe6f77bb1662b91627f305e62d2ff0f8d5f6f7d..2f7b772c8b8fccd8c9122f3313ea3a90999bf6ed 100644 (file)
@@ -79,7 +79,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
 %precedence T_INSTANCEOF
 %precedence '~' T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
 %right T_POW
-%precedence T_NEW T_CLONE
+%precedence T_CLONE
 
 /* Resolve danging else conflict */
 %precedence T_NOELSE
index 87527f43813cfaa44bbbd84bc00c6a1de35d328d..8cdfb4da518c108b7071649bf4bba889013b0bc0 100644 (file)
@@ -81,7 +81,7 @@ AC_DEFUN([PHP_DEFINE],[
 dnl
 dnl PHP_SUBST(varname)
 dnl
-dnl Adds variable with it's value into Makefile, e.g.:
+dnl Adds variable with its value into Makefile, e.g.:
 dnl CC = gcc
 dnl
 AC_DEFUN([PHP_SUBST],[
@@ -89,14 +89,14 @@ AC_DEFUN([PHP_SUBST],[
 ])
 
 dnl
-dnl PHP_SUBST_OLD(varname)
+dnl PHP_SUBST_OLD(varname, [VALUE])
 dnl
 dnl Same as PHP_SUBST() but also substitutes all @VARNAME@ instances in every
 dnl file passed to AC_OUTPUT.
 dnl
 AC_DEFUN([PHP_SUBST_OLD],[
-  PHP_SUBST($1)
-  AC_SUBST($1)
+  AC_SUBST($@)
+  PHP_SUBST([$1])
 ])
 
 dnl
@@ -1815,7 +1815,7 @@ AC_DEFUN([PHP_PROG_BISON], [
     done
 
     if test "$php_bison_check" != "invalid"; then
-      AC_SUBST([YFLAGS], [-Wempty-rule])
+      PHP_SUBST_OLD([YFLAGS], [-Wall])
       AC_MSG_RESULT([$php_bison_version (ok)])
     else
       AC_MSG_RESULT([$php_bison_version])