[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
This commit is contained in:
Michael Kruse 2020-08-12 14:21:30 -05:00
parent 269bc3f5df
commit e3d38b7b88
1 changed files with 1 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include <fcntl.h>
#include <stdlib.h>
#ifdef _WIN32
#define NOMINMAX
#include <io.h>
#include <windows.h>
#else