Implicit function _IceTransNoListen in fsm.c
Closed this issue · 4 comments
With libICE installed, autoconf successfully detects _IceTransNoListen, but fsm.c doesn't correctly declare this function (nor does its included header files). This causes the build to fail due to the implicit declaration of function _IceTransNoListen; this is located in fsm.c:
Line 1048 in f036638
Since _IceTransNoListen is neither defined nor declared in libICE headers (it is in fact declared in Xtrans.h, not packaged with libICE), it would be appropriate to use an extern declaration for the function:
#ifdef HAVE__ICETRANSNOLISTEN
extern void _IceTransNoListen(char *protocol);
#endif
Maybe. I'd rather fix the headers though so we're including the correct things, rather than chucking extern at it, as you're suggesting.
Can you open a PR when you've done that, please?
Not a problem, I'll use the header and make sure that's set up correctly. If that's somehow not possible, I'll make a note of it here. Should have a PR up sometime soon.
On my system, and perhaps other systems, xtrans.h is in a separate package (ie xtrans
) from libICE (ie libice
), and is not one of it's dependencies.
In the case that libice
is installed and xtrans
isn't (or perhaps it may be useful to consider the case in which xtrans.h isn't packaged at all), I could either switch how the function is declared:
/* example 1 */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
#include <X11/Xtrans/Xtrans.h>
#elif defined(HAVE__ICETRANSNOLISTEN)
#warn "Maybe warn something? Probably don't need to."
extern void _IceTransNoListen(char *protocol);
#endif
or whether the function is used:
/* example 2 */
/* up top */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
#include <X11/Xtrans/Xtrans.h>
#endif
/* ... */
/* in fsm_init() */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
_IceTransNoListen("tcp");
#endif
If you prefer one way or another, let me know. For now, I'll use the first example since that appears to me to be the traditional approach.