From: Ivan Maidanski Date: Wed, 20 Jun 2018 07:10:17 +0000 (+0300) Subject: Consistently define WIN32_LEAN_AND_MEAN/NOSERVICE before include windows.h X-Git-Tag: v8.0.0~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d41e2f1e09014b9c0bb3f4cf68732e09558f0eb;p=gc 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 . --- 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 # 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 + #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 #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 #else +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# define NOSERVICE # include -#endif +#endif /* !GC_PTHREADS */ #include #include 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 #else +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# define NOSERVICE # include -#endif +#endif /* !GC_PTHREADS */ #if defined(__HAIKU__) # include 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 +#if defined(MSWIN32) || defined(MSWINCE) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 # endif +# define NOSERVICE +# include +#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 #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 #else +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# define NOSERVICE # include -#endif +#endif /* !GC_PTHREADS */ #include 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 + int getpagesize(void) { SYSTEM_INFO sysinfo;