Fix build with latest Xcode on OSX (#14282)
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 3 Oct 2017 20:09:43 +0000 (22:09 +0200)
committerGitHub <noreply@github.com>
Tue, 3 Oct 2017 20:09:43 +0000 (22:09 +0200)
commit08d39ddf02c81c99bd49c19b808c855235cbabdc
treef1314991120946c183cd58490db9219cbce596ca
parent4cfd557c2d1e80123d5a37aaea00636ddcc7be49
Fix build with latest Xcode on OSX (#14282)

* Fix build with latest Xcode on OSX

The latest Xcode 9 cannot successfully build CoreCLR PAL. There are
several issues. First, it complains that min / max macros cannot be defined
in C++ code, since they would collide with the std::min and std::max
functions. Second, some of the headers that PAL includes pull in declarations
of several template classes that we explicitly define in PAL and also
the new operator declaration.

To fix that, I have undefined the min and max macros for PAL and replaced
their usage by the std::min / max functions. I have also removed the manual
declaration of the colliding template classes and new operator and added
inclusion of the proper C++ headers instead.

The PAL was including non-pal safemath.h and to make this change compatible
with it, I have added definition of USE_STL that makes safemath.h include
type_trait from STL instead of our local trimmed copy.

I have also removed some dead code that I have discovered during the process.

Fixes #14279

* Fix build on ARM32 and very recent GLIBCXX
14 files changed:
src/pal/CMakeLists.txt
src/pal/src/cruntime/mbstring.cpp
src/pal/src/cruntime/printf.cpp
src/pal/src/cruntime/printfcpp.cpp
src/pal/src/cruntime/wchar.cpp
src/pal/src/exception/seh.cpp
src/pal/src/include/pal/cruntime.h
src/pal/src/include/pal/malloc.hpp
src/pal/src/include/pal/palinternal.h
src/pal/src/init/pal.cpp
src/pal/src/misc/cgroup.cpp
src/pal/src/misc/sysinfo.cpp
src/pal/src/numa/numa.cpp
src/pal/src/synchmgr/synchmanager.cpp