Issue #1729 - Support building/linking against libc++ 9+

Including <cstdlib> must never trigger inclusion of "mozalloc.h", because the
first thing this one does is precisely to include <cstdlib>.

It is now the case that, in libc++ 9 and beyond, <cstdlib> includes <math.h>
which then tries to include <type_traits>, which the STL wrapper intercepts,
trying to load "mozalloc.h". Same problem happens with <limits>.

Fix pulled from: https://bugzilla.mozilla.org/show_bug.cgi?id=1594027.
This commit is contained in:
Olivier Certner 2021-01-18 13:37:10 +01:00 committed by roytam1
commit 5d2e8f06f4

View file

@ -32,6 +32,14 @@
# define moz_dont_include_mozalloc_for_cstdlib
#endif
#ifndef moz_dont_include_mozalloc_for_type_traits
# define moz_dont_include_mozalloc_for_type_traits
#endif
#ifndef moz_dont_include_mozalloc_for_limits
# define moz_dont_include_mozalloc_for_limits
#endif
// Include mozalloc after the STL header and all other headers it includes
// have been preprocessed.
#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \