Skip to content

Zend/Zend.m4: use AX_APPEND_COMPILE_FLAGS #10642

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

Closed
wants to merge 1 commit into from

Conversation

MaxKellermann
Copy link
Contributor

No description provided.

@Danack
Copy link
Contributor

Danack commented Feb 21, 2023

The new macro looks nice.

What's the reason for removing the lines for:

-Wlogical-op
-Wformat-truncation
-Wstrict-prototypes

?

@MaxKellermann
Copy link
Contributor Author

What's the reason for removing the lines for:

I didn't remove them - I rewrote them with AX_APPEND_COMPILE_FLAGS which allows multiple flags in one line, look:

+ AX_APPEND_COMPILE_FLAGS([-Wduplicated-cond -Wlogical-op -Wformat-truncation -Wstrict-prototypes],, [-Werror])

@devnexen
Copy link
Member

appreciate the simplification.

@petk
Copy link
Member

petk commented Feb 22, 2023

New *.m4 files need to be added also to the
scripts/phpize.in

which becomes the phpize shell script for PECL extensions.

https://github.com/php/php-src/blob/master/scripts/phpize.in

@MaxKellermann MaxKellermann force-pushed the ax_append_compile_flags branch from 762a0d0 to 4c467d6 Compare February 22, 2023 12:53
@MaxKellermann
Copy link
Contributor Author

New *.m4 files need to be added also to the
scripts/phpize.in

Amended.

@petk
Copy link
Member

petk commented Feb 22, 2023

And probably the same can be done for the AX_CHECK_COMPILE_FLAG call in sapi/fuzzer/config.m4?

@MaxKellermann
Copy link
Contributor Author

And probably the same can be done for the AX_CHECK_COMPILE_FLAG call in sapi/fuzzer/config.m4?

Yes, but I didn't do that yet because this instance then adds the result to two variables:

AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer-no-link], [
CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
CXXFLAGS="$CXXFLAGS -fsanitize=fuzzer-no-link"
],[
AC_MSG_ERROR(Compiler doesn't support -fsanitize=fuzzer-no-link)
])

AX_APPEND_COMPILE_FLAGS adds the flags only to the *FLAGS variable of the current language, i.e. C (CFLAGS).

The call in sapi/fuzzer/config.m4 checks only the capabilities of the C compiler and then adds the flag to both, which is incorrect, because it did not check whether the C++ compiler supports the flag.

For now, I wanted to leave it that way, to be improved later. The rest of PHP is inconsistent as well - it checks warning flags but adds it only to CFLAGS. See #10663 (comment) for some fallout of this existing bug. I will address all of these problems in a new PR, because I feel it is out of this PR's scope.

@Girgias Girgias requested a review from remicollet February 23, 2023 15:01
@@ -3,7 +3,10 @@ dnl Process this file with autoconf to produce a configure script.
dnl Include external macro definitions before the AC_INIT to also remove
dnl comments starting with # and empty newlines from the included files.
dnl ----------------------------------------------------------------------------
m4_include([build/ax_require_defined.m4])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be sorted alphabetically. Autoconf includes these at the beginning anyway regardless when calling some macro.

@petk
Copy link
Member

petk commented Mar 1, 2023

For the phpize script I'm not sure what would be the best approach. On one hand these additional m4 files maybe even shouldn't be included for PECL extensions. If they will be included, then what can also be done instead is something like this:

FILES_BUILD="*.m4 config.guess config.sub gen_stub.php ltmain.sh Makefile.global shtool"

And the phpize.m4 also have the m4_include() lines at the beginning which can be synced with configure.ac.

@MaxKellermann MaxKellermann deleted the ax_append_compile_flags branch March 7, 2023 10:38
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.

4 participants