From: Mikko Rasa Date: Tue, 3 Jan 2023 14:29:47 +0000 (+0200) Subject: Add a wrapper header for windows.h X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=3ba20e3ddde250a78ab2410012551eb60304f766;p=libs%2Fcore.git Add a wrapper header for windows.h Since Time::min is now defined in the header, it runs afoul of the min() macro defined in windows.h unless the latter is disabled. --- diff --git a/source/core/windows/main.cpp b/source/core/windows/main.cpp index 11da64b..df17020 100644 --- a/source/core/windows/main.cpp +++ b/source/core/windows/main.cpp @@ -1,4 +1,5 @@ -#include +#include "winapi.h" +#include #include #include #include "application.h" diff --git a/source/core/windows/module_platform.h b/source/core/windows/module_platform.h index 81dfd0f..eb0b633 100644 --- a/source/core/windows/module_platform.h +++ b/source/core/windows/module_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_CORE_MODULE_PLATFORM_H_ #define MSP_CORE_MODULE_PLATFORM_H_ -#include +#include "winapi.h" namespace Msp { diff --git a/source/core/windows/mutex.cpp b/source/core/windows/mutex.cpp index e51fda4..6d39635 100644 --- a/source/core/windows/mutex.cpp +++ b/source/core/windows/mutex.cpp @@ -1,4 +1,4 @@ -#include +#include "winapi.h" #include "mutex.h" #include "mutex_private.h" diff --git a/source/core/windows/mutex_platform.h b/source/core/windows/mutex_platform.h index fae5e85..1d5c1c0 100644 --- a/source/core/windows/mutex_platform.h +++ b/source/core/windows/mutex_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_CORE_MUTEX_PLATFORM_H_ #define MSP_CORE_MUTEX_PLATFORM_H_ -#include +#include "winapi.h" namespace Msp { diff --git a/source/core/windows/process.cpp b/source/core/windows/process.cpp index e19fd6b..0eae33b 100644 --- a/source/core/windows/process.cpp +++ b/source/core/windows/process.cpp @@ -1,4 +1,4 @@ -#include +#include "winapi.h" #include #include #include diff --git a/source/core/windows/process_platform.h b/source/core/windows/process_platform.h index 4cb793a..d55678e 100644 --- a/source/core/windows/process_platform.h +++ b/source/core/windows/process_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_CORE_PROCESS_PLATFORM_H_ #define MSP_CORE_PROCESS_PLATFORM_H_ -#include +#include "winapi.h" namespace Msp { diff --git a/source/core/windows/semaphore.cpp b/source/core/windows/semaphore.cpp index c81f815..e45e4b9 100644 --- a/source/core/windows/semaphore.cpp +++ b/source/core/windows/semaphore.cpp @@ -1,4 +1,4 @@ -#include +#include "winapi.h" #include #include #include "semaphore.h" diff --git a/source/core/windows/systemerror.cpp b/source/core/windows/systemerror.cpp index 93aa7bd..754c90b 100644 --- a/source/core/windows/systemerror.cpp +++ b/source/core/windows/systemerror.cpp @@ -1,4 +1,4 @@ -#include +#include "winapi.h" #include #include "systemerror.h" diff --git a/source/core/windows/thread.cpp b/source/core/windows/thread.cpp index 8890a70..3231896 100644 --- a/source/core/windows/thread.cpp +++ b/source/core/windows/thread.cpp @@ -1,4 +1,4 @@ -#include +#include "winapi.h" #include "thread.h" #include "thread_private.h" diff --git a/source/core/windows/thread_platform.h b/source/core/windows/thread_platform.h index 50b1a5e..d88bd8b 100644 --- a/source/core/windows/thread_platform.h +++ b/source/core/windows/thread_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_CORE_THREAD_PLATFORM_H_ #define MSP_CORE_THREAD_PLATFORM_H_ -#include +#include "winapi.h" namespace Msp { diff --git a/source/core/windows/winapi.h b/source/core/windows/winapi.h new file mode 100644 index 0000000..dca0880 --- /dev/null +++ b/source/core/windows/winapi.h @@ -0,0 +1,12 @@ +#ifndef MSP_CORE_WINAPI_H_ +#define MSP_CORE_WINAPI_H_ + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include + +#endif diff --git a/source/fs/windows/dir.cpp b/source/fs/windows/dir.cpp index fde0200..2ba2f1e 100644 --- a/source/fs/windows/dir.cpp +++ b/source/fs/windows/dir.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/source/fs/windows/stat.cpp b/source/fs/windows/stat.cpp index 8331e60..ee79476 100644 --- a/source/fs/windows/stat.cpp +++ b/source/fs/windows/stat.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/source/fs/windows/stat_platform.h b/source/fs/windows/stat_platform.h index 6440aca..89961c6 100644 --- a/source/fs/windows/stat_platform.h +++ b/source/fs/windows/stat_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_FS_STAT_PLATFORM_H_ #define MSP_FS_STAT_PLATFORM_H_ -#include +#include namespace Msp { namespace FS { diff --git a/source/fs/windows/utils.cpp b/source/fs/windows/utils.cpp index f38d192..a1c2513 100644 --- a/source/fs/windows/utils.cpp +++ b/source/fs/windows/utils.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "dir.h" diff --git a/source/io/windows/eventreader.cpp b/source/io/windows/eventreader.cpp index 33a095a..8f208c2 100644 --- a/source/io/windows/eventreader.cpp +++ b/source/io/windows/eventreader.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "eventreader.h" diff --git a/source/io/windows/handle_platform.h b/source/io/windows/handle_platform.h index f12e5f7..776e8f3 100644 --- a/source/io/windows/handle_platform.h +++ b/source/io/windows/handle_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_IO_HANDLE_PLATFORM_H_ #define MSP_IO_HANDLE_PLATFORM_H_ -#include +#include namespace Msp { namespace IO { diff --git a/source/io/windows/poll_platform.h b/source/io/windows/poll_platform.h index ec778ae..62a000f 100644 --- a/source/io/windows/poll_platform.h +++ b/source/io/windows/poll_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_IO_POLL_PLATFORM_H_ #define MSP_IO_POLL_PLATFORM_H_ -#include +#include #include #include "poll.h" diff --git a/source/io/windows/seekable.cpp b/source/io/windows/seekable.cpp index c33a798..3756cf1 100644 --- a/source/io/windows/seekable.cpp +++ b/source/io/windows/seekable.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "handle.h" #include "handle_private.h" diff --git a/source/io/windows/serial_platform.h b/source/io/windows/serial_platform.h index dd7dd50..3173736 100644 --- a/source/io/windows/serial_platform.h +++ b/source/io/windows/serial_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_IO_SERIAL_PLATFORM_H_ #define MSP_IO_SERIAL_PLATFORM_H_ -#include +#include namespace Msp { namespace IO { diff --git a/source/time/windows/rawtime_platform.h b/source/time/windows/rawtime_platform.h index 60a9a59..bd57889 100644 --- a/source/time/windows/rawtime_platform.h +++ b/source/time/windows/rawtime_platform.h @@ -1,7 +1,7 @@ #ifndef MSP_TIME_RAWTIME_PLATFORM_H_ #define MSP_TIME_RAWTIME_PLATFORM_H_ -#include +#include #include "rawtime.h" namespace Msp { diff --git a/source/time/windows/timezone.cpp b/source/time/windows/timezone.cpp index 570c679..1b52644 100644 --- a/source/time/windows/timezone.cpp +++ b/source/time/windows/timezone.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "timezone.h" diff --git a/source/time/windows/utils.cpp b/source/time/windows/utils.cpp index 2150a10..4d295a9 100644 --- a/source/time/windows/utils.cpp +++ b/source/time/windows/utils.cpp @@ -1,4 +1,4 @@ -#include +#include #include "rawtime_private.h" #include "timedelta.h" #include "timestamp.h"