aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-12 16:55:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-12 16:55:50 +0200
commita6a846ad051043cb389b401035f361864a691ec6 (patch)
tree92719ecb63dc2dccee0e0da03c396edbca5a842c
parent55f7c6da84f5368373e46945e4f6bee28f53cb81 (diff)
Factor windows.h inclusion into separate header, disable min/max macros
-rw-r--r--odb/details/win32/condition.cxx7
-rw-r--r--odb/details/win32/condition.hxx8
-rw-r--r--odb/details/win32/dll.cxx7
-rw-r--r--odb/details/win32/exceptions.hxx9
-rw-r--r--odb/details/win32/lock.hxx8
-rw-r--r--odb/details/win32/mutex.hxx9
-rw-r--r--odb/details/win32/once.cxx7
-rw-r--r--odb/details/win32/once.hxx9
-rw-r--r--odb/details/win32/thread.cxx6
-rw-r--r--odb/details/win32/thread.hxx9
-rw-r--r--odb/details/win32/tls.cxx6
-rw-r--r--odb/details/win32/windows.hxx34
12 files changed, 45 insertions, 74 deletions
diff --git a/odb/details/win32/condition.cxx b/odb/details/win32/condition.cxx
index 157c453..58e7a2a 100644
--- a/odb/details/win32/condition.cxx
+++ b/odb/details/win32/condition.cxx
@@ -2,12 +2,7 @@
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/win32/condition.hxx>
#include <odb/details/win32/exceptions.hxx>
diff --git a/odb/details/win32/condition.hxx b/odb/details/win32/condition.hxx
index beb864b..22a1b71 100644
--- a/odb/details/win32/condition.hxx
+++ b/odb/details/win32/condition.hxx
@@ -7,13 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
+#include <odb/details/win32/windows.hxx>
#include <cstddef> // std::size_t
diff --git a/odb/details/win32/dll.cxx b/odb/details/win32/dll.cxx
index 30ceb7a..2dc124f 100644
--- a/odb/details/win32/dll.cxx
+++ b/odb/details/win32/dll.cxx
@@ -9,12 +9,7 @@
#if (defined(_MSC_VER) && defined(LIBODB_DYNAMIC_LIB)) || \
(!defined(_MSC_VER) && defined(DLL_EXPORT))
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/win32/init.hxx>
using namespace odb::details;
diff --git a/odb/details/win32/exceptions.hxx b/odb/details/win32/exceptions.hxx
index e92048e..ecc36b6 100644
--- a/odb/details/win32/exceptions.hxx
+++ b/odb/details/win32/exceptions.hxx
@@ -7,14 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/export.hxx>
#include <odb/details/exception.hxx>
diff --git a/odb/details/win32/lock.hxx b/odb/details/win32/lock.hxx
index d55174a..6aba671 100644
--- a/odb/details/win32/lock.hxx
+++ b/odb/details/win32/lock.hxx
@@ -7,13 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
+#include <odb/details/win32/windows.hxx>
namespace odb
{
diff --git a/odb/details/win32/mutex.hxx b/odb/details/win32/mutex.hxx
index 500b2ae..b15bb4a 100644
--- a/odb/details/win32/mutex.hxx
+++ b/odb/details/win32/mutex.hxx
@@ -7,14 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/export.hxx>
namespace odb
diff --git a/odb/details/win32/once.cxx b/odb/details/win32/once.cxx
index a51c071..e73e64e 100644
--- a/odb/details/win32/once.cxx
+++ b/odb/details/win32/once.cxx
@@ -2,12 +2,7 @@
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/win32/once.hxx>
#include <odb/details/win32/once-init.hxx>
diff --git a/odb/details/win32/once.hxx b/odb/details/win32/once.hxx
index 245fb5a..f584206 100644
--- a/odb/details/win32/once.hxx
+++ b/odb/details/win32/once.hxx
@@ -7,14 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/export.hxx>
namespace odb
diff --git a/odb/details/win32/thread.cxx b/odb/details/win32/thread.cxx
index de3d665..1b57493 100644
--- a/odb/details/win32/thread.cxx
+++ b/odb/details/win32/thread.cxx
@@ -2,11 +2,7 @@
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
+#include <odb/details/win32/windows.hxx>
#include <process.h> // _beginthreadex, _endthreadex
#include <odb/details/unique-ptr.hxx>
diff --git a/odb/details/win32/thread.hxx b/odb/details/win32/thread.hxx
index e6379bc..a0f0996 100644
--- a/odb/details/win32/thread.hxx
+++ b/odb/details/win32/thread.hxx
@@ -7,14 +7,7 @@
#include <odb/pre.hxx>
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-#else
-# include <windows.h>
-#endif
-
+#include <odb/details/win32/windows.hxx>
#include <odb/details/export.hxx>
#include <odb/details/win32/mutex.hxx>
diff --git a/odb/details/win32/tls.cxx b/odb/details/win32/tls.cxx
index 14aaf7b..a496d4f 100644
--- a/odb/details/win32/tls.cxx
+++ b/odb/details/win32/tls.cxx
@@ -2,11 +2,7 @@
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
+#include <odb/details/win32/windows.hxx>
#include <winerror.h> // ERROR_INVALID_INDEX
#include <new>
diff --git a/odb/details/win32/windows.hxx b/odb/details/win32/windows.hxx
new file mode 100644
index 0000000..47e2508
--- /dev/null
+++ b/odb/details/win32/windows.hxx
@@ -0,0 +1,34 @@
+// file : odb/details/win32/windows.hxx
+// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_DETAILS_WIN32_WINDOWS_HXX
+#define ODB_DETAILS_WIN32_WINDOWS_HXX
+
+#include <odb/pre.hxx>
+
+// Try to include <windows.h> so that it doesn't mess other things up.
+//
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# ifndef NOMINMAX // No min and max macros.
+# define NOMINMAX
+# include <windows.h>
+# undef NOMINMAX
+# else
+# include <windows.h>
+# endif
+# undef WIN32_LEAN_AND_MEAN
+#else
+# ifndef NOMINMAX
+# define NOMINMAX
+# include <windows.h>
+# undef NOMINMAX
+# else
+# include <windows.h>
+# endif
+#endif
+
+#include <odb/post.hxx>
+
+#endif // ODB_DETAILS_WIN32_WINDOWS_HXX