[MacPorts] #72452: base: Detect safe pattern for implicit declarations

MacPorts noreply at macports.org
Thu May 8 05:28:27 UTC 2025


#72452: base: Detect safe pattern for implicit declarations
--------------------------+--------------------
 Reporter:  Dave-Allured  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  Normal        |  Milestone:
Component:  base          |    Version:
 Keywords:                |       Port:
--------------------------+--------------------
 The documentation for
 [https://trac.macports.org/wiki/WimplicitFunctionDeclaration#AddnamestowhitelistviaPortfile
 Implicit Function Declaration:Add names to whitelist via Portfile]
 describes a case where the implicit declaration is a deliberate compiler
 test.  Warnings for these known cases should be suppressed.

 The current ignore method is to whitelist all occurrences of specified
 functions, during port configuration.  Here is a finer grained approach.
 These known cases follow a pattern which can be detected and automatically
 ignored.  I suggest this is safer than ignoring all occurrences.

 The basic idea is to pattern-recognize the known special test for "detect
 undeclared functions".  Based on my current debug problem, the pattern in
 `config.log` looks like this.  This would be an enhancement to the
 existing checks in `portconfigure::check_implicit_function_declarations`.
 Match exactly **three consecutive lines** with regex:
 {{{
 configure:.* checking for .* needed to detect all undeclared functions
 configure:.* conftest.c >
 conftest\.c:.* call to undeclared library function (NAME)
 }}}
 When this three-line pattern is detected, the implicit warning is then
 automatically IGNORED and not output as a warning to the user.  (NAME)
 might start out as simply `strchr`, maybe expanded later to a special
 short list of known test names.

 Benefits:
 * Reduced interactions for port maintainers.
 * Allow removal of port-specific whitelisted function names in many
 portfiles.
 * Increased safety, as I said above.

-- 
Ticket URL: <https://trac.macports.org/ticket/72452>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list