[MacPorts] #67504: Implicit function declaration detection code doesn't work with newer clang
MacPorts
noreply at macports.org
Fri May 26 04:31:41 UTC 2023
#67504: Implicit function declaration detection code doesn't work with newer clang
-------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: base | Version: 2.8.1
Resolution: | Keywords:
Port: |
-------------------------+--------------------
Old description:
> MacPorts fails to detect [wiki:WimplicitFunctionDeclaration implicit
> declaration of function errors] in configure scripts when using open
> source clang 15 or later or clang from Xcode 14 (?) or later because the
> wording of the error message has changed. For example trying the
> [ticket:66435 pkgconfig] port:
>
> {{{
> % xcodebuild -version
> Xcode 13.2.1
> Build version 13C100
> %
> }}}
> {{{
> % sudo port clean pkgconfig
> ---> Cleaning pkgconfig
> % sudo port configure pkgconfig
> ---> Computing dependencies for pkgconfig
> ---> Fetching distfiles for pkgconfig
> ---> Verifying checksums for pkgconfig
> ---> Extracting pkgconfig
> ---> Applying patches to pkgconfig
> ---> Configuring pkgconfig
> Warning: Configuration logfiles contain indications of -Wimplicit-
> function-declaration; check that features were not accidentally disabled:
> pthread_cond_timedwait_monotonic_np: found in pkg-
> config-0.29.2/glib/config.log
> pthread_condattr_setclock: found in pkg-config-0.29.2/glib/config.log
> strcmp: found in pkg-config-0.29.2/glib/config.log
> exit: found in pkg-config-0.29.2/glib/config.log
> pthread_cond_timedwait_monotonic: found in pkg-
> config-0.29.2/glib/config.log
> %
> }}}
> {{{
> % sudo port clean pkgconfig
> ---> Cleaning pkgconfig
> % sudo port configure pkgconfig configure.compiler=macports-clang-15
> ---> Computing dependencies for pkgconfig
> ---> Fetching distfiles for pkgconfig
> ---> Verifying checksums for pkgconfig
> ---> Extracting pkgconfig
> ---> Applying patches to pkgconfig
> ---> Configuring pkgconfig
> %
> }}}
>
> The wording of the errors when they debuted in Xcode 12 was originally:
>
> {{{
> error: implicitly declaring library function '…' with type '…' [-Werror
> ,-Wimplicit-function-declaration]
> }}}
> and
> {{{
> error: implicit declaration of function '…' is invalid in C99 [-Werror
> ,-Wimplicit-function-declaration]
> }}}
>
> but now [https://github.com/llvm/llvm-
> project/commit/7d644e1215b376ec5e915df9ea2eeb56e2d94626#diff-
> 45afb7c228db564d8bdd83dc86deb16a2de9a21943e8b6693068f43c939d2170 it has
> changed] to:
>
> {{{
> error: call to undeclared library function '…' with type …; ISO C99 and
> later do not support implicit function declarations [-Wimplicit-function-
> declaration]
> }}}
> and
> {{{
> error: call to undeclared function …; ISO C99 and later do not support
> implicit function declarations [-Wimplicit-function-declaration]
> }}}
>
> Our code currently [https://github.com/macports/macports-
> base/blob/82b064968d0ae5561911b850249939a7f77ae158/src/port1.0/portconfigure.tcl#LL1879C73-L1879C110
> searches only for the regular expression] `(?:implicit declaration of
> function|implicitly declaring library function) '(\[^']+)'` in
> config.log. This will have to be extended to catch the new wording as
> well, noting that in the new wording the function name is not in
> quotation marks in one of the messages. Perhaps we should structure the
> regexp so that it can work whether or not the function names are in
> quotes, in case they change one or the other message in the future for
> consistency.
>
> We probably have to update the documentation in
> WimplicitFunctionDeclaration too.
New description:
MacPorts fails to detect [wiki:WimplicitFunctionDeclaration implicit
declaration of function errors] in configure scripts when using open
source clang 15 or later or clang from Xcode 14 (?) or later because the
wording of the error message has changed. For example trying the
[ticket:66435 pkgconfig] port:
{{{
% xcodebuild -version
Xcode 13.2.1
Build version 13C100
%
}}}
{{{
% sudo port clean pkgconfig
---> Cleaning pkgconfig
% sudo port configure pkgconfig
---> Computing dependencies for pkgconfig
---> Fetching distfiles for pkgconfig
---> Verifying checksums for pkgconfig
---> Extracting pkgconfig
---> Applying patches to pkgconfig
---> Configuring pkgconfig
Warning: Configuration logfiles contain indications of -Wimplicit-
function-declaration; check that features were not accidentally disabled:
pthread_cond_timedwait_monotonic_np: found in pkg-
config-0.29.2/glib/config.log
pthread_condattr_setclock: found in pkg-config-0.29.2/glib/config.log
strcmp: found in pkg-config-0.29.2/glib/config.log
exit: found in pkg-config-0.29.2/glib/config.log
pthread_cond_timedwait_monotonic: found in pkg-
config-0.29.2/glib/config.log
%
}}}
{{{
% sudo port clean pkgconfig
---> Cleaning pkgconfig
% sudo port configure pkgconfig configure.compiler=macports-clang-15
---> Computing dependencies for pkgconfig
---> Fetching distfiles for pkgconfig
---> Verifying checksums for pkgconfig
---> Extracting pkgconfig
---> Applying patches to pkgconfig
---> Configuring pkgconfig
%
}}}
The wording of the errors when they debuted in Xcode 12 was originally:
{{{
error: implicitly declaring library function '…' with type '…' [-Werror
,-Wimplicit-function-declaration]
}}}
and
{{{
error: implicit declaration of function '…' is invalid in C99 [-Werror
,-Wimplicit-function-declaration]
}}}
but now [https://github.com/llvm/llvm-
project/commit/7d644e1215b376ec5e915df9ea2eeb56e2d94626#diff-
45afb7c228db564d8bdd83dc86deb16a2de9a21943e8b6693068f43c939d2170 it has
changed] to:
{{{
error: call to undeclared library function '…' with type '…'; ISO C99 and
later do not support implicit function declarations [-Wimplicit-function-
declaration]
}}}
and
{{{
error: call to undeclared function '…'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
}}}
Our code currently [https://github.com/macports/macports-
base/blob/82b064968d0ae5561911b850249939a7f77ae158/src/port1.0/portconfigure.tcl#LL1879C73-L1879C110
searches only for the regular expression] `(?:implicit declaration of
function|implicitly declaring library function) '(\[^']+)'` in config.log.
This will have to be extended to catch the new wording as well, ~~noting
that in the new wording the function name is not in quotation marks in one
of the messages. Perhaps we should structure the regexp so that it can
work whether or not the function names are in quotes, in case they change
one or the other message in the future for consistency.~~
We probably have to update the documentation in
WimplicitFunctionDeclaration too.
--
Comment (by ryandesign):
Excuse me, looking at the logs I see that the function names are still in
quotes.
{{{
% grep -E ' implicit|call to undeclared' config.log.*
config.log.clang15:conftest.c:62:6: warning: call to undeclared library
function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99
and later do not support implicit function declarations [-Wimplicit-
function-declaration]
config.log.clang15:conftest.c:150:5: warning: call to undeclared library
function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99
and later do not support implicit function declarations [-Wimplicit-
function-declaration]
config.log.clang15:conftest.c:144:7: warning: call to undeclared library
function 'strcmp' with type 'int (const char *, const char *)'; ISO C99
and later do not support implicit function declarations [-Wimplicit-
function-declaration]
config.log.clang15:conftest.c:145:5: warning: call to undeclared library
function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99
and later do not support implicit function declarations [-Wimplicit-
function-declaration]
config.log.clang15:conftest.c:167:5: warning: call to undeclared library
function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99
and later do not support implicit function declarations [-Wimplicit-
function-declaration]
config.log.clang15:conftest.c:174:23: warning: call to undeclared function
'pthread_condattr_setclock'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]
config.log.clang15:conftest.c:174:1: warning: call to undeclared function
'pthread_cond_timedwait_monotonic'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
config.log.clang15:conftest.c:174:1: warning: call to undeclared function
'pthread_cond_timedwait_monotonic_np'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:62:6: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:62:6: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:62:6: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:149:5: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:142:7: error: implicitly declaring library
function 'strcmp' with type 'int (const char *, const char *)' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:143:5: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:164:5: error: implicitly declaring library
function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:170:23: error: implicit declaration of
function 'pthread_condattr_setclock' is invalid in C99 [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:170:1: error: implicit declaration of
function 'pthread_cond_timedwait_monotonic' is invalid in C99 [-Werror
,-Wimplicit-function-declaration]
config.log.xcode13:conftest.c:170:1: error: implicit declaration of
function 'pthread_cond_timedwait_monotonic_np' is invalid in C99 [-Werror
,-Wimplicit-function-declaration]
}}}
--
Ticket URL: <https://trac.macports.org/ticket/67504#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list