Skip to content

Commit 827c34f

Browse files
committed
fix(xml): guard NOMINMAX so a consumer that already defines it still builds
XmlReader.cpp defined WIN32_LEAN_AND_MEAN and NOMINMAX unconditionally before including <windows.h>. CNA compiles the whole tree with -DNOMINMAX on the command line and with /W4 /WX, so MSVC reported the redefinition as C4005 and /WX turned it into C2220 -- the CNA + sharp-runtime pair did not build at all on Windows at these two HEADs. Every other Windows translation unit here already uses the #ifndef guard, Environment.cpp from this same series included; this file was the one that missed it. Linux is unaffected: the block is inside #if defined(_WIN32).
1 parent a655630 commit 827c34f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

modules/xml/src/System/Xml/XmlReader.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
#if defined(_WIN32)
99
// Contained in this translation unit: <windows.h> in a header is what produced the ERROR and
1010
// min/max macro collisions recorded in CNA as WINNATIVE-F5 and F11.
11-
# define WIN32_LEAN_AND_MEAN
12-
# define NOMINMAX
11+
# ifndef WIN32_LEAN_AND_MEAN
12+
# define WIN32_LEAN_AND_MEAN
13+
# endif
14+
# ifndef NOMINMAX
15+
# define NOMINMAX
16+
# endif
1317
# include <windows.h>
1418
#endif
1519
#include <algorithm>

0 commit comments

Comments
 (0)