[php-src] Issue #10947: Building with clang 16

From: Date: Sun, 26 Mar 2023 14:00:44 +0000
Subject: [php-src] Issue #10947: Building with clang 16
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244015@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10947 Author: andypost ### Description The following code fails to pass configure check using clang 16 - https://github.com/php/php-src/blob/345abce590bf6b7aa2ffd49ba18e2ff479c3b8bd/ext/imap/config.m4#L232-L240 ``` PHP_IMAP_TEST_BUILD(utf8_to_mutf7_php, [ AC_DEFINE(HAVE_IMAP_MUTF7, 1, [ ]) ], [], $TST_LIBS, [ char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); } ]) ``` Resulted in this output: ``` configure:46317: clang -o conftest -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Werror=implicit-function-declaration -fvisibility=hidden -Os -fomit-frame-pointer -D_GNU_SOURCE -Wl,--as-needed,-O1,--sort-common -Wl,-rpath,/lib -L/lib conftest.c -lc-client -lcrypt -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lrt -lm -lacl -lxml2 -lpcre2-8 -lz >&5 conftest.c:330:40: error: call to undeclared function 'utf8_to_mutf7'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); } ^ conftest.c:330:40: note: did you mean 'utf8_to_mutf7_php'? conftest.c:330:12: note: 'utf8_to_mutf7_php' declared here char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); } ^ ~~~~~~~~~~~~~ utf8_to_mutf7_php 1 error generated. configure:46317: $? = 1 configure: failed program was: ``` But I expected this output instead: ``` configure:46317: clang -o conftest -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-error=implicit-function-declaration -fvisibility=hidden -Os -fomit-frame-pointer -D_GNU_SOURCE -Wl,--as-needed,-O1,--sort-common -Wl,-rpath,/lib -L/lib conftest.c -lc-client -lcrypt -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lrt -lm -lacl -lxml2 -lpcre2-8 -lz >&5 conftest.c:330:40: warning: call to undeclared function 'utf8_to_mutf7'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] char utf8_to_mutf7_php(){ return utf8_to_mutf7(""); } ^ 1 warning generated. configure:46317: $? = 0 configure:46338: checking whether rfc822_output_address_list function present configure:46381: clang -o conftest -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-error=implicit-function-declaration -fvisibility=hidden -Os -fomit-frame-pointer -D_GNU_SOURCE -Wl,--as-needed,-O1,--sort-common -Wl,-rpath,/lib -L/lib conftest.c -lc-client -lcrypt -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lrt -lm -lacl -lxml2 -lpcre2-8 -lz >&5 conftest.c:354:54: warning: non-void function does not return a value [-Wreturn-type] char foobar () {f = rfc822_output_address_list;} ^ 1 warning generated. configure:46381: $? = 0 configure:46386: result: yes ``` Additionally comparing config.log I see another failues ``` configure:16558: clang -c -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Werror=implicit-function-declaration -fvisibility=hidden -Os -fomit-frame-pointer -D_GNU_SOURCE conftest.c >&5 conftest.c:123:8: error: call to undeclared library function 'strchr' with type 'char *(const char *, int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ... VS ... configure:16558: clang -c -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-error=implicit-function-declaration -fvisibility=hidden -Os -fomit-frame-pointer -D_GNU_SOURCE conftest.c >&5 conftest.c:123:8: warning: call to undeclared library function 'strchr' with type 'char *(const char *, int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] (void) strchr; ^ conftest.c:123:8: note: include the header <string.h> or explicitly provide a declaration for 'strchr' 1 warning generated. configure:16558: $? = 0 configure:16558: clang -c -O2 -fomit-frame-pointer -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-error=implicit-function-declaration -fvisibility=hidden -fno-builtin -Os -fomit-frame-pointer -D_GNU_SOURCE conftest.c >&5 conftest.c:123:8: error: use of undeclared identifier 'strchr' (void) strchr; ^ 1 error generated. ``` ### PHP Version PHP 8.2.4 ### Operating System Alpinelinux

« previous php.bugs (#244015) next »