Bug 1560374 - Set testharness and reftest web-platform-tests to Tier-1; r=jmaher...
[gecko.git] / config / msvc-stl-wrapper.template.h
blob50e2f7af10139e34afa0264db3bf216f263e7d66
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 // C4275: When _HAS_EXCEPTIONS is set to 0, system STL header
55 // will generate the warning which we can't modify.
56 // C4530: We know that code won't be able to catch exceptions,
57 // but that's OK because we're not throwing them.
58 #pragma warning( push )
59 #pragma warning( disable : 4275 4530 )
61 #ifdef __clang__
62 #include_next <${HEADER}>
63 #else
64 #include <${HEADER_PATH}>
65 #endif
67 #pragma warning( pop )
69 #ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
70 // See if we're in code that can use mozalloc.
71 # if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
72 # include "mozilla/mozalloc.h"
73 # else
74 # error "STL code can only be used with infallible ::operator new()"
75 # endif
76 #endif
78 #endif // if mozilla_${HEADER}_h