Skip to content

Commit e3d38b7

Browse files
committed
[flang][msvc] Tell windows.h to not define min/max macros.
Defining macros for min and max breaks using std::min and std::max. Defining NOMINMAX before including the header stops them from being defined. See https://web.archive.org/web/20170911092732/https://support.microsoft.com/en-us/help/143208/prb-using-stl-in-windows-program-can-cause-min-max-conflicts for details. This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]]. Reviewed By: isuruf Differential Revision: https://reviews.llvm.org/D85656
1 parent 269bc3f commit e3d38b7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

flang/runtime/file.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <fcntl.h>
1616
#include <stdlib.h>
1717
#ifdef _WIN32
18+
#define NOMINMAX
1819
#include <io.h>
1920
#include <windows.h>
2021
#else

0 commit comments

Comments
 (0)