Consistently define WIN32_LEAN_AND_MEAN/NOSERVICE before include windows.h
authorIvan Maidanski <ivmai@mail.ru>
Wed, 20 Jun 2018 07:10:17 +0000 (10:10 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 20 Jun 2018 07:10:17 +0000 (10:10 +0300)
(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>.

cord/tests/de.c
cord/tests/de_win.c
extra/msvc_dbg.c
tests/initsecondarythread.c
tests/subthread_create.c
tests/test.c
tests/test_cpp.cc
tests/thread_leak_test.c
tools/setjmp_t.c

index c543cce..adfd0e3 100644 (file)
 #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)
index 4a43801..62cff65 100644 (file)
  * 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"
index 8abe247..8a72976 100644 (file)
 #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)
index 96a21e2..788a862 100644 (file)
 #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>
index 7c9a3cc..a40df51 100644 (file)
 #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>
index a3c1b46..cdded72 100644 (file)
 #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
index 989c46d..669bf78 100644 (file)
@@ -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
 
index c4fb74e..e17e81c 100644 (file)
 #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>
 
index bef71f2..302135c 100644 (file)
@@ -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;