summaryrefslogtreecommitdiff
path: root/lib/win32/emu.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-29 09:56:48 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-29 09:56:48 +0000
commita4e5032888fb2f5eb264c8ca0492174586d524a9 (patch)
treec1034e21c14fd0a5df6b2871dd84b912d2613e4e /lib/win32/emu.h
parent3c4e88671d641bb32d95ef33baa3f70fa1815289 (diff)
Fix warnings when compiling with MinGW64 headers.
These headers define things that aren't defined by MinGW32 or MSVC, so make the definitions in emu.h conditional (feature detection).
Diffstat (limited to 'lib/win32/emu.h')
-rw-r--r--lib/win32/emu.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/win32/emu.h b/lib/win32/emu.h
index 05f2f561..5669c411 100644
--- a/lib/win32/emu.h
+++ b/lib/win32/emu.h
@@ -115,21 +115,29 @@ inline struct passwd * getpwnam(const char * name)
return &gTempPasswd;
}
-#define S_IRWXG 1
-#define S_IRWXO 2
-#define S_ISUID 4
-#define S_ISGID 8
-#define S_ISVTX 16
-
-#ifndef __MINGW32__
+#ifndef S_IRGRP
+ // these constants are only defined in MinGW64, not the original MinGW headers,
+ // nor MSVC, so use poor man's feature detection to define them only if needed.
//not sure if these are correct
//S_IWRITE - writing permitted
//_S_IREAD - reading permitted
//_S_IREAD | _S_IWRITE -
- #define S_IRUSR S_IWRITE
- #define S_IWUSR S_IREAD
- #define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC)
+# define S_IRUSR S_IWRITE
+# define S_IWUSR S_IREAD
+# define S_IRGRP S_IWRITE
+# define S_IWGRP S_IREAD
+# define S_IROTH S_IWRITE | S_IREAD
+# define S_IWOTH S_IREAD | S_IREAD
+# define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC)
+# define S_IRWXG 1
+# define S_IRWXO 2
+#endif
+#define S_ISUID 4
+#define S_ISGID 8
+#define S_ISVTX 16
+
+#ifndef __MINGW32__
#define S_ISREG(x) (S_IFREG & x)
#define S_ISDIR(x) (S_IFDIR & x)
#endif
@@ -200,11 +208,6 @@ inline int geteuid(void)
typedef int socklen_t;
#endif
-#define S_IRGRP S_IWRITE
-#define S_IWGRP S_IREAD
-#define S_IROTH S_IWRITE | S_IREAD
-#define S_IWOTH S_IREAD | S_IREAD
-
//again need to verify these
#define S_IFLNK 1
#define S_IFSOCK 0