summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-06-20 10:10:17 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-06-20 10:10:17 +0300
commit0d41e2f1e09014b9c0bb3f4cf68732e09558f0eb (patch)
treecfea60f47fa76c14b0f218a190b6278544a2b98b
parentab8086362d46b86987b65a59583e8ab37c7f4a30 (diff)
downloadbdwgc-0d41e2f1e09014b9c0bb3f4cf68732e09558f0eb.tar.gz
Consistently define WIN32_LEAN_AND_MEAN/NOSERVICE before include windows.h
(code refactoring) Note: these macros are not (and should not be) defined in the public headers (gc.h). * cord/tests/de.c [WIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Define macro before include windows.h. * cord/tests/de_win.c (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * extra/msvc_dbg.c (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/initsecondarythread.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/subthread_create.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/test.c [MSWIN32 || MSWINCE] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/test_cpp.cc [MSWIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/thread_leak_test.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tools/setjmp_t.c [MSWIN32 || MSWINCE || CYGWIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * cord/tests/de_win.c: Replace include "windows.h" to include <windows.h>.
-rw-r--r--cord/tests/de.c4
-rw-r--r--cord/tests/de_win.c7
-rw-r--r--extra/msvc_dbg.c5
-rw-r--r--tests/initsecondarythread.c6
-rw-r--r--tests/subthread_create.c6
-rw-r--r--tests/test.c8
-rw-r--r--tests/test_cpp.cc4
-rw-r--r--tests/thread_leak_test.c6
-rw-r--r--tools/setjmp_t.c5
9 files changed, 44 insertions, 7 deletions
diff --git a/cord/tests/de.c b/cord/tests/de.c
index c543cce4..adfd0e38 100644
--- a/cord/tests/de.c
+++ b/cord/tests/de.c
@@ -44,6 +44,10 @@
#endif
#if defined(WIN32)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
# include "de_win.h"
#elif defined(MACINTOSH)
diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c
index 4a43801d..62cff652 100644
--- a/cord/tests/de_win.c
+++ b/cord/tests/de_win.c
@@ -19,7 +19,12 @@
* This was written by a nonexpert windows programmer.
*/
-#include "windows.h"
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+#endif
+#define NOSERVICE
+#include <windows.h>
+
#include "gc.h"
#include "cord.h"
#include "de_cmds.h"
diff --git a/extra/msvc_dbg.c b/extra/msvc_dbg.c
index 8abe2473..8a72976b 100644
--- a/extra/msvc_dbg.c
+++ b/extra/msvc_dbg.c
@@ -28,7 +28,10 @@
#include "private/msvc_dbg.h"
#include "gc.h"
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+#endif
+#define NOSERVICE
#include <windows.h>
#pragma pack(push, 8)
diff --git a/tests/initsecondarythread.c b/tests/initsecondarythread.c
index 96a21e2e..788a8625 100644
--- a/tests/initsecondarythread.c
+++ b/tests/initsecondarythread.c
@@ -31,8 +31,12 @@
#ifdef GC_PTHREADS
# include <pthread.h>
#else
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
-#endif
+#endif /* !GC_PTHREADS */
#include <stdlib.h>
#include <stdio.h>
diff --git a/tests/subthread_create.c b/tests/subthread_create.c
index 7c9a3cce..a40df51c 100644
--- a/tests/subthread_create.c
+++ b/tests/subthread_create.c
@@ -20,8 +20,12 @@
#ifdef GC_PTHREADS
# include <pthread.h>
#else
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
-#endif
+#endif /* !GC_PTHREADS */
#if defined(__HAIKU__)
# include <errno.h>
diff --git a/tests/test.c b/tests/test.c
index a3c1b467..cdded722 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -64,9 +64,13 @@
#include "private/gc_priv.h" /* For output, locking, MIN_WORDS, */
/* some statistics and gcconfig.h. */
-# if defined(MSWIN32) || defined(MSWINCE)
-# include <windows.h>
+#if defined(MSWIN32) || defined(MSWINCE)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
# endif
+# define NOSERVICE
+# include <windows.h>
+#endif /* MSWIN32 || MSWINCE */
#ifdef GC_PRINT_VERBOSE_STATS
# define print_stats VERBOSE
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index 989c46d7..669bf782 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -54,6 +54,10 @@ extern "C" {
}
#ifdef MSWIN32
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
#endif
diff --git a/tests/thread_leak_test.c b/tests/thread_leak_test.c
index c4fb74e9..e17e81c6 100644
--- a/tests/thread_leak_test.c
+++ b/tests/thread_leak_test.c
@@ -13,8 +13,12 @@
#ifdef GC_PTHREADS
# include <pthread.h>
#else
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
-#endif
+#endif /* !GC_PTHREADS */
#include <stdio.h>
diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c
index bef71f21..302135c6 100644
--- a/tools/setjmp_t.c
+++ b/tools/setjmp_t.c
@@ -46,7 +46,12 @@ int getpagesize(void)
return((int)(result[0]));
}
#elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
# include <windows.h>
+
int getpagesize(void)
{
SYSTEM_INFO sysinfo;