From 25ac8f97f6c3fd8eafa53bc4f96197e774798c12 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 28 Jan 2017 01:22:06 +0000 Subject: Fix popen pclose warnings compiling under wine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix i686-w64-mingw32-g++ compiler on linux warning: In file included from Swig/swig.h:21:0, from Swig/misc.c:14: Swig/misc.c:1125:14: warning: ‘_popen’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] extern FILE *popen(const char *command, const char *type); ^ Swig/misc.c:1126:12: warning: ‘_pclose’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] extern int pclose(FILE *stream); --- Source/Swig/misc.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 91f05c0a2..fe7119734 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -1117,19 +1117,17 @@ int Swig_scopename_check(const String *s) { * * Printf(stderr,"%(command:sed 's/[a-z]/\U\\1/' <<<)s","hello") -> Hello * ----------------------------------------------------------------------------- */ -#if defined(HAVE_POPEN) -# if defined(_MSC_VER) -# define popen _popen -# define pclose _pclose -# else -extern FILE *popen(const char *command, const char *type); -extern int pclose(FILE *stream); +#if defined(_MSC_VER) +# define popen _popen +# define pclose _pclose +# if !defined(HAVE_POPEN) +# define HAVE_POPEN 1 # endif #else -# if defined(_MSC_VER) -# define HAVE_POPEN 1 -# define popen _popen -# define pclose _pclose +# if !defined(_WIN32) +/* These Posix functions are not ISO C and so are not always defined in stdio.h */ +extern FILE *popen(const char *command, const char *type); +extern int pclose(FILE *stream); # endif #endif -- cgit v1.2.1