Bug 1870499 - disable test_youtube_flash_embed.html on linux debug for causing multip...
[gecko.git] / config / msvc-stl-wrapper.template.h
blobfe9be05011e43a4662830652e1220b0fd70f2b5e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_${HEADER}_h
9 #define mozilla_${HEADER}_h
11 #if _HAS_EXCEPTIONS
12 # error "STL code can only be used with -fno-exceptions"
13 #endif
15 #if defined(__clang__)
16 // Silence "warning: #include_next is a language extension [-Wgnu-include-next]"
17 #pragma clang system_header
18 #endif
20 // Include mozalloc after the STL header and all other headers it includes
21 // have been preprocessed.
22 #if !defined(MOZ_INCLUDE_MOZALLOC_H)
23 # define MOZ_INCLUDE_MOZALLOC_H
24 # define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
25 #endif
27 #ifdef _DEBUG
28 // From
29 // http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
30 // and
31 // http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
32 // there appear to be two types of STL container checking. The
33 // former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
34 // looks to be full generation/mutation checked iterators as done by
35 // _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
36 // is enabled by the following macros. It appears that the _DEBUG
37 // iterators subsume _SECURE_SCL, and the following settings are
38 // default anyway, so we'll just leave this commented out.
39 //# define _SECURE_SCL 1
40 //# define _SECURE_SCL_THROWS 0
41 #else
42 // Note: _SECURE_SCL iterators are on by default in opt builds. We
43 // could leave them on, but since gcc doesn't, we might as well
44 // preserve that behavior for perf reasons. nsTArray is in the same
45 // camp as gcc. Can revisit later.
47 // FIXME/bug 551254: because we're not wrapping all the STL headers we
48 // use, undefining this here can cause some headers to be built with
49 // iterator checking and others not. Turning this off until we have a
50 // better plan.
51 //# undef _SECURE_SCL
52 #endif
54 #include_next <${HEADER}>
56 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
57 // See if we're in code that can use mozalloc.
58 # if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
59 // In recent versions of MSVC, <new>, which mozalloc.h includes, uses
60 // <type_traits> without including it. Before MSVC 17.7, this worked
61 // fine because <new> included <exception>, which includes <type_traits>.
62 // That is still the case, but it now also includes <cstdlib> before
63 // <type_traits>, so when something includes <exception> before <new>,
64 // we get here before <type_traits> is included, which ends up not working.
65 # include <type_traits>
66 # include "mozilla/mozalloc.h"
67 # else
68 # error "STL code can only be used with infallible ::operator new()"
69 # endif
70 #endif
72 #endif // if mozilla_${HEADER}_h