__cxxabi_config.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef ____CXXABI_CONFIG_H
  9. #define ____CXXABI_CONFIG_H
  10. #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
  11. !defined(__ARM_DWARF_EH__) && !defined(__SEH__)
  12. #define _LIBCXXABI_ARM_EHABI
  13. #endif
  14. #if !defined(__has_attribute)
  15. #define __has_attribute(_attribute_) 0
  16. #endif
  17. #if defined(__clang__)
  18. # define _LIBCXXABI_COMPILER_CLANG
  19. # ifndef __apple_build_version__
  20. # define _LIBCXXABI_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
  21. # endif
  22. #elif defined(__GNUC__)
  23. # define _LIBCXXABI_COMPILER_GCC
  24. #elif defined(_MSC_VER)
  25. # define _LIBCXXABI_COMPILER_MSVC
  26. #elif defined(__IBMCPP__)
  27. # define _LIBCXXABI_COMPILER_IBM
  28. #endif
  29. #if defined(_WIN32)
  30. #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
  31. #define _LIBCXXABI_HIDDEN
  32. #define _LIBCXXABI_DATA_VIS
  33. #define _LIBCXXABI_FUNC_VIS
  34. #define _LIBCXXABI_TYPE_VIS
  35. #elif defined(_LIBCXXABI_BUILDING_LIBRARY)
  36. #define _LIBCXXABI_HIDDEN
  37. #define _LIBCXXABI_DATA_VIS __declspec(dllexport)
  38. #define _LIBCXXABI_FUNC_VIS __declspec(dllexport)
  39. #define _LIBCXXABI_TYPE_VIS __declspec(dllexport)
  40. #else
  41. #define _LIBCXXABI_HIDDEN
  42. #define _LIBCXXABI_DATA_VIS __declspec(dllimport)
  43. #define _LIBCXXABI_FUNC_VIS __declspec(dllimport)
  44. #define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
  45. #endif
  46. #else
  47. #if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
  48. #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
  49. #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
  50. #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
  51. #if __has_attribute(__type_visibility__)
  52. #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
  53. #else
  54. #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
  55. #endif
  56. #else
  57. #define _LIBCXXABI_HIDDEN
  58. #define _LIBCXXABI_DATA_VIS
  59. #define _LIBCXXABI_FUNC_VIS
  60. #define _LIBCXXABI_TYPE_VIS
  61. #endif
  62. #endif
  63. #if defined(_LIBCXXABI_COMPILER_MSVC)
  64. #define _LIBCXXABI_WEAK
  65. #else
  66. #define _LIBCXXABI_WEAK __attribute__((__weak__))
  67. #endif
  68. #if defined(__clang__)
  69. #define _LIBCXXABI_COMPILER_CLANG
  70. #elif defined(__GNUC__)
  71. #define _LIBCXXABI_COMPILER_GCC
  72. #endif
  73. #if __has_attribute(__no_sanitize__) && defined(_LIBCXXABI_COMPILER_CLANG)
  74. #define _LIBCXXABI_NO_CFI __attribute__((__no_sanitize__("cfi")))
  75. #else
  76. #define _LIBCXXABI_NO_CFI
  77. #endif
  78. // wasm32 follows the arm32 ABI convention of using 32-bit guard.
  79. #if defined(__arm__) || defined(__wasm32__) || defined(__ARM64_ARCH_8_32__)
  80. # define _LIBCXXABI_GUARD_ABI_ARM
  81. #endif
  82. #if defined(_LIBCXXABI_COMPILER_CLANG)
  83. # if !__has_feature(cxx_exceptions)
  84. # define _LIBCXXABI_NO_EXCEPTIONS
  85. # endif
  86. #elif defined(_LIBCXXABI_COMPILER_GCC) && !defined(__EXCEPTIONS)
  87. # define _LIBCXXABI_NO_EXCEPTIONS
  88. #endif
  89. #if defined(_WIN32)
  90. #define _LIBCXXABI_DTOR_FUNC __thiscall
  91. #else
  92. #define _LIBCXXABI_DTOR_FUNC
  93. #endif
  94. #endif // ____CXXABI_CONFIG_H