summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2017-01-28 01:22:06 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2017-02-04 19:18:54 +0000
commit25ac8f97f6c3fd8eafa53bc4f96197e774798c12 (patch)
tree21df581e7e89e428dab9585f24e8f7f3ff940ad2
parent77a9907dd99785d8bfd7da3b8fe0911fcc8f5be2 (diff)
downloadswig-25ac8f97f6c3fd8eafa53bc4f96197e774798c12.tar.gz
Fix popen pclose warnings compiling under wine
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);
-rw-r--r--Source/Swig/misc.c20
1 files 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