[Freeciv-tickets] [freeciv] #43737: Configure scripts give needless -Wimplicit-function-declaration errors on macOS

アーカイブの一覧に戻る
OSDN Ticket System norep****@osdn*****
Sun Jan 30 06:01:31 JST 2022


#43737: Configure scripts give needless -Wimplicit-function-declaration errors on macOS

  Open Date: 2022-01-29 01:15
Last Update: 2022-01-29 13:01

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/43737
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43737

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-01-29 13:01 Updated by: jdlh

Comment:

Does the '-Werror' here mean that the issue is an hard error…?
Yes. The compilation of the configure check fails with an error. The compiler issues a -Wimplicit-function-declaration warning, then escalates it to an error.
…completely preventing freeciv compilation on MaxPorts?
No. The errors occur in small test programs generated by the configuration script. So, configuration checks fail when maybe the correct outcome is that they succeed. I don't know whether the resulting configuration is correct anyway, or is wrong. Freeciv itself still compiles and runs on macOS (on my compiler and SDK version at least). It might have the wrong configuration, but Freeciv (2.6.6 at least) still compiles and runs.
Does this mean that fixing this ticket alone would not make freeciv compilable on MacPorts, but also that future(?) ticket needs to be fixed to actually achieve anything making it worth freeze exception?
Neither a fix to this ticket nor to the other ticket is necessary to make Freeciv compilable on MacPorts. I can patch the Freeciv code within MacPorts to fix this ticket. The other ticket is about a configure check which fails correctly, and MacPorts will suppress the error message. 
So neither ticket justifies a freeze exception to 3.0.0 in my humble opinion.
In a little while, I hope to check all the other branches (master, S3_1, S3_0) for this ticket, and to file the other ticket. That will make the situation a little clearer.
Thank you for your prompt attention, caszfi!

---------------------------------------------------------------------
Ticket Status:

      Reporter: jdlh
         Owner: (None)
          Type: Bugs
        Status: Open
      Priority: 5 - Medium
     MileStone: 3.0.1
     Component: Bootstrap
      Severity: 4
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Three configuration macros create simple C programs which, when compiled on macOS, needlessly cause -Wimplicit-function-declaration errors. Adding #include <stdlib.h> and  #include <stdlib.h> to those macros prevents those warnings, without changing what the configuration macros are trying to check for. 
macOS's Xcode compilers (based on clang) have applied -Werror and -Wimplicit-function-declaration options since about 2019. They do this as part of support for the Apple ARM architecture CPUs. On those CPUs, the calling sequence for varargs functions differ from the calling sequence for functions with a fixed number of parameters. If a function prototype is not declared, the compiler is unable to guess which kind of args the function uses. This means that the programs generated by the configuration macros may, on macOS, fail to compile, instead of compiling and running. This means in turn that the macros may get the wrong result about the system's capabilities, and so they may configure Freeciv incorrectly. Also, defining functions without explicitly declaring them has been illegal C language since about the late 1980s, but many compilers have tolerated it. Thus, compiler errors have not been a reason to clean up these macros — until now.  For more on the Xcode compiler issue, see the writeup in the MacPorts wiki at https://trac.macports.org/wiki/WimplicitFunctionDeclaration . 
Since 2021, the MacPorts distribution software has specifically elevated  -Wimplicit-function-declaration errors to the user's attention. As an interim measure, the MacPorts distribution can patch Freeciv to prevent these errors. See MacPorts ticket #64551 freec****@2*****: X11 config tests gives -Wimplicit-function-declaration warning on exit, strcmp. In the long term, it helps MacPorts to distribute Freeciv if Freeciv can prevent these warnings upstream from MacPorts.
The fix for all but one of these errors is simple: patch m4/x.m4 to add one line in each of two places, and patch m4/vsnprintf.m4 to add two lines in one place. I will attach patches to this ticket, which I have tested on the S2_6 branch, version 2.6.6 code. I will also test against the other branches, and produce different patches for those branches if necessary. 
Another occurrence of a -Wimplicit-function-declaration, generated by Freeciv's configuration scripts, comes from a check on c11 functionality. It is not a matter of a missing #include. This will be the subject of a separate ticket.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/43737
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43737



More information about the Freeciv-tickets mailing list
アーカイブの一覧に戻る