[MacPorts] #64550: freeciv @2.6.6: at_quick_exit gives -Wimplicit-function-declaration warning, false positive

MacPorts noreply at macports.org
Fri Jan 28 05:53:35 UTC 2022


#64550: freeciv @2.6.6: at_quick_exit gives -Wimplicit-function-declaration
warning, false positive
---------------------+----------------------
  Reporter:  JDLH    |      Owner:  JDLH
      Type:  defect  |     Status:  assigned
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:  2.7.1
Resolution:          |   Keywords:
      Port:          |
---------------------+----------------------

Comment (by JDLH):

 More diagnosis on this warning.

 In the `config.log`, the relevant configuration output is (with line
 breaks added for legibility):

 {{{
 configure:25690: checking for C11 at_quick_exit()
 configure:25713: /usr/bin/clang -o conftest -pipe -Os
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch
 x86_64
 -I/opt/local/include
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Werror
 -Wall -Wpointer-arith -Wcast-align
 -Wno-tautological-compare -L/opt/local/lib
 -Wl,-headerpad_max_install_names
 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
 -arch x86_64 conftest.c  -liconv >&5
 conftest.c:99:2: error: implicit declaration of function 'at_quick_exit'
 is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  at_quick_exit(func);
  ^
 1 error generated.
 configure:25713: $? = 1
 configure: failed program was:
 | /* confdefs.h */
 | …[lines omitted for brevity]…
 | /* end confdefs.h.  */
 | #include <stdlib.h>
 | static void func(void)
 | {}
 |
 | int
 | main (void)
 | {
 |  at_quick_exit(func);
 |   ;
 |   return 0;
 | }
 configure:25723: result: no
 }}}

 Note that this code does contain `#include <stdlib.h>`. Thus the function
 definition would not be implicit if the stdlib supported the
 `at_quick_exit` C11 language feature.

 See email thread ''[https://lists.macports.org/pipermail/macports-
 dev/2022-January/044094.html How to suppress -Wimplicit-function-
 declaration warning, if <stdlib.h> really does not have the
 declaration?]'', started Wed Jan 26 07:43:23 UTC 2022. Joshua Root
 replied,

     we maintain lists of functions that are known not to exist on each
 macOS version, so the warning can be suppressed. They are in the ports
 tree here:
     <https://github.com/macports/macports-
 ports/tree/master/_resources/port1.0/checks/implicit_function_declaration>

 So, I think the immediate workaround for this problem is to add
 `at_quick_exit` to the list at <https://github.com/macports/macports-
 ports/blob/master/_resources/port1.0/checks/implicit_function_declaration/macosx10.14.sdk.list>.
 I do not know how many other macOS versions are affected.

 I also plan to file a bug upstream with FreeCiv developers, to see if they
 have a way to rewrite this configuration test so that it does not trigger
 a `-Wimplicit-function-declaration` warning from the compiler.

-- 
Ticket URL: <https://trac.macports.org/ticket/64550#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list