1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

*/*.m4: update main() signatures.

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
This commit is contained in:
Michael Orlitzky
2023-03-03 12:16:14 -05:00
committed by George Peter Banyard
parent 3f7dadfeca
commit fa65873502
7 changed files with 32 additions and 32 deletions

View File

@@ -73,7 +73,7 @@ void *thread_routine(void *data) {
return data;
}
int main() {
int main(void) {
pthread_t thd;
pthread_mutexattr_t mattr;
int data = 1;