clang.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. // (C) Copyright Douglas Gregor 2010
  2. //
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org for most recent version.
  7. // Clang compiler setup.
  8. #define BOOST_HAS_PRAGMA_ONCE
  9. #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
  10. # define BOOST_NO_EXCEPTIONS
  11. #endif
  12. #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
  13. # define BOOST_NO_RTTI
  14. #endif
  15. #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
  16. # define BOOST_NO_TYPEID
  17. #endif
  18. #if defined(__int64) && !defined(__GNUC__)
  19. # define BOOST_HAS_MS_INT64
  20. #endif
  21. #define BOOST_HAS_NRVO
  22. // Branch prediction hints
  23. #if defined(__has_builtin)
  24. #if __has_builtin(__builtin_expect)
  25. #define BOOST_LIKELY(x) __builtin_expect(x, 1)
  26. #define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
  27. #endif
  28. #endif
  29. // Clang supports "long long" in all compilation modes.
  30. #define BOOST_HAS_LONG_LONG
  31. //
  32. // Dynamic shared object (DSO) and dynamic-link library (DLL) support
  33. //
  34. #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
  35. # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
  36. # define BOOST_SYMBOL_IMPORT
  37. # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
  38. #endif
  39. //
  40. // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
  41. // between switch labels.
  42. //
  43. #if __cplusplus >= 201103L && defined(__has_warning)
  44. # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
  45. # define BOOST_FALLTHROUGH [[clang::fallthrough]]
  46. # endif
  47. #endif
  48. #if !__has_feature(cxx_auto_type)
  49. # define BOOST_NO_CXX11_AUTO_DECLARATIONS
  50. # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  51. #endif
  52. #if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
  53. # define BOOST_NO_CXX11_CHAR16_T
  54. # define BOOST_NO_CXX11_CHAR32_T
  55. #endif
  56. #if !__has_feature(cxx_constexpr)
  57. # define BOOST_NO_CXX11_CONSTEXPR
  58. #endif
  59. #if !__has_feature(cxx_decltype)
  60. # define BOOST_NO_CXX11_DECLTYPE
  61. #endif
  62. #if !__has_feature(cxx_decltype_incomplete_return_types)
  63. # define BOOST_NO_CXX11_DECLTYPE_N3276
  64. #endif
  65. #if !__has_feature(cxx_defaulted_functions)
  66. # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  67. #endif
  68. #if !__has_feature(cxx_deleted_functions)
  69. # define BOOST_NO_CXX11_DELETED_FUNCTIONS
  70. #endif
  71. #if !__has_feature(cxx_explicit_conversions)
  72. # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  73. #endif
  74. #if !__has_feature(cxx_default_function_template_args)
  75. # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  76. #endif
  77. #if !__has_feature(cxx_generalized_initializers)
  78. # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  79. #endif
  80. #if !__has_feature(cxx_lambdas)
  81. # define BOOST_NO_CXX11_LAMBDAS
  82. #endif
  83. #if !__has_feature(cxx_local_type_template_args)
  84. # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  85. #endif
  86. #if !__has_feature(cxx_noexcept)
  87. # define BOOST_NO_CXX11_NOEXCEPT
  88. #endif
  89. #if !__has_feature(cxx_nullptr)
  90. # define BOOST_NO_CXX11_NULLPTR
  91. #endif
  92. #if !__has_feature(cxx_range_for)
  93. # define BOOST_NO_CXX11_RANGE_BASED_FOR
  94. #endif
  95. #if !__has_feature(cxx_raw_string_literals)
  96. # define BOOST_NO_CXX11_RAW_LITERALS
  97. #endif
  98. #if !__has_feature(cxx_generalized_initializers)
  99. # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  100. #endif
  101. #if !__has_feature(cxx_rvalue_references)
  102. # define BOOST_NO_CXX11_RVALUE_REFERENCES
  103. #endif
  104. #if !__has_feature(cxx_strong_enums)
  105. # define BOOST_NO_CXX11_SCOPED_ENUMS
  106. #endif
  107. #if !__has_feature(cxx_static_assert)
  108. # define BOOST_NO_CXX11_STATIC_ASSERT
  109. #endif
  110. #if !__has_feature(cxx_alias_templates)
  111. # define BOOST_NO_CXX11_TEMPLATE_ALIASES
  112. #endif
  113. #if !__has_feature(cxx_unicode_literals)
  114. # define BOOST_NO_CXX11_UNICODE_LITERALS
  115. #endif
  116. #if !__has_feature(cxx_variadic_templates)
  117. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  118. #endif
  119. #if !__has_feature(cxx_user_literals)
  120. # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  121. #endif
  122. #if !(__has_feature(cxx_alignas) || __has_extension(cxx_alignas))
  123. # define BOOST_NO_CXX11_ALIGNAS
  124. #endif
  125. #if !__has_feature(cxx_trailing_return)
  126. # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  127. #endif
  128. #if !__has_feature(cxx_inline_namespaces)
  129. # define BOOST_NO_CXX11_INLINE_NAMESPACES
  130. #endif
  131. // Clang always supports variadic macros
  132. // Clang always supports extern templates
  133. #ifndef BOOST_COMPILER
  134. # define BOOST_COMPILER "Clang version " __clang_version__
  135. #endif
  136. // Macro used to identify the Clang compiler.
  137. #define BOOST_CLANG 1