2010-04-02 21:58:11 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-04-02 21:58:11 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_${HEADER}_h
|
|
|
|
#define mozilla_${HEADER}_h
|
|
|
|
|
|
|
|
#if _HAS_EXCEPTIONS
|
|
|
|
# error "STL code can only be used with -fno-exceptions"
|
|
|
|
#endif
|
|
|
|
|
2018-07-25 15:07:56 +03:00
|
|
|
#if defined(__clang__)
|
|
|
|
// Silence "warning: #include_next is a language extension [-Wgnu-include-next]"
|
|
|
|
#pragma clang system_header
|
|
|
|
#endif
|
|
|
|
|
2016-05-18 10:37:19 +03:00
|
|
|
// Include mozalloc after the STL header and all other headers it includes
|
|
|
|
// have been preprocessed.
|
|
|
|
#if !defined(MOZ_INCLUDE_MOZALLOC_H)
|
|
|
|
# define MOZ_INCLUDE_MOZALLOC_H
|
|
|
|
# define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
|
|
|
|
#endif
|
|
|
|
|
2014-05-30 04:39:53 +04:00
|
|
|
#ifdef _DEBUG
|
2010-04-02 21:58:11 +04:00
|
|
|
// From
|
|
|
|
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
|
|
|
|
// and
|
|
|
|
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
|
|
|
|
// there appear to be two types of STL container checking. The
|
2014-05-30 04:39:53 +04:00
|
|
|
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
|
2010-04-02 21:58:11 +04:00
|
|
|
// looks to be full generation/mutation checked iterators as done by
|
|
|
|
// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
|
|
|
|
// is enabled by the following macros. It appears that the _DEBUG
|
|
|
|
// iterators subsume _SECURE_SCL, and the following settings are
|
|
|
|
// default anyway, so we'll just leave this commented out.
|
|
|
|
//# define _SECURE_SCL 1
|
|
|
|
//# define _SECURE_SCL_THROWS 0
|
|
|
|
#else
|
|
|
|
// Note: _SECURE_SCL iterators are on by default in opt builds. We
|
|
|
|
// could leave them on, but since gcc doesn't, we might as well
|
|
|
|
// preserve that behavior for perf reasons. nsTArray is in the same
|
|
|
|
// camp as gcc. Can revisit later.
|
|
|
|
//
|
|
|
|
// FIXME/bug 551254: because we're not wrapping all the STL headers we
|
|
|
|
// use, undefining this here can cause some headers to be built with
|
|
|
|
// iterator checking and others not. Turning this off until we have a
|
|
|
|
// better plan.
|
|
|
|
//# undef _SECURE_SCL
|
|
|
|
#endif
|
|
|
|
|
2013-01-04 07:49:25 +04:00
|
|
|
// C4275: When _HAS_EXCEPTIONS is set to 0, system STL header
|
|
|
|
// will generate the warning which we can't modify.
|
|
|
|
// C4530: We know that code won't be able to catch exceptions,
|
|
|
|
// but that's OK because we're not throwing them.
|
2010-04-02 21:58:11 +04:00
|
|
|
#pragma warning( push )
|
2013-01-04 07:49:25 +04:00
|
|
|
#pragma warning( disable : 4275 4530 )
|
2010-04-02 21:58:11 +04:00
|
|
|
|
2016-09-09 16:01:14 +03:00
|
|
|
#ifdef __clang__
|
|
|
|
#include_next <${HEADER}>
|
|
|
|
#else
|
2010-04-02 21:58:11 +04:00
|
|
|
#include <${HEADER_PATH}>
|
2016-09-09 16:01:14 +03:00
|
|
|
#endif
|
2010-04-02 21:58:11 +04:00
|
|
|
|
|
|
|
#pragma warning( pop )
|
|
|
|
|
2016-05-18 10:37:19 +03:00
|
|
|
#ifdef MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
|
2017-12-06 03:56:02 +03:00
|
|
|
// See if we're in code that can use mozalloc.
|
|
|
|
# if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
|
2016-05-18 10:37:19 +03:00
|
|
|
# include "mozilla/mozalloc.h"
|
|
|
|
# else
|
|
|
|
# error "STL code can only be used with infallible ::operator new()"
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2010-04-02 21:58:11 +04:00
|
|
|
#endif // if mozilla_${HEADER}_h
|