diff options
-rw-r--r-- | src/mongo/pch.h | 27 | ||||
-rw-r--r-- | src/mongo/platform/basic.h | 19 | ||||
-rw-r--r-- | src/mongo/platform/windows_basic.h | 19 | ||||
-rw-r--r-- | src/mongo/util/time_support.h | 4 |
4 files changed, 40 insertions, 29 deletions
diff --git a/src/mongo/pch.h b/src/mongo/pch.h index 4dc3c99369a..be81d671688 100644 --- a/src/mongo/pch.h +++ b/src/mongo/pch.h @@ -25,32 +25,7 @@ // system headers and boost headers #include "mongo/client/undef_macros.h" -#if defined(_WIN32) -// for rand_s() usage: -# define _CRT_RAND_S -# ifndef NOMINMAX -# define NOMINMAX -# endif -// tell windows.h not to include a bunch of headers -// we don't need: -# define WIN32_LEAN_AND_MEAN -# include "targetver.h" -# include <winsock2.h> //this must be included before the first windows.h include -# include <ws2tcpip.h> -# include <wspiapi.h> -# include <windows.h> -#endif - -#if defined(__linux__) -// glibc's optimized versions are better than g++ builtins -# define __builtin_strcmp strcmp -# define __builtin_strlen strlen -# define __builtin_memchr memchr -# define __builtin_memcmp memcmp -# define __builtin_memcpy memcpy -# define __builtin_memset memset -# define __builtin_memmove memmove -#endif +#include "mongo/platform/basic.h" #include <ctime> #include <cstring> diff --git a/src/mongo/platform/basic.h b/src/mongo/platform/basic.h new file mode 100644 index 00000000000..e21a242c2e6 --- /dev/null +++ b/src/mongo/platform/basic.h @@ -0,0 +1,19 @@ +// basic.h + +#pragma once + +#ifdef _WIN32 +#include "windows_basic.h" +#endif + +#if defined(__linux__) +// glibc's optimized versions are better than g++ builtins +# define __builtin_strcmp strcmp +# define __builtin_strlen strlen +# define __builtin_memchr memchr +# define __builtin_memcmp memcmp +# define __builtin_memcpy memcpy +# define __builtin_memset memset +# define __builtin_memmove memmove +#endif + diff --git a/src/mongo/platform/windows_basic.h b/src/mongo/platform/windows_basic.h new file mode 100644 index 00000000000..3a728981d33 --- /dev/null +++ b/src/mongo/platform/windows_basic.h @@ -0,0 +1,19 @@ +// windows_basic.h + +#pragma once + +#if defined(_WIN32) +// for rand_s() usage: +# define _CRT_RAND_S +# ifndef NOMINMAX +# define NOMINMAX +# endif +// tell windows.h not to include a bunch of headers +// we don't need: +# define WIN32_LEAN_AND_MEAN +# include "targetver.h" +# include <winsock2.h> //this must be included before the first windows.h include +# include <ws2tcpip.h> +# include <wspiapi.h> +# include <windows.h> +#endif diff --git a/src/mongo/util/time_support.h b/src/mongo/util/time_support.h index 826596fa2e9..f0877371133 100644 --- a/src/mongo/util/time_support.h +++ b/src/mongo/util/time_support.h @@ -17,9 +17,7 @@ #pragma once -#ifdef _WIN32 -#include <windows.h> -#endif +#include "mongo/platform/basic.h" #include <cstdio> // sscanf #include <ctime> |