tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DiagnosticAssertions.h (1007B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: set ts=8 sts=2 et sw=2 tw=80:
      3 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef util_DiagnosticAssertions_h
      8 #define util_DiagnosticAssertions_h
      9 
     10 #include "mozilla/Assertions.h"
     11 #include "mozilla/Likely.h"
     12 
     13 #include "jstypes.h"
     14 
     15 /* Crash diagnostics by default in debug and on nightly channel. */
     16 #if defined(DEBUG) || defined(NIGHTLY_BUILD)
     17 #  define JS_CRASH_DIAGNOSTICS 1
     18 #endif
     19 
     20 #if defined(JS_DEBUG)
     21 #  define JS_DIAGNOSTICS_ASSERT(expr) MOZ_ASSERT(expr)
     22 #elif defined(JS_CRASH_DIAGNOSTICS)
     23 #  define JS_DIAGNOSTICS_ASSERT(expr)         \
     24    do {                                      \
     25      if (MOZ_UNLIKELY(!(expr))) MOZ_CRASH(); \
     26    } while (0)
     27 #else
     28 #  define JS_DIAGNOSTICS_ASSERT(expr) ((void)0)
     29 #endif
     30 
     31 #endif /* util_DiagnosticAssertions_h */