SWI-Prolog / packages-xpce

The graphics toolkit for SWI-Prolog
16 stars 14 forks source link

Warnings for implicit declarations in XPCE #7

Closed wouterbeek closed 7 years ago

wouterbeek commented 7 years ago

Compiling from sources on Ubuntu 16.10 I get the following warnings that I haven't seen before:

QA Notice: Package triggers severe warnings which indicate that it
           may exhibit random runtime failures.
unx/process.c:586:7: warning: implicit declaration of function ‘grantpt’ [-Wimplicit-function-declaration]
unx/process.c:587:7: warning: implicit declaration of function ‘unlockpt’ [-Wimplicit-function-declaration]
unx/process.c:588:15: warning: implicit declaration of function ‘ptsname’ [-Wimplicit-function-declaration]

QA Notice: Package triggers severe warnings which indicate that it
           may exhibit random runtime failures.
unx/process.c:588:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
unx/process.c:637:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

There is indeed a few lines in packages/xpce/src/unx/process.c that mention the absence of these declarations:

#if HAVE_STROPTS_H && HAVE_GRANTPT  /* Solaris */
#define USE_GRANTPT 1
#include <stropts.h>
#ifdef __mips__             /* These prototypes are nowhere!? */
extern int   grantpt(int filedes);
extern char *ptsname(int fildes);
extern int   unlockpt(int fildes);
#endif
#endif
JanWielemaker commented 7 years ago

The relevant lines for Linux are at the top:

#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
#define _XOPEN_SOURCE           /* GNU glibc grantpt() prototypes */
#endif

man grantpt says _XOPEN_SOURCE must be defined to get the prototypes from the headers. Possibly something has changed there. You could have a look at man grantpt on your version to check requirements. Its not very urgent though. On most platforms it will work anyway and the functionality isn't used much.

wouterbeek commented 7 years ago

Thanks, the commit by @susnux indeed fixes this issue on my machine.