aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-07-12 11:27:28 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-07-12 11:27:28 +0000
commit6902b88b0b628d76fd5997ff138247c23a903064 (patch)
tree0242d3d1eddb576af51bad51b51e3b1ecc82e89f
parent568e72f5615151ca372f469780b09006023f13af (diff)
downloadnewlib-6902b88b0b628d76fd5997ff138247c23a903064.zip
newlib-6902b88b0b628d76fd5997ff138247c23a903064.tar.gz
newlib-6902b88b0b628d76fd5997ff138247c23a903064.tar.bz2
* winlean.h: Make sure certain Windows macros are undefined again.
Add comment to explain why. * winsup.h: Include winlean.h from C sources as well. * libc/minires-os-if.c: Drop including ntdef.h. Fix previous ChangeLog entry.
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/libc/minires-os-if.c1
-rw-r--r--winsup/cygwin/winlean.h37
-rw-r--r--winsup/cygwin/winsup.h7
4 files changed, 49 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 32af7b8..cca6875 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,6 +1,13 @@
2012-07-12 Corinna Vinschen <corinna@vinschen.de>
- * pseudo-reloc.cc: Drop including wchar.h.
+ * winlean.h: Make sure certain Windows macros are undefined again.
+ Add comment to explain why.
+ * winsup.h: Include winlean.h from C sources as well.
+ * libc/minires-os-if.c: Drop including ntdef.h.
+
+2012-07-12 Corinna Vinschen <corinna@vinschen.de>
+
+ * pseudo-reloc.cc: Drop including wchar.h and ntdef.h.
(__report_error): Define module as WCHAR.
* advapi.cc: Drop including wchar.h.
* kernel32.cc: Ditto.
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index d4cb4ef..46e8297 100644
--- a/winsup/cygwin/libc/minires-os-if.c
+++ b/winsup/cygwin/libc/minires-os-if.c
@@ -16,7 +16,6 @@ details. */
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <windns.h>
-#include <ntdef.h>
#include "ntdll.h"
#undef h_errno
#include "minires.h"
diff --git a/winsup/cygwin/winlean.h b/winsup/cygwin/winlean.h
index c65132a..950bd1d 100644
--- a/winsup/cygwin/winlean.h
+++ b/winsup/cygwin/winlean.h
@@ -35,11 +35,48 @@ details. */
#define WINIMPM
#define WINSOCK_API_LINKAGE
+/* Windows headers define a couple of annoyingly intrusive macros for the
+ sole purpose of inline documentation. Since they are defined without
+ respect for the namespace and not undef'ed anymore, they tend to collide
+ with otherwise innocent definitions in the application. We check if they
+ exist and if not, we undef them again after including the Windows headers. */
+#ifndef IN
+#define __undef_IN
+#endif
+#ifndef OUT
+#define __undef_OUT
+#endif
+#ifndef OPTIONAL
+#define __undef_OPTIONAL
+#endif
+#ifndef NOTHING
+#define __undef_NOTHING
+#endif
+#ifndef CRITICAL
+#define __undef_CRITICAL
+#endif
+
#include <windows.h>
#include <wincrypt.h>
#include <lmcons.h>
#include <ntdef.h>
+#ifdef __undef_IN
+#undef IN
+#endif
+#ifdef __undef_OUT
+#undef OUT
+#endif
+#ifdef __undef_OPTIONAL
+#undef OPTIONAL
+#endif
+#ifdef __undef_NOTHING
+#undef NOTHING
+#endif
+#ifdef __undef_CRITICAL
+#undef CRITICAL
+#endif
+
#undef _WINGDI_H
#undef _WINUSER_H
#undef _WINNLS_H
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 0c96113..63495b8 100644
--- a/winsup/cygwin/winsup.h
+++ b/winsup/cygwin/winsup.h
@@ -81,8 +81,12 @@ int fcntl64 (int fd, int cmd, ...);
#define __WIDE(a) L ## a
#define _WIDE(a) __WIDE(a)
+#include "winlean.h"
+
#ifdef __cplusplus
+#include "wincap.h"
+
extern const char case_folded_lower[];
#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
extern const char case_folded_upper[];
@@ -92,9 +96,6 @@ extern const char case_folded_upper[];
#define cfree newlib_cfree_dont_use
#endif
-#include "winlean.h"
-#include "wincap.h"
-
/* Used as type by sys_wcstombs_alloc and sys_mbstowcs_alloc. For a
description see there. */
#define HEAP_NOTHEAP -1