[PATCH] Remove #include <windows.h> from libcxx/include/support/win32/support.h

Yaron Keren yaron.keren at gmail.com
Wed Oct 2 08:23:54 PDT 2013

Windows.h #defines NOMINMAX.
In the MingW 4.8.1 headers min and max may be defined in five header files:

stdlib.h, #if 0
ntdef.h, #ifndef NOMINMAX
minmax.h, #ifndef __cplusplus
minwindef.h, #ifndef __cplusplus
classpnp.h, not protected by any define!!

so NOMINMAX applies only to ntdef.h.
Anyhow, to be on the safe side it may be defined project wide.


2013/10/2 G M <gmisocpp at gmail.com>
> Hi Yaron
> Yes that's true. Windows.h isn't required any more for clang or visual
studio builds either.
> I didn't remove it in my prior patch to support.h because I was trying to
keep my changes minimal for the goal of that patch and remove windows.h in
a follow up one as it makes a big difference to compile times, especially
Visual Studio and curiously reduces the error count too.
> I think these lines are also related to windows.h
> //#ifndef NOMINMAX
> //#define NOMINMAX
> //#endif
> but min/max might get brought in by other Win32 headers, I'm not sure.
It's arguable that this macro should be defined in __config in the Win32
section so it becomes project wide. libcxx goes to some lengths to avoid
other min/max issues in (some) other headers in using __undef_min_max.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131002/31906d4e/attachment.html>

More information about the cfe-commits mailing list