Skip to content

Commit c258a4a

Browse files
committed
Remove NOMINMAX definition to better catch Windows.h issues in the future.
1 parent 242da36 commit c258a4a

File tree

8 files changed

+27
-18
lines changed

8 files changed

+27
-18
lines changed

Release/include/pplx/pplxtasks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7332,4 +7332,5 @@ namespace concurrency = Concurrency;
73327332
#endif
73337333

73347334
#endif // _PPLXTASKS_H
7335+
73357336

Release/src/http/client/http_client_winhttp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include <VersionHelpers.h>
2222
#endif
2323

24+
#undef min
25+
#undef max
26+
2427
namespace web
2528
{
2629
namespace http
@@ -1527,3 +1530,4 @@ std::shared_ptr<_http_client_communicator> create_platform_final_pipeline_stage(
15271530
}
15281531

15291532
}}}}
1533+

Release/src/http/common/http_msg.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include "stdafx.h"
1414
#include "../common/internal_http_helpers.h"
1515

16+
#undef min
17+
#undef max
18+
1619
using namespace web;
1720
using namespace utility;
1821
using namespace concurrency;
@@ -1043,3 +1046,4 @@ details::_http_request::_http_request(std::unique_ptr<http::details::_http_serve
10431046
#undef DAT
10441047
#endif
10451048
}} // namespace web::http
1049+

Release/src/http/listener/http_server_httpsys.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#include "http_server_httpsys.h"
2323
#include "http_server_impl.h"
2424

25+
#undef min
26+
#undef max
27+
2528
using namespace web;
2629
using namespace utility;
2730
using namespace concurrency;
@@ -1054,4 +1057,4 @@ std::unique_ptr<http_server> make_http_httpsys_server()
10541057

10551058
}}}}
10561059

1057-
#endif
1060+
#endif

Release/src/json/json.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
#include "stdafx.h"
1515

16+
#undef min
17+
#undef max
18+
1619
using namespace web;
1720

1821
bool json::details::g_keep_json_object_unsorted = false;
@@ -516,3 +519,4 @@ const web::json::details::json_error_category_impl& web::json::details::json_err
516519
#endif
517520
return instance;
518521
}
522+

Release/src/pch/stdafx.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#pragma clang diagnostic ignored "-Winfinite-recursion"
2020
#endif
2121

22-
#include "cpprest/details/cpprest_compat.h"
23-
#include "cpprest/details/basic_types.h"
24-
2522
#ifdef _WIN32
2623
#ifdef CPPREST_TARGET_XP
2724
#include <winsdkver.h>
@@ -37,12 +34,7 @@
3734
#include <crtdbg.h>
3835
#endif
3936

40-
#ifndef WIN32_LEAN_AND_MEAN
4137
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
42-
// Windows Header Files:
43-
#define NOMINMAX
44-
#endif
45-
4638
#include <windows.h>
4739
#include <objbase.h>
4840

@@ -96,6 +88,9 @@
9688
#include <thread>
9789
#include <set>
9890

91+
#include "cpprest/details/cpprest_compat.h"
92+
#include "cpprest/details/basic_types.h"
93+
9994
#include "pplx/pplxtasks.h"
10095
#include "cpprest/version.h"
10196

@@ -140,13 +135,6 @@
140135
#endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA
141136
#endif
142137

143-
#if defined(max)
144-
#error: max macro defined -- make sure to #define NOMINMAX before including windows.h
145-
#endif
146-
#if defined(min)
147-
#error: min macro defined -- make sure to #define NOMINMAX before including windows.h
148-
#endif
149-
150138
#if defined(__clang__)
151139
#pragma clang diagnostic pop
152-
#endif
140+
#endif

Release/src/websockets/client/ws_client_wspp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
#include "ws_client_impl.h"
2222

23+
// These must be undef'ed before including websocketpp because it is not Windows.h safe.
24+
#undef min
25+
#undef max
26+
2327
// Force websocketpp to use C++ std::error_code instead of Boost.
2428
#define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_
2529
#if defined(_MSC_VER)
@@ -792,3 +796,4 @@ websocket_callback_client::websocket_callback_client(websocket_client_config con
792796
}}}
793797

794798
#endif
799+

Release/tests/common/utilities/os_utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#ifdef WIN32
1717
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
18-
#define NOMINMAX
1918
#include <Windows.h>
2019
#else
2120
#include <unistd.h>
@@ -55,3 +54,4 @@ long os_utilities::interlocked_exchange(volatile long *target, long value)
5554
}
5655

5756
}}}
57+

0 commit comments

Comments
 (0)