codegear.hpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. // (C) Copyright John Maddock 2001 - 2003.
  2. // (C) Copyright David Abrahams 2002 - 2003.
  3. // (C) Copyright Aleksey Gurtovoy 2002.
  4. // Use, modification and distribution are subject to the
  5. // Boost Software License, Version 1.0. (See accompanying file
  6. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. // See http://www.boost.org for most recent version.
  8. // CodeGear C++ compiler setup:
  9. //
  10. // versions check:
  11. // last known and checked version is 0x740
  12. #if (__CODEGEARC__ > 0x740)
  13. # if defined(BHO_ASSERT_CONFIG)
  14. # error "boost: Unknown compiler version - please run the configure tests and report the results"
  15. # else
  16. # pragma message( "boost: Unknown compiler version - please run the configure tests and report the results")
  17. # endif
  18. #endif
  19. #ifdef __clang__ // Clang enhanced Windows compiler
  20. # include "clang.hpp"
  21. # define BHO_NO_CXX11_THREAD_LOCAL
  22. # define BHO_NO_CXX11_ATOMIC_SMART_PTR
  23. // This bug has been reported to Embarcadero
  24. #if defined(BHO_HAS_INT128)
  25. #undef BHO_HAS_INT128
  26. #endif
  27. #if defined(BHO_HAS_FLOAT128)
  28. #undef BHO_HAS_FLOAT128
  29. #endif
  30. // The clang-based compilers can not do 128 atomic exchanges
  31. #define BHO_ATOMIC_NO_CMPXCHG16B
  32. // 32 functions are missing from the current RTL in cwchar, so it really can not be used even if it exists
  33. # define BHO_NO_CWCHAR
  34. # ifndef __MT__ /* If compiling in single-threaded mode, assume there is no CXX11_HDR_ATOMIC */
  35. # define BHO_NO_CXX11_HDR_ATOMIC
  36. # endif
  37. /* temporarily disable this until we can link against fegetround fesetround feholdexcept */
  38. #define BHO_NO_FENV_H
  39. /* Reported this bug to Embarcadero with the latest C++ Builder Rio release */
  40. #define BHO_NO_CXX11_HDR_EXCEPTION
  41. //
  42. // check for exception handling support:
  43. //
  44. #if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BHO_NO_EXCEPTIONS)
  45. # define BHO_NO_EXCEPTIONS
  46. #endif
  47. /*
  48. // On non-Win32 platforms let the platform config figure this out:
  49. #ifdef _WIN32
  50. # define BHO_HAS_STDINT_H
  51. #endif
  52. //
  53. // __int64:
  54. //
  55. #if !defined(__STRICT_ANSI__)
  56. # define BHO_HAS_MS_INT64
  57. #endif
  58. //
  59. // all versions have a <dirent.h>:
  60. //
  61. #if !defined(__STRICT_ANSI__)
  62. # define BHO_HAS_DIRENT_H
  63. #endif
  64. //
  65. // Disable Win32 support in ANSI mode:
  66. //
  67. # pragma defineonoption BHO_DISABLE_WIN32 -A
  68. //
  69. // MSVC compatibility mode does some nasty things:
  70. // TODO: look up if this doesn't apply to the whole 12xx range
  71. //
  72. #if defined(_MSC_VER) && (_MSC_VER <= 1200)
  73. # define BHO_NO_ARGUMENT_DEPENDENT_LOOKUP
  74. # define BHO_NO_VOID_RETURNS
  75. #endif
  76. //
  77. */
  78. // Specific settings for Embarcadero drivers
  79. # define BHO_EMBTC __CODEGEARC__
  80. # define BHO_EMBTC_FULL_VER ((__clang_major__ << 16) | \
  81. (__clang_minor__ << 8) | \
  82. __clang_patchlevel__ )
  83. // Detecting which Embarcadero driver is being used
  84. #if defined(BHO_EMBTC)
  85. # if defined(_WIN64)
  86. # define BHO_EMBTC_WIN64 1
  87. # define BHO_EMBTC_WINDOWS 1
  88. # ifndef BHO_USE_WINDOWS_H
  89. # define BHO_USE_WINDOWS_H
  90. # endif
  91. # elif defined(_WIN32)
  92. # define BHO_EMBTC_WIN32C 1
  93. # define BHO_EMBTC_WINDOWS 1
  94. # ifndef BHO_USE_WINDOWS_H
  95. # define BHO_USE_WINDOWS_H
  96. # endif
  97. # elif defined(__APPLE__) && defined(__arm__)
  98. # define BHO_EMBTC_IOSARM 1
  99. # define BHO_EMBTC_IOS 1
  100. # elif defined(__APPLE__) && defined(__aarch64__)
  101. # define BHO_EMBTC_IOSARM64 1
  102. # define BHO_EMBTC_IOS 1
  103. # elif defined(__ANDROID__) && defined(__arm__)
  104. # define BHO_EMBTC_AARM 1
  105. # define BHO_EMBTC_ANDROID 1
  106. # elif
  107. # if defined(BHO_ASSERT_CONFIG)
  108. # error "Unknown Embarcadero driver"
  109. # else
  110. # warning "Unknown Embarcadero driver"
  111. # endif /* defined(BHO_ASSERT_CONFIG) */
  112. # endif
  113. #endif /* defined(BHO_EMBTC) */
  114. #if defined(BHO_EMBTC_WINDOWS)
  115. #if !defined(_chdir)
  116. #define _chdir(x) chdir(x)
  117. #endif
  118. #if !defined(_dup2)
  119. #define _dup2(x,y) dup2(x,y)
  120. #endif
  121. #endif
  122. # undef BHO_COMPILER
  123. # define BHO_COMPILER "Embarcadero-Clang C++ version " BHO_STRINGIZE(__CODEGEARC__) " clang: " __clang_version__
  124. // # define __CODEGEARC_CLANG__ __CODEGEARC__
  125. // # define __EMBARCADERO_CLANG__ __CODEGEARC__
  126. // # define __BORLANDC_CLANG__ __BORLANDC__
  127. #else // #if !defined(__clang__)
  128. # define BHO_CODEGEARC __CODEGEARC__
  129. # define BHO_BORLANDC __BORLANDC__
  130. #if !defined( BHO_WITH_CODEGEAR_WARNINGS )
  131. // these warnings occur frequently in optimized template code
  132. # pragma warn -8004 // var assigned value, but never used
  133. # pragma warn -8008 // condition always true/false
  134. # pragma warn -8066 // dead code can never execute
  135. # pragma warn -8104 // static members with ctors not threadsafe
  136. # pragma warn -8105 // reference member in class without ctors
  137. #endif
  138. // CodeGear C++ Builder 2009
  139. #if (__CODEGEARC__ <= 0x613)
  140. # define BHO_NO_INTEGRAL_INT64_T
  141. # define BHO_NO_DEPENDENT_NESTED_DERIVATIONS
  142. # define BHO_NO_PRIVATE_IN_AGGREGATE
  143. # define BHO_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
  144. // we shouldn't really need this - but too many things choke
  145. // without it, this needs more investigation:
  146. # define BHO_NO_LIMITS_COMPILE_TIME_CONSTANTS
  147. # define BHO_SP_NO_SP_CONVERTIBLE
  148. #endif
  149. // CodeGear C++ Builder 2010
  150. #if (__CODEGEARC__ <= 0x621)
  151. # define BHO_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
  152. # define BHO_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
  153. # define BHO_NO_MEMBER_TEMPLATE_FRIENDS
  154. # define BHO_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
  155. # define BHO_NO_USING_TEMPLATE
  156. # define BHO_NO_TWO_PHASE_NAME_LOOKUP
  157. // Temporary hack, until specific MPL preprocessed headers are generated
  158. # define BHO_MPL_CFG_NO_PREPROCESSED_HEADERS
  159. // CodeGear has not yet completely implemented value-initialization, for
  160. // example for array types, as I reported in 2010: Embarcadero Report 83751,
  161. // "Value-initialization: arrays should have each element value-initialized",
  162. // http://qc.embarcadero.com/wc/qcmain.aspx?d=83751
  163. // Last checked version: Embarcadero C++ 6.21
  164. // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
  165. // (Niels Dekker, LKEB, April 2010)
  166. # define BHO_NO_COMPLETE_VALUE_INITIALIZATION
  167. # if defined(NDEBUG) && defined(__cplusplus)
  168. // fix broken <cstring> so that BHO.test works:
  169. # include <cstring>
  170. # undef strcmp
  171. # endif
  172. // fix broken errno declaration:
  173. # include <errno.h>
  174. # ifndef errno
  175. # define errno errno
  176. # endif
  177. #endif
  178. // Reportedly, #pragma once is supported since C++ Builder 2010
  179. #if (__CODEGEARC__ >= 0x620)
  180. # define BHO_HAS_PRAGMA_ONCE
  181. #endif
  182. #define BHO_NO_FENV_H
  183. //
  184. // C++0x macros:
  185. //
  186. #if (__CODEGEARC__ <= 0x620)
  187. #define BHO_NO_CXX11_STATIC_ASSERT
  188. #else
  189. #define BHO_HAS_STATIC_ASSERT
  190. #endif
  191. #define BHO_HAS_CHAR16_T
  192. #define BHO_HAS_CHAR32_T
  193. #define BHO_HAS_LONG_LONG
  194. // #define BHO_HAS_ALIGNOF
  195. #define BHO_HAS_DECLTYPE
  196. #define BHO_HAS_EXPLICIT_CONVERSION_OPS
  197. // #define BHO_HAS_RVALUE_REFS
  198. #define BHO_HAS_SCOPED_ENUM
  199. // #define BHO_HAS_STATIC_ASSERT
  200. #define BHO_HAS_STD_TYPE_TRAITS
  201. #define BHO_NO_CXX11_AUTO_DECLARATIONS
  202. #define BHO_NO_CXX11_AUTO_MULTIDECLARATIONS
  203. #define BHO_NO_CXX11_CONSTEXPR
  204. #define BHO_NO_CXX11_DEFAULTED_FUNCTIONS
  205. #define BHO_NO_CXX11_DELETED_FUNCTIONS
  206. #define BHO_NO_CXX11_EXTERN_TEMPLATE
  207. #define BHO_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  208. #define BHO_NO_CXX11_LAMBDAS
  209. #define BHO_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  210. #define BHO_NO_CXX11_NOEXCEPT
  211. #define BHO_NO_CXX11_NULLPTR
  212. #define BHO_NO_CXX11_RANGE_BASED_FOR
  213. #define BHO_NO_CXX11_RAW_LITERALS
  214. #define BHO_NO_CXX11_RVALUE_REFERENCES
  215. #define BHO_NO_SFINAE_EXPR
  216. #define BHO_NO_CXX11_SFINAE_EXPR
  217. #define BHO_NO_CXX11_TEMPLATE_ALIASES
  218. #define BHO_NO_CXX11_UNICODE_LITERALS
  219. #define BHO_NO_CXX11_VARIADIC_TEMPLATES
  220. #define BHO_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  221. #define BHO_NO_CXX11_USER_DEFINED_LITERALS
  222. #define BHO_NO_CXX11_ALIGNAS
  223. #define BHO_NO_CXX11_ALIGNOF
  224. #define BHO_NO_CXX11_TRAILING_RESULT_TYPES
  225. #define BHO_NO_CXX11_INLINE_NAMESPACES
  226. #define BHO_NO_CXX11_REF_QUALIFIERS
  227. #define BHO_NO_CXX11_FINAL
  228. #define BHO_NO_CXX11_OVERRIDE
  229. #define BHO_NO_CXX11_THREAD_LOCAL
  230. #define BHO_NO_CXX11_DECLTYPE_N3276
  231. #define BHO_NO_CXX11_UNRESTRICTED_UNION
  232. // C++ 14:
  233. #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
  234. # define BHO_NO_CXX14_AGGREGATE_NSDMI
  235. #endif
  236. #if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
  237. # define BHO_NO_CXX14_BINARY_LITERALS
  238. #endif
  239. #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
  240. # define BHO_NO_CXX14_CONSTEXPR
  241. #endif
  242. #if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
  243. # define BHO_NO_CXX14_DECLTYPE_AUTO
  244. #endif
  245. #if (__cplusplus < 201304) // There's no SD6 check for this....
  246. # define BHO_NO_CXX14_DIGIT_SEPARATORS
  247. #endif
  248. #if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
  249. # define BHO_NO_CXX14_GENERIC_LAMBDAS
  250. #endif
  251. #if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
  252. # define BHO_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
  253. #endif
  254. #if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
  255. # define BHO_NO_CXX14_RETURN_TYPE_DEDUCTION
  256. #endif
  257. #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
  258. # define BHO_NO_CXX14_VARIABLE_TEMPLATES
  259. #endif
  260. // C++17
  261. #if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606)
  262. # define BHO_NO_CXX17_STRUCTURED_BINDINGS
  263. #endif
  264. #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606)
  265. # define BHO_NO_CXX17_INLINE_VARIABLES
  266. #endif
  267. #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603)
  268. # define BHO_NO_CXX17_FOLD_EXPRESSIONS
  269. #endif
  270. #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
  271. # define BHO_NO_CXX17_IF_CONSTEXPR
  272. #endif
  273. //
  274. // TR1 macros:
  275. //
  276. #define BHO_HAS_TR1_HASH
  277. #define BHO_HAS_TR1_TYPE_TRAITS
  278. #define BHO_HAS_TR1_UNORDERED_MAP
  279. #define BHO_HAS_TR1_UNORDERED_SET
  280. #define BHO_HAS_MACRO_USE_FACET
  281. #define BHO_NO_CXX11_HDR_INITIALIZER_LIST
  282. // On non-Win32 platforms let the platform config figure this out:
  283. #ifdef _WIN32
  284. # define BHO_HAS_STDINT_H
  285. #endif
  286. //
  287. // __int64:
  288. //
  289. #if !defined(__STRICT_ANSI__)
  290. # define BHO_HAS_MS_INT64
  291. #endif
  292. //
  293. // check for exception handling support:
  294. //
  295. #if !defined(_CPPUNWIND) && !defined(BHO_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BHO_NO_EXCEPTIONS)
  296. # define BHO_NO_EXCEPTIONS
  297. #endif
  298. //
  299. // all versions have a <dirent.h>:
  300. //
  301. #if !defined(__STRICT_ANSI__)
  302. # define BHO_HAS_DIRENT_H
  303. #endif
  304. //
  305. // all versions support __declspec:
  306. //
  307. #if defined(__STRICT_ANSI__)
  308. // config/platform/win32.hpp will define BHO_SYMBOL_EXPORT, etc., unless already defined
  309. # define BHO_SYMBOL_EXPORT
  310. #endif
  311. //
  312. // ABI fixing headers:
  313. //
  314. #ifndef BHO_ABI_PREFIX
  315. # define BHO_ABI_PREFIX "asio2/bho/config/abi/borland_prefix.hpp"
  316. #endif
  317. #ifndef BHO_ABI_SUFFIX
  318. # define BHO_ABI_SUFFIX "asio2/bho/config/abi/borland_suffix.hpp"
  319. #endif
  320. //
  321. // Disable Win32 support in ANSI mode:
  322. //
  323. # pragma defineonoption BHO_DISABLE_WIN32 -A
  324. //
  325. // MSVC compatibility mode does some nasty things:
  326. // TODO: look up if this doesn't apply to the whole 12xx range
  327. //
  328. #if defined(_MSC_VER) && (_MSC_VER <= 1200)
  329. # define BHO_NO_ARGUMENT_DEPENDENT_LOOKUP
  330. # define BHO_NO_VOID_RETURNS
  331. #endif
  332. #define BHO_COMPILER "CodeGear C++ version " BHO_STRINGIZE(__CODEGEARC__)
  333. #endif // #if !defined(__clang__)