Path: blob/main/system/lib/libcxxabi/src/demangle/DemangleConfig.h
6175 views
//===--- DemangleConfig.h --------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6// This file is contains a subset of macros copied from7// llvm/include/llvm/Demangle/DemangleConfig.h8//===----------------------------------------------------------------------===//910#ifndef LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H11#define LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H1213// Must be defined before pulling in headers from libc++. Allow downstream14// build systems to override this value.15// https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode16#ifndef _LIBCPP_VERBOSE_ABORT17#define _LIBCPP_VERBOSE_ABORT(...) __abort_message(__VA_ARGS__)18#include "../abort_message.h"19#endif2021#ifndef _LIBCPP_LOG_HARDENING_FAILURE22// Libc++abi does not have any functionality to log and continue, so we drop23// error messages when we build the demangler with `observe` assertion semantic.24// Once the layering with libc++ is improved, this could use the libc++25// functionality to log hardening failures.26#define _LIBCPP_LOG_HARDENING_FAILURE(message) ((void)0)27#endif2829#include <version>3031#ifdef _MSC_VER32// snprintf is implemented in VS 201533#if _MSC_VER < 190034#define snprintf _snprintf_s35#endif36#endif3738#ifndef __has_feature39#define __has_feature(x) 040#endif4142#ifndef __has_cpp_attribute43#define __has_cpp_attribute(x) 044#endif4546#ifndef __has_attribute47#define __has_attribute(x) 048#endif4950#ifndef __has_builtin51#define __has_builtin(x) 052#endif5354#ifndef DEMANGLE_GNUC_PREREQ55#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)56#define DEMANGLE_GNUC_PREREQ(maj, min, patch) \57((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \58((maj) << 20) + ((min) << 10) + (patch))59#elif defined(__GNUC__) && defined(__GNUC_MINOR__)60#define DEMANGLE_GNUC_PREREQ(maj, min, patch) \61((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))62#else63#define DEMANGLE_GNUC_PREREQ(maj, min, patch) 064#endif65#endif6667#if __has_attribute(used) || DEMANGLE_GNUC_PREREQ(3, 1, 0)68#define DEMANGLE_ATTRIBUTE_USED __attribute__((__used__))69#else70#define DEMANGLE_ATTRIBUTE_USED71#endif7273#if __has_builtin(__builtin_unreachable) || DEMANGLE_GNUC_PREREQ(4, 5, 0)74#define DEMANGLE_UNREACHABLE __builtin_unreachable()75#elif defined(_MSC_VER)76#define DEMANGLE_UNREACHABLE __assume(false)77#else78#define DEMANGLE_UNREACHABLE79#endif8081#if __has_attribute(noinline) || DEMANGLE_GNUC_PREREQ(3, 4, 0)82#define DEMANGLE_ATTRIBUTE_NOINLINE __attribute__((noinline))83#elif defined(_MSC_VER)84#define DEMANGLE_ATTRIBUTE_NOINLINE __declspec(noinline)85#else86#define DEMANGLE_ATTRIBUTE_NOINLINE87#endif8889#if !defined(NDEBUG)90#define DEMANGLE_DUMP_METHOD DEMANGLE_ATTRIBUTE_NOINLINE DEMANGLE_ATTRIBUTE_USED91#else92#define DEMANGLE_DUMP_METHOD DEMANGLE_ATTRIBUTE_NOINLINE93#endif9495#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)96#define DEMANGLE_FALLTHROUGH [[fallthrough]]97#elif __has_cpp_attribute(gnu::fallthrough)98#define DEMANGLE_FALLTHROUGH [[gnu::fallthrough]]99#elif !__cplusplus100// Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious101// error when __has_cpp_attribute is given a scoped attribute in C mode.102#define DEMANGLE_FALLTHROUGH103#elif __has_cpp_attribute(clang::fallthrough)104#define DEMANGLE_FALLTHROUGH [[clang::fallthrough]]105#else106#define DEMANGLE_FALLTHROUGH107#endif108109#ifndef DEMANGLE_ASSERT110#include <cassert>111#define DEMANGLE_ASSERT(__expr, __msg) assert((__expr) && (__msg))112#endif113114#define DEMANGLE_NAMESPACE_BEGIN namespace { namespace itanium_demangle {115#define DEMANGLE_NAMESPACE_END } }116117#endif // LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H118119120