[MacPorts] #64551: freeciv @2.6.6: X11 config tests gives -Wimplicit-function-declaration warning on exit, strcmp
MacPorts
noreply at macports.org
Sat Jan 29 08:27:04 UTC 2022
#64551: freeciv @2.6.6: X11 config tests gives -Wimplicit-function-declaration
warning on exit, strcmp
----------------------+----------------------
Reporter: JDLH | Owner: JDLH
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.7.1
Resolution: | Keywords:
Port: freeciv |
----------------------+----------------------
Comment (by JDLH):
The `config.log` entries related to `exit` and `strcmp` are:
{{{
… [snip] …
configure:31317: checking whether Xfuncproto was supplied
configure:31345: result: no
configure:31349: checking for compilable FUNCPROTO definition
configure:31382: /usr/bin/clang -c -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
-DLOCALEDIR="\"${datarootdir}/locale\"" -DBINDIR="\"${exec_prefix}/bin\""
conftest.c >&5
conftest.c:111:1: warning: implicitly declaring library function 'exit'
with type 'void (int) __attribute__((noreturn))' [-Wimplicit-function-
declaration]
exit (0)
^
conftest.c:111:1: note: include the header <stdlib.h> or explicitly
provide a declaration for 'exit'
1 warning generated.
configure:31382: $? = 0
configure:31401: result: yes, determined: 15
configure:31407: checking for workable NARROWPROTO definition
configure:31491: /usr/bin/clang -o conftest -pipe -Os
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch
x86_64 -lSM -lICE -lXaw -lXt -lX11 -I/opt/local/include
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
-DLOCALEDIR="\"${datarootdir}/locale\"" -DBINDIR="\"${exec_prefix}/bin\""
-L/opt/local/lib -Wl,-headerpad_max_install_names
-Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
-arch x86_64 conftest.c -liconv -pthread >&5
conftest.c:149:7: warning: implicitly declaring library function 'exit'
with type 'void (int) __attribute__((noreturn))' [-Wimplicit-function-
declaration]
exit (0);
^
conftest.c:149:7: note: include the header <stdlib.h> or explicitly
provide a declaration for 'exit'
1 warning generated.
… [snip] …
configure:31491: /usr/bin/clang -o conftest -pipe -Os
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -arch
x86_64 -lSM -lICE -lXaw -lXt -lX11 -I/opt/local/include
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
-DLOCALEDIR="\"${datarootdir}/locale\"" -DBINDIR="\"${exec_prefix}/bin\""
-L/opt/local/lib -Wl,-headerpad_max_install_names
-Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
-arch x86_64 conftest.c -liconv -pthread >&5
conftest.c:149:7: warning: implicitly declaring library function 'exit'
with type 'void (int) __attribute__((noreturn))' [-Wimplicit-function-
declaration]
exit (0);
^
conftest.c:149:7: note: include the header <stdlib.h> or explicitly
provide a declaration for 'exit'
1 warning generated.
… [snip] …
configure:31516: result: no, cannot determine
configure:31519: checking whether Xfuncproto was determined
configure:31522: result: yes: FUNCPROTO=15
… [snip, and the line numbers of configure may change a little] …
configure:36937: checking for working vsnprintf
configure:36993: /usr/bin/clang -o conftest -std=c11 -I/opt/local/include
-DLOCALEDIR="\"${datarootdir}/locale\"" -DBINDIR="\"${exec_prefix}/bin\""
-L/opt/local/libexec/qt5/lib -L/opt/local/lib conftest.c -liconv -pthread
>&5
conftest.c:176:5: warning: implicitly declaring library function 'exit'
with type 'void (int) __attribute__((noreturn))' [-Wimplicit-function-
declaration]
exit(1);
^
conftest.c:176:5: note: include the header <stdlib.h> or explicitly
provide a declaration for 'exit'
conftest.c:185:7: warning: implicitly declaring library function 'strcmp'
with type 'int (const char *, const char *)' [-Wimplicit-function-
declaration]
if (strcmp(buffer, "1234"))
^
conftest.c:185:7: note: include the header <string.h> or explicitly
provide a declaration for 'strcmp'
2 warnings generated.
configure:36993: $? = 0
configure:36993: ./conftest
configure:36993: $? = 0
configure:37004: result: yes
configure:37012: checking for vsnprintf
configure:37012: /usr/bin/clang -o conftest -std=c11 -I/opt/local/include
-DLOCALEDIR="\"${datarootdir}/locale\"" -DBINDIR="\"${exec_prefix}/bin\""
-L/opt/local/libexec/qt5/lib -L/opt/local/lib conftest.c -liconv -pthread
>&5
conftest.c:174:6: warning: incompatible redeclaration of library function
'vsnprintf' [-Wincompatible-library-redeclaration]
char vsnprintf ();
^
conftest.c:174:6: note: 'vsnprintf' is a builtin with type 'int (char *,
unsigned long, const char *, struct __va_list_tag *)'
1 warning generated.
configure:37012: $? = 0
configure:37012: result: yes
}}}
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 variable `PROTO_DEFINES` and have the
`xmkmf` 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 macro
`FC_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:
{{{
#include <stdlib.h>
#include <string.h>
}}}
eliminates these two warnings.
--
Ticket URL: <https://trac.macports.org/ticket/64551#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list