Opened 3 years ago
Last modified 3 years ago
#64551 assigned defect
freeciv @2.6.6: X11 config tests gives -Wimplicit-function-declaration warning on exit, strcmp
Reported by: | JDLH (Jim DeLaHunt) | Owned by: | JDLH (Jim DeLaHunt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | Cc: | ||
Port: | freeciv |
Description
When building freeciv @2.6.6 (work in progress, a major rewrite, see #62984), MacPorts prints a warning, "indications of -Wimplicit-function-declaration", regarding functions named strcmp
and exit
. These appear to be true positives. The configuration code which the port uses fails to include <string.h>
and <stdlib.h>
.
This is the initial warning from MacPorts:
% sudo port build freeciv-common ---> Computing dependencies for freeciv-common ---> Fetching distfiles for freeciv-common ---> Verifying checksums for freeciv-common ---> Extracting freeciv-common ---> Configuring freeciv-common Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled: strcmp: found in freeciv-2.6.6/config.log exit: found in freeciv-2.6.6/config.log at_quick_exit: found in freeciv-2.6.6/config.log ---> Building freeciv-common %
I plan to make patches to the config code to include those headers, as part of the #62984 rewrite. I also plan to submit those patches to the upstream code base.
Change History (3)
comment:1 Changed 3 years ago by JDLH (Jim DeLaHunt)
comment:2 Changed 3 years ago by JDLH (Jim DeLaHunt)
Filed Freeciv ticket #43737 Configure scripts give needless -Wimplicit-function-declaration errors on macOS to track this issue with the upstream project.
comment:3 Changed 3 years ago by JDLH (Jim DeLaHunt)
The Freeciv project fixed this bug upstream in their S2_6, S3_0, S3_1, and master branches. We will see the fix in the 2.6.7 and 3.0 releases. However, for 2.6.6, I will patch m4/x.m4 and m4/vsnprint.m4 .
The
config.log
entries related toexit
andstrcmp
are:Searching for the telltale strings "compilable FUNCPROTO definition" and "workable NARROWPROTO definition" takes us to
m4/x.m4
:251,266.Reading the macros in
m4/x.m4
, it appears that both these configuration steps get skipped if we either a) supply an argument--with-x-funcproto=DEFS
(e.g.:--with-x-funcproto='FUNCPROTO=15 NARROWPROTO'
), or b) define a variablePROTO_DEFINES
and have thexmkmf
utility which creates a Makefile . a) is feasible for us to do in a Portfile. b) appears to be an ancient 1998-vintage Solaris thing.When these configuration steps get run, they run macro
FC_CHECK_X_PROTO_FUNCPROTO_COMPILE
in lines 296:334, and then macroFC_CHECK_X_PROTO_NARROWPROTO_WORKS
in lines 336:431. Each macros contains the line,#include <X11/Xfuncproto.h>
. Inserting#include <stdlib.h>
before this line will stop the-Wimplicit-function-declaration
warning.Searching for the telltale string "working vsnprintf" takes us to
m4/vsnprintf.m4
:13 . This macro,FC_FUNC_VSNPRINTF
in lines 2:69, has a single C program which generates two-Wimplicit-function-declaration
warnings. Inserting, after the existing#include <stdarg.h>
line, the new lines:eliminates these two warnings.