218 | | In cases where you have confirmed that a function name is not declared by the include file which should declare it, for a certain macOS SDK, then add that name to whitelists in the MacPorts codebase. This means that, when the compiler generates a `-Wimplicit-function-declaration` warning for that name, MacPorts will not elevate that warning to the `main.log`. Thus it will not cause concern to MacPorts users who use ports which test for that fucntion name. |
219 | | |
220 | | The whitelists are in the MacPorts codebase at `[https://github.com/macports/macports-ports/tree/master/_resources/port1.0/checks/implicit_function_declaration _resources/port1.0/checks/implicit_function_declaration]`. There is a separate whitelist for each version of the macOS SDK: macOS 10.5, macOS 10.14, macOS 11.0 (stored as macOS 11), etc. Each whitelist is a text file containing a list of C language function names, one per line, in lexical order. |
221 | | |
222 | | To add a name to the whitelist, first convince yourself that the name is in fact no declared by the include file which should declare it, by creating a brief test program which uses that function. Compile that file with a compiler invocation similar to what MacPorts uses, including `-Werror`. The compiler will implicitly add `-Wimplicit-function-declaration` if it is recent enough to be able to compile ARM code. The compilation should fail with an error message like, |
223 | | |
224 | | {{{ |
225 | | warning: implicitly declaring library function '…' with type '…' |
226 | | [-Wimplicit-function-declaration] |
| 218 | In cases where you have confirmed that a function name is not declared by the include file which should declare it, for a certain macOS SDK, then add that name to whitelists in the MacPorts ports tree. This means that, when the compiler generates a `-Wimplicit-function-declaration` warning for that name, MacPorts will not display that warning in the terminal output. Thus it will not cause concern to MacPorts users who use ports which test for that fucntion name. |
| 219 | |
| 220 | The whitelists are [browser:macports-ports/_resources/port1.0/checks/implicit_function_declaration in the ports tree]. There is a separate whitelist for each version of the macOS SDK: Mac OS X 10.5, macOS 10.14, macOS 11, etc. Each whitelist is a text file containing a list of C language function names, one per line, in lexical order. |
| 221 | |
| 222 | To add a name to the whitelist, first convince yourself that the name is in fact not declared by the include file which should declare it, by creating and compiling a brief test program which uses that function. Observe if you get a warning or error message like: |
| 223 | |
| 224 | {{{ |
| 225 | error: implicitly declaring library function '…' with type '…' [-Werror,-Wimplicit-function-declaration] |
| 226 | }}} |
| 227 | |
| 228 | or: |
| 229 | |
| 230 | {{{ |
| 231 | error: implicit declaration of function '…' is invalid in C99 [-Werror,-Wimplicit-function-declaration] |