The next generation of C compilers is going to enforce the C standard
more strictly:
https://wiki.gentoo.org/wiki/Modern_C_porting
One warning that will eventually become an error is
-Wimplicit-function-declaration. This is relatively easy to catch in
most code (it will fail to compile), but inside of autoconf tests it
can go unnoticed because many feature-test compilations fail by
design. For example,
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iconv.h>]],
[[iconv_ccs_init(NULL, NULL);]])]...
is designed to fail if iconv_ccs_init() is not in iconv.h. On the
other hand,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <iconv.h>
int main() {
printf("%d", _libiconv_version);
return 0;
}
should pass if _libiconv_version is defined. If the user has
-Werror=implicit-function-declaration in his CFLAGS, however,
it will not:
$ export CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
$ ./configure
...
checking if using GNU libiconv... no
This is because the stdio.h header that defines printf() is missing:
conftest.c:240:3: error: implicit declaration of function 'printf'
[-Werror=implicit-function-declaration]
240 | printf("%d", _libiconv_version);
| ^~~~~~
conftest.c:239:1: note: include '<stdio.h>' or provide a declaration
of 'printf'
This commit adds the include, correcting the test with any compiler
that balks at implicit function definitions.
Closes GH-10751
The next generation of C compilers is going to enforce the C standard
more strictly:
https://wiki.gentoo.org/wiki/Modern_C_porting
One warning that will soon become an error is -Wstrict-prototypes.
This is relatively easy to catch in most code (it will fail to
compile), but inside of autoconf tests it can go unnoticed because
many feature-test compilations fail by design. For example,
$ export CFLAGS="$CFLAGS -Werror=strict-prototypes"
$ ./configure
...
checking if iconv supports errno... no
configure: error: iconv does not support errno
(this is on a system where iconv *does* support errno). If errno
support were optional, that test would have "silently" disabled
it. The underlying issue here, from config.log, is
conftest.c:211:5: error: function declaration isn't a prototype
[-Werror=strict-prototypes]
211 | int main() {
This commit goes through all of our autoconf tests, replacing main()
with main(void). Up to equivalent types and variable renamings, that's
one of the two valid signatures, and satisfies the compiler (gcc-12 in
this case).
Fixes GH-10751
Pushing many commits to a pull request in a short amount of time can stall the
merge builds and also wastes energy unnecessarily. Enable concurrency to cancel
workflows of old commits in pull requests. Generate a common group name for pull
requests using github.event.pull_request.url with github.run_id as a fallback
for branches, which is unique and always available.
Closes GH-10799
`PHPAPI` is defined in `php.h`. It appears that without the explicit include,
recent versions of Visual Studio Code’s intellisense (rightfully) no longer
detect `PHPAPI`. This will then lead to a misparsing of the file, because
`PHPAPI` is assumed to be the return type and the actual return type is assumed
to be the function name, thus expecting a semicolon after the actual return
type. This in turn colors the entire header in red due to the detected syntax
error(s), making development very hard / impossible.
This did not cause issues outside of the IDE use case, because apparently all
users of `php_random.h` include `php.h` before including `php_random.h`.
This function returns 0 on error and 1 on success. The error case was
not checked and the function therefore would've returned true.
The only other caller of i2d_PKCS12_bio() in the file has
a correct error check.
Closes GH-10761.
warning: array subscript -65 is below array bounds of ‘const char[26]‘
[-Warray-bounds]
Errors like these sometimes only appear with optimizations when inlining/loop
unrolling.
Closes GH-10788
Due to an incorrect check, the datetime was never actually set.
To test this we need to write the file using phar, but read the file
using a different method to not get a cached, or a value that's been
transformed twice and is therefore accidentally correct.
Closes GH-10769
Thanks to Ilija Tovilo for noticing and reporting this problem. Thanks
also to Michael Voříšek for finding the StackOverflow post which
explained the reason for the failure.