brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · d352405 Raw
65 lines · plain
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___ASSERTION_HANDLER11#define _LIBCPP___ASSERTION_HANDLER12 13#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)14#  include <__cxx03/__config>15#  include <__cxx03/__verbose_abort>16#  include <__cxx03/__verbose_trap>17#else18#  include <__config>19#  include <__log_hardening_failure>20#  include <__verbose_abort>21#  include <__verbose_trap>22#endif23 24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)25#  pragma GCC system_header26#endif27 28#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)29 30// Keep the old implementation that doesn't support assertion semantics for backward compatibility with the frozen C++0331// mode.32#  if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG33#    define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)34#  else35#    define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)36#  endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG37 38#else39 40#  if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE41#    define _LIBCPP_ASSERTION_HANDLER(message) ((void)0)42 43#  elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE44#    define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_LOG_HARDENING_FAILURE(message)45 46#  elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE47#    define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_TRAP(message)48 49#  elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE50#    define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)51 52#  else53 54#    error _LIBCPP_ASSERTION_SEMANTIC must be set to one of the following values: \55_LIBCPP_ASSERTION_SEMANTIC_IGNORE, \56_LIBCPP_ASSERTION_SEMANTIC_OBSERVE, \57_LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE, \58_LIBCPP_ASSERTION_SEMANTIC_ENFORCE59 60#  endif // _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_IGNORE61 62#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)63 64#endif // _LIBCPP___ASSERTION_HANDLER65