From a6a846ad051043cb389b401035f361864a691ec6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Feb 2013 16:55:50 +0200 Subject: Factor windows.h inclusion into separate header, disable min/max macros --- odb/details/win32/condition.cxx | 7 +------ odb/details/win32/condition.hxx | 8 +------- odb/details/win32/dll.cxx | 7 +------ odb/details/win32/exceptions.hxx | 9 +-------- odb/details/win32/lock.hxx | 8 +------- odb/details/win32/mutex.hxx | 9 +-------- odb/details/win32/once.cxx | 7 +------ odb/details/win32/once.hxx | 9 +-------- odb/details/win32/thread.cxx | 6 +----- odb/details/win32/thread.hxx | 9 +-------- odb/details/win32/tls.cxx | 6 +----- odb/details/win32/windows.hxx | 34 ++++++++++++++++++++++++++++++++++ 12 files changed, 45 insertions(+), 74 deletions(-) create mode 100644 odb/details/win32/windows.hxx 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 - +#include #include #include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif +#include #include // 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 - +#include #include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif - +#include #include #include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif +#include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif - +#include #include 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 - +#include #include #include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif - +#include #include 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 +#include #include // _beginthreadex, _endthreadex #include 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 -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# include -# undef WIN32_LEAN_AND_MEAN -#else -# include -#endif - +#include #include #include 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 +#include #include // ERROR_INVALID_INDEX #include 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 + +// Try to include 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 +# undef NOMINMAX +# else +# include +# endif +# undef WIN32_LEAN_AND_MEAN +#else +# ifndef NOMINMAX +# define NOMINMAX +# include +# undef NOMINMAX +# else +# include +# endif +#endif + +#include + +#endif // ODB_DETAILS_WIN32_WINDOWS_HXX -- cgit v1.1