Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define default RE2C_FLAGS #14615

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/Makefile.frag
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h

$(srcdir)/zend_language_scanner.c $(srcdir)/zend_language_scanner_defs.h: $(srcdir)/zend_language_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)

$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
Expand All @@ -26,7 +26,7 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
@$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@

$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)

# Use an intermediate target to indicate that zend_vm_gen.php produces both files
# at the same time, rather than the same recipe applying for two different targets.
Expand Down
7 changes: 5 additions & 2 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1690,10 +1690,11 @@ AC_DEFUN([PHP_PROG_BISON], [
])

dnl
dnl PHP_PROG_RE2C([MIN-VERSION])
dnl PHP_PROG_RE2C([min-version], [options])
dnl
dnl Search for the re2c and optionally check if version is at least the minimum
dnl required version MIN-VERSION.
dnl required version "min-version". The whitespace separated "options" argument
dnl are the re2c command-line flags added to all re2c command-line invocations.
dnl
AC_DEFUN([PHP_PROG_RE2C],[
AC_CHECK_PROG(RE2C, re2c, re2c)
Expand Down Expand Up @@ -1745,6 +1746,8 @@ AC_DEFUN([PHP_PROG_RE2C],[
esac

PHP_SUBST(RE2C)
AS_VAR_SET([RE2C_FLAGS], [m4_normalize([$2])])
PHP_SUBST([RE2C_FLAGS])
])

AC_DEFUN([PHP_PROG_PHP],[
Expand Down
12 changes: 4 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ PHP_RUNPATH_SWITCH
dnl Checks for some support/generator progs.
PHP_PROG_AWK
PHP_PROG_BISON([3.0.0])
PHP_PROG_RE2C([1.0.3])
PHP_PROG_RE2C([1.0.3], [--no-generation-date])
PHP_PROG_PHP()

PHP_ARG_ENABLE([re2c-cgoto],
Expand All @@ -176,9 +176,7 @@ PHP_ARG_ENABLE([re2c-cgoto],
[no],
[no])

if test "$PHP_RE2C_CGOTO" = "no"; then
RE2C_FLAGS=""
else
AS_VAR_IF([PHP_RE2C_CGOTO], [no],, [
AC_MSG_CHECKING([whether re2c -g works])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
int main(int argc, const char **argv)
Expand All @@ -192,14 +190,12 @@ label2:
return 0;
}
]])],[
RE2C_FLAGS=""
AC_MSG_RESULT([no])
],[
RE2C_FLAGS="-g"
RE2C_FLAGS="$RE2C_FLAGS -g"
AC_MSG_RESULT([yes])
])
fi
PHP_SUBST(RE2C_FLAGS)
])

dnl Platform-specific compile settings.
dnl ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ext/json/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$(srcdir)/json_scanner.c $(srcdir)/php_json_scanner_defs.h: $(srcdir)/json_scanner.re $(srcdir)/json_parser.tab.h
@$(RE2C) $(RE2C_FLAGS) -t $(srcdir)/php_json_scanner_defs.h --no-generation-date -bci -o $(srcdir)/json_scanner.c $(srcdir)/json_scanner.re
@$(RE2C) $(RE2C_FLAGS) -t $(srcdir)/php_json_scanner_defs.h -bci -o $(srcdir)/json_scanner.c $(srcdir)/json_scanner.re

$(srcdir)/json_parser.tab.c $(srcdir)/json_parser.tab.h: $(srcdir)/json_parser.y
@$(YACC) $(YFLAGS) --defines -l $(srcdir)/json_parser.y -o $(srcdir)/json_parser.tab.c
2 changes: 1 addition & 1 deletion ext/json/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ext\json\json_scanner.c ext\json\php_json_scanner_defs.h: ext\json\json_scanner.re ext\json\json_parser.tab.h
$(RE2C) $(RE2C_FLAGS) -t ext/json/php_json_scanner_defs.h --no-generation-date -bci -o ext/json/json_scanner.c ext/json/json_scanner.re
$(RE2C) $(RE2C_FLAGS) -t ext/json/php_json_scanner_defs.h -bci -o ext/json/json_scanner.c ext/json/json_scanner.re

ext\json\json_parser.tab.c ext\json\json_parser.tab.h: ext\json\json_parser.y
$(BISON) $(BISON_FLAGS) --defines -l ext/json/json_parser.y -o ext/json/json_parser.tab.c
4 changes: 2 additions & 2 deletions ext/pdo/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re
@(cd $(top_srcdir); \
if test -f ./pdo_sql_parser.re; then \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o pdo_sql_parser.c pdo_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o pdo_sql_parser.c pdo_sql_parser.re; \
else \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.re; \
fi)
2 changes: 1 addition & 1 deletion ext/pdo/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext\pdo\pdo_sql_parser.c: ext\pdo\pdo_sql_parser.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.re
$(RE2C) $(RE2C_FLAGS) -o ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.re
4 changes: 2 additions & 2 deletions ext/pdo_mysql/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(srcdir)/mysql_sql_parser.c: $(srcdir)/mysql_sql_parser.re
@(cd $(top_srcdir); \
if test -f ./mysql_sql_parser.re; then \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o mysql_sql_parser.c mysql_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o mysql_sql_parser.c mysql_sql_parser.re; \
else \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_mysql/mysql_sql_parser.c ext/pdo_mysql/mysql_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_mysql/mysql_sql_parser.c ext/pdo_mysql/mysql_sql_parser.re; \
fi)
2 changes: 1 addition & 1 deletion ext/pdo_mysql/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext\pdo_mysql\mysql_sql_parser.c: ext\pdo_mysql\mysql_sql_parser.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_mysql/mysql_sql_parser.c ext/pdo_mysql/mysql_sql_parser.re
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_mysql/mysql_sql_parser.c ext/pdo_mysql/mysql_sql_parser.re
4 changes: 2 additions & 2 deletions ext/pdo_pgsql/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(srcdir)/pgsql_sql_parser.c: $(srcdir)/pgsql_sql_parser.re
@(cd $(top_srcdir); \
if test -f ./pgsql_sql_parser.re; then \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o pgsql_sql_parser.c pgsql_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o pgsql_sql_parser.c pgsql_sql_parser.re; \
else \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_pgsql/pgsql_sql_parser.c ext/pdo_pgsql/pgsql_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_pgsql/pgsql_sql_parser.c ext/pdo_pgsql/pgsql_sql_parser.re; \
fi)
2 changes: 1 addition & 1 deletion ext/pdo_pgsql/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext\pdo_pgsql\pgsql_sql_parser.c: ext\pdo_pgsql\pgsql_sql_parser.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_pgsql/pgsql_sql_parser.c ext/pdo_pgsql/pgsql_sql_parser.re
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_pgsql/pgsql_sql_parser.c ext/pdo_pgsql/pgsql_sql_parser.re
4 changes: 2 additions & 2 deletions ext/pdo_sqlite/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(srcdir)/sqlite_sql_parser.c: $(srcdir)/sqlite_sql_parser.re
@(cd $(top_srcdir); \
if test -f ./sqlite_sql_parser.re; then \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o sqlite_sql_parser.c sqlite_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o sqlite_sql_parser.c sqlite_sql_parser.re; \
else \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_sqlite/sqlite_sql_parser.c ext/pdo_sqlite/sqlite_sql_parser.re; \
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_sqlite/sqlite_sql_parser.c ext/pdo_sqlite/sqlite_sql_parser.re; \
fi)
2 changes: 1 addition & 1 deletion ext/pdo_sqlite/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext\pdo_sqlite\sqlite_sql_parser.c: ext\pdo_sqlite\sqlite_sql_parser.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -o ext/pdo_sqlite/sqlite_sql_parser.c ext/pdo_sqlite/sqlite_sql_parser.re
$(RE2C) $(RE2C_FLAGS) -o ext/pdo_sqlite/sqlite_sql_parser.c ext/pdo_sqlite/sqlite_sql_parser.re
4 changes: 2 additions & 2 deletions ext/phar/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$(srcdir)/phar_path_check.c: $(srcdir)/phar_path_check.re
@(cd $(top_srcdir); \
if test -f ./php_phar.h; then \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o phar_path_check.c phar_path_check.re; \
$(RE2C) $(RE2C_FLAGS) -b -o phar_path_check.c phar_path_check.re; \
else \
$(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/phar/phar_path_check.c ext/phar/phar_path_check.re; \
$(RE2C) $(RE2C_FLAGS) -b -o ext/phar/phar_path_check.c ext/phar/phar_path_check.re; \
fi)

pharcmd: $(builddir)/phar.php $(builddir)/phar.phar
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ext\phar\phar_path_check.c: ext\phar\phar_path_check.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/phar/phar_path_check.c ext/phar/phar_path_check.re
$(RE2C) $(RE2C_FLAGS) -b -o ext/phar/phar_path_check.c ext/phar/phar_path_check.re
4 changes: 2 additions & 2 deletions ext/standard/Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$(srcdir)/var_unserializer.c: $(srcdir)/var_unserializer.re
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re)

$(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re)

$(builddir)/info.lo: $(builddir)/../../main/build-defs.h

Expand Down
4 changes: 2 additions & 2 deletions ext/standard/Makefile.frag.w32
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ext\standard\var_unserializer.c: ext\standard\var_unserializer.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re
$(RE2C) $(RE2C_FLAGS) -b -o ext/standard/var_unserializer.c ext/standard/var_unserializer.re

ext\standard\url_scanner_ex.c: ext\standard\url_scanner_ex.re
cd $(PHP_SRC_DIR)
$(RE2C) $(RE2C_FLAGS) --no-generation-date -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re
$(RE2C) $(RE2C_FLAGS) -b -o ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re

$(BUILD_DIR)\ext\standard\basic_functions.obj: $(PHP_SRC_DIR)\Zend\zend_language_parser.h
2 changes: 1 addition & 1 deletion sapi/phpdbg/Makefile.frag
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $(BUILD_BINARY): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_PHPDBG_OBJS)
$(builddir)/phpdbg_lexer.lo: $(srcdir)/phpdbg_parser.h

$(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l)

$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
Expand Down
4 changes: 2 additions & 2 deletions scripts/dev/genfiles
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ YACC=${YACC:-bison}
YACC="$YACC -l"
YFLAGS="-Wall"
RE2C=${RE2C:-re2c}
RE2C_FLAGS="-i"
RE2C_FLAGS="--no-generation-date -i"
SED=${SED:-sed}
MAKE=${MAKE:-make}

Expand Down Expand Up @@ -70,7 +70,7 @@ else
fi

# Check required re2c version from the configure.ac file.
required_re2c_version=$($SED -n 's/PHP_PROG_RE2C(\[\(.*\)\])/\1/p' configure.ac)
required_re2c_version=$($SED -n 's/PHP_PROG_RE2C(\[\([0-9.]*\)\][^)]*)*/\1/p' configure.ac)
set -f; IFS='.'; set -- $required_re2c_version; set +f; IFS=' '
required_re2c_num="$(expr ${1:-0} \* 10000 + ${2:-0} \* 100 + ${3:-0})"

Expand Down
6 changes: 3 additions & 3 deletions win32/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ sapi\phpdbg\phpdbg_parser.c sapi\phpdbg\phpdbg_parser.h: sapi\phpdbg\phpdbg_pars

!if $(RE2C) != ""
Zend\zend_ini_scanner.c Zend\zend_ini_scanner_defs.h: Zend\zend_ini_scanner.l
$(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l

Zend\zend_language_scanner.c Zend\zend_language_scanner_defs.h: Zend\zend_language_scanner.l
$(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l

sapi\phpdbg\phpdbg_lexer.c: sapi\phpdbg\phpdbg_lexer.l
$(RE2C) $(RE2C_FLAGS) --no-generation-date -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l
$(RE2C) $(RE2C_FLAGS) -cbdFo sapi/phpdbg/phpdbg_lexer.c sapi/phpdbg/phpdbg_lexer.l
!endif

!if "$(ZTS)" == "1"
Expand Down
1 change: 1 addition & 0 deletions win32/build/confutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3006,6 +3006,7 @@ function toolset_setup_project_tools()
}

var RE2C = PATH_PROG('re2c');
DEFINE('RE2C_FLAGS', '--no-generation-date');
if (RE2C) {
var RE2CVERS = probe_binary(RE2C, "version");
STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
Expand Down
Loading