summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordevzero2000 <devzero2000>2011-09-05 11:20:27 +0000
committerdevzero2000 <devzero2000>2011-09-05 11:20:27 +0000
commitd9e5032cdf8374f78d832c4127f49c2d728afbee (patch)
treef259edd611dadebb8ddf11eca06088fd8b699eaa
parent67ac101a4004cf3a52106b648f201af79c7c81e1 (diff)
downloadlibpopt-d9e5032cdf8374f78d832c4127f49c2d728afbee.tar.gz
merge commit ea2978d from git pull request
https://github.com/devzero2000/POPT/pull/2 "Fix build with MinGW 32/64 + MSVC" by arsenm (Matt Arsenault)
-rw-r--r--CHANGES4
-rw-r--r--system.h20
-rw-r--r--test1.c4
3 files changed, 18 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index d423486..7fe958e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,8 @@
1.17 -> 2.0:
+ - devzero2000: merge commit ea2978d from git pull request
+ https://github.com/devzero2000/POPT/pull/2
+ "Fix build with MinGW 32/64 + MSVC" by arsenm
+ (Matt Arsenault)
- devzero2000: fix compiler warning -Wunused-but-set-variable (GCC 4.6)
- devzero2000: redo the autofu vendor-script linker script check for openindiana native
ld, using modern and not deprecated autoconf construct. Even if the check is not perfect
diff --git a/system.h b/system.h
index 8e64d89..e44e18f 100644
--- a/system.h
+++ b/system.h
@@ -56,6 +56,9 @@ char *alloca ();
#ifdef _MSC_VER
# define inline __inline
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
#define _CRT_SECURE_NO_WARNINGS 1
#include <io.h>
#include <malloc.h>
@@ -109,18 +112,19 @@ typedef int ssize_t;
#define lseek _lseek
/* Pretend to be root to replace these */
-inline int setuid(int x) { return 1; }
-inline int getuid(void) { return 0; }
+static inline int setuid(int x) { return 1; }
+
+static inline int getuid(void) { return 0; }
-inline int seteuid(int x) { return 1; }
-inline int geteuid(void) { return 0; }
+static inline int seteuid(int x) { return 1; }
+static inline int geteuid(void) { return 0; }
-inline int setgid(int x) { return 1; }
-inline int getgid(void) { return 0; }
+static inline int setgid(int x) { return 1; }
+static inline int getgid(void) { return 0; }
-inline int setegid(int x) { return 1; }
+static inline int setegid(int x) { return 1; }
-#endif /* _MSC_VER */
+#endif /* defined(_MSC_VER) || defined(__MINGW32__) */
#ifdef __NeXT
/* access macros are not declared in non posix mode in unistd.h -
diff --git a/test1.c b/test1.c
index e1710dc..1f49c3f 100644
--- a/test1.c
+++ b/test1.c
@@ -256,6 +256,7 @@ int main(int argc, const char ** argv)
const char ** rest;
int help = 0;
int usage = 0;
+ char * testpoptrc;
#if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
/*@-moduncon -noeffectuncon@*/
@@ -269,9 +270,8 @@ int main(int argc, const char ** argv)
/*@-temptrans@*/
optCon = poptGetContext("test1", argc, argv, options, 0);
#ifdef HAVE_STDLIB_H
- char * testpoptrc;
testpoptrc = getenv ("testpoptrc");
- if (testpoptrc != NULL )
+ if (testpoptrc != NULL )
(void) poptReadConfigFile(optCon, testpoptrc);
else {
(void) poptReadConfigFile(optCon, "./test-poptrc");