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

Fix check for using computed goto flag for re2c #11928

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

petk
Copy link
Member

@petk petk commented Aug 9, 2023

AC_LANG_SOURCE should be used instead of the AC_LANG_PROG so the compilation check can succeed when the computed goto extension is available to optimize conditional jumps. This one was missed when we were updating the Autoconf AC_TRY_COMPILE macros:

Steps to reproduce (Linux with GCC):

./buildconf
./configure --enable-re2c-cgoto

The -g flag for re2c isn't enabled (but could be):

...
checking whether to enable computed goto gcc extension with re2c... yes
checking whether re2c -g works... no
...

Update: This needs to be further fixed. This isn't working either.

@petk
Copy link
Member Author

petk commented Aug 10, 2023

I've fixed this now properly. Otherwise, now when using the ./configure --enable-re2c-cgoto, the -g flag is appended as it should be but then there are compilation uninitialized warnings probably due to some re2c bugs (I've tested this on re2c 3.0 and 3.1). Maybe this should go into PHP-8.3 only, since it can change the way software is built out there and to have as little worries if something won't work somewhere:

Zend/zend_language_scanner.c: In function ‘lex_scan’:
Zend/zend_language_scanner.c:1997:39: warning: ‘yych’ may be used uninitialized [-Wmaybe-uninitialized]
 1997 |                         goto *yytarget[yych];
      |                               ~~~~~~~~^~~~~~
Zend/zend_language_scanner.c:1354:17: note: ‘yych’ was declared here
 1354 |         YYCTYPE yych;
      |                 ^~~~

Code compiles and tests succeed properly otherwise.

@petk petk mentioned this pull request Jun 24, 2024
1 task
When the computed goto extension is available to optimize conditional
jumps, option --enable-re2c-cgoto adds the -g flag to re2c.

In this case the AC_LANG_SOURCE is used instead of the AC_LANG_PROG to
not wrap the compilation check program in another main() function. Code
is also simplified and help messages updated. This is a
compiler-agnostic extension, not only available with GCC.

When the check is successful, the -g is added, otherwise not.
@petk petk force-pushed the patch-autoconf-re2c-cgoto branch from fc12ea8 to 54c0c7f Compare June 24, 2024 23:24
@petk petk changed the base branch from PHP-8.1 to master June 24, 2024 23:25
@petk
Copy link
Member Author

petk commented Jun 24, 2024

Fix updated and adjusted. Targeting master branch (PHP-8.4-dev).

@petk petk merged commit 5db847e into php:master Jun 25, 2024
9 of 11 checks passed
@petk petk deleted the patch-autoconf-re2c-cgoto branch June 25, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant