port maintainers: please test check for implicit decls

Clemens Lang cal at macports.org
Tue Nov 24 22:15:53 UTC 2020


Hello port maintainers,

I just merged https://github.com/macports/macports-base/pull/217, a
sanity check that runs after the configure phase to detect implicitly
declared functions in autotools configure scripts.

This will become a significant problem with the release of Big Sur,
since Apple has made -Wimplicit-function-declaration an error by default
due to details of the calling convention on Apple Silicon.

The problem this warning is designed to catch is as follows:

1. A configure check tests for presence and usability of a function, but
   does not include a header declaring the function.
2. The configure check fails due to -Wimplicit-function-declaration, but
   would succeed otherwise.
3. The configure script disables certain functionality based on this
   incorrect result, and software compiles differently than it used to.

If you're regularly writing Portfiles and building MacPorts from source
anyway, please help test this change by installing the current master.


Due to the nature of the check, this will also warn for functions that
legitimately do not exist on macOS. If you encounter such warnings,
there are two methods to silence these false positives:

Add them to
  _resources/port1.0/checks/implicit_function_declaration/macosx${configure.sdk_version}.sdk.list
in the ports tree (create the file if it does not exist). Each line is a
glob expression for a function name that should not be conisdered
problematic.

You can also silence the warning in your Portfile using:

| if {[info exists configure.checks.implicit_function_declaration.whitelist]} {
|     configure.checks.implicit_function_declaration.whitelist-append \
|         functionname1 functionname2 ...
| }

I'm grateful for any feedback on this new check.
-- 
Clemens


More information about the macports-dev mailing list