Nothing Special   »   [go: up one dir, main page]

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

error: incompatible function pointer types initializing 'int (*)(void)' with an expression of type 'int (FILE *)' (aka 'int (struct __sFILE *)') [-Werror,-Wincompatible-function-pointer-types] #14549

Closed
ryandesign opened this issue Jun 13, 2024 · 2 comments

Comments

@ryandesign
Copy link
Contributor

Description

Configure test for fclose gets potentially wrong result due to -Wincompatible-function-pointer-types, which by default is now an error in the latest versions of clang. (I am using an older version of clang and have manually added -Werror=implicit-int -Werror=incompatible-function-pointer-types to CFLAGS to detect these kinds of errors.)

configure:17740: checking for fclose declaration
configure:17753: ccache /usr/bin/clang -c -pipe -Os -Werror=implicit-int -Werror=incompatible-function-pointer-types -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -ffp-contract=off -fvisibility=hidden -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -D_GNU_SOURCE conftest.c >&5
conftest.c:103:7: error: incompatible function pointer types initializing 'int (*)(void)' with an expression of type 'int (FILE *)' (aka 'int (struct __sFILE *)') [-Werror,-Wincompatible-function-pointer-types]
int (*func)(void) = fclose
      ^             ~~~~~~
1 error generated.
configure:17753: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PHP"
| #define PACKAGE_TARNAME "php"
| #define PACKAGE_VERSION "8.3.8"
| #define PACKAGE_STRING "PHP 8.3.8"
| #define PACKAGE_BUGREPORT "https://github.com/php/php-src/issues"
| #define PACKAGE_URL "https://www.php.net"
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_WCHAR_H 1
| #define STDC_HEADERS 1
| #define _ALL_SOURCE 1
| #define _DARWIN_C_SOURCE 1
| #define _GNU_SOURCE 1
| #define _HPUX_ALT_XOPEN_SOCKET_API 1
| #define _NETBSD_SOURCE 1
| #define _OPENBSD_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
| #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
| #define __STDC_WANT_IEC_60559_DFP_EXT__ 1
| #define __STDC_WANT_IEC_60559_EXT__ 1
| #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
| #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
| #define __STDC_WANT_LIB_EXT2__ 1
| #define __STDC_WANT_MATH_SPEC_FUNCS__ 1
| #define _TANDEM_SOURCE 1
| #define __EXTENSIONS__ 1
| #define HAVE_CPUID_COUNT 1
| #define HAVE_PHPDBG 1
| #define PHPDBG_DEBUG 0
| #define PHP_WRITE_STDOUT 1
| #define HAVE_SOCKET 1
| #define HAVE_SOCKETPAIR 1
| #define HAVE_HTONL 1
| #define HAVE_GETHOSTNAME 1
| #define HAVE_GETHOSTBYADDR 1
| #define HAVE_DLOPEN 1
| #define HAVE_DLSYM 1
| #define HAVE_LIBDL 1
| #define HAVE_LIBM 1
| #define HAVE_INET_ATON 1
| #define HAVE_STDINT_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_ARPA_NAMESER_H 1
| #define HAVE_DNS_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_GRP_H 1
| #define HAVE_LANGINFO_H 1
| #define HAVE_OS_SIGNPOST_H 1
| #define HAVE_POLL_H 1
| #define HAVE_PWD_H 1
| #define HAVE_RESOLV_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_SYSEXITS_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_UIO_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_TMMINTRIN_H 1
| #define HAVE_NMMINTRIN_H 1
| #define HAVE_WMMINTRIN_H 1
| #define HAVE_IMMINTRIN_H 1
| #define HAVE_STRUCT_TM_TM_ZONE 1
| #define HAVE_TM_ZONE 1
| #define MISSING_LOCALTIME_R_DECL 1
| #define MISSING_GMTIME_R_DECL 1
| #define MISSING_ASCTIME_R_DECL 1
| #define MISSING_CTIME_R_DECL 1
| #define MISSING_STRTOK_R_DECL 1
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main (void)
| {
| int (*func)(void) = fclose
|   ;
|   return 0;
| }
configure:17767: result: missing

These PHP versions also experience additional incompatible function pointer types errors but they have already been fixed in 9e226b2.

PHP Version

8.3.8, 8.2.20

Operating System

macOS 12

@ryandesign
Copy link
Contributor Author

PHP 8.1.29 does not have this problem.

configure:17173: checking for fclose declaration
configure:17186: ccache /usr/bin/clang -c -pipe -Os -Werror=implicit-int -Werror=incompatible-function-pointer-types -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -fvisibility=hidden -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk conftest.c >&5
configure:17186: $? = 0
configure:17192: result: ok

@ryandesign
Copy link
Contributor Author

Presumably caused by #13732.

ryandesign added a commit to ryandesign/php-src that referenced this issue Jun 13, 2024
ryandesign added a commit to ryandesign/php-src that referenced this issue Jun 13, 2024
@petk petk closed this as completed in b43378d Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants