Skip to content

Commit cdfa45c

Browse files
committed
Fix Windows build
``` S:\jenkins\workspace\swift-PR-windows\swift\stdlib\public\Concurrency\Actor.cpp(1612,22): error: expected unqualified-id : std::max(oldPriority, job->getPriority()); ^ C:\Program Files (x86)\Windows Kits\10\\Include\10.0.18362.0\shared\minwindef.h(193,29): note: expanded from macro max #define max(a,b) (((a) > (b)) ? (a) : (b)) ^ 1 error generated. ``` (cherry picked from commit 28a23e5)
1 parent 0b4b4e1 commit cdfa45c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717

1818
#include "swift/Runtime/Concurrency.h"
1919

20+
#ifdef _WIN32
21+
// On Windows, an include below triggers an indirect include of minwindef.h
22+
// which contains a definition of the `max` macro, generating an error in our
23+
// use of std::max in this file. This define prevents those macros from being
24+
// defined.
25+
#define NOMINMAX
26+
#endif
27+
2028
#include "../CompatibilityOverride/CompatibilityOverride.h"
2129
#include "../runtime/ThreadLocalStorage.h"
2230
#include "swift/Runtime/Atomic.h"

0 commit comments

Comments
 (0)