borland.hpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. // Borland C++ compiler setup:
  9. //
  10. // versions check:
  11. // we don't support Borland prior to version 5.4:
  12. #if __BORLANDC__ < 0x540
  13. # error "Compiler not supported or configured - please reconfigure"
  14. #endif
  15. // last known compiler version:
  16. #if (__BORLANDC__ > 0x613)
  17. //# if defined(BOOST_ASSERT_CONFIG)
  18. # error "boost: Unknown compiler version - please run the configure tests and report the results"
  19. //# else
  20. //# pragma message( "boost: Unknown compiler version - please run the configure tests and report the results")
  21. //# endif
  22. #elif (__BORLANDC__ == 0x600)
  23. # error "CBuilderX preview compiler is no longer supported"
  24. #endif
  25. //
  26. // Support macros to help with standard library detection
  27. #if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL)
  28. # define BOOST_BCB_WITH_ROGUE_WAVE
  29. #elif __BORLANDC__ < 0x570
  30. # define BOOST_BCB_WITH_STLPORT
  31. #else
  32. # define BOOST_BCB_WITH_DINKUMWARE
  33. #endif
  34. //
  35. // Version 5.0 and below:
  36. # if __BORLANDC__ <= 0x0550
  37. // Borland C++Builder 4 and 5:
  38. # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  39. # if __BORLANDC__ == 0x0550
  40. // Borland C++Builder 5, command-line compiler 5.5:
  41. # define BOOST_NO_OPERATORS_IN_NAMESPACE
  42. # endif
  43. // Variadic macros do not exist for C++ Builder versions 5 and below
  44. #define BOOST_NO_CXX11_VARIADIC_MACROS
  45. # endif
  46. // Version 5.51 and below:
  47. #if (__BORLANDC__ <= 0x551)
  48. # define BOOST_NO_CV_SPECIALIZATIONS
  49. # define BOOST_NO_CV_VOID_SPECIALIZATIONS
  50. # define BOOST_NO_DEDUCED_TYPENAME
  51. // workaround for missing WCHAR_MAX/WCHAR_MIN:
  52. #ifdef __cplusplus
  53. #include <climits>
  54. #include <cwchar>
  55. #else
  56. #include <limits.h>
  57. #include <wchar.h>
  58. #endif // __cplusplus
  59. #ifndef WCHAR_MAX
  60. # define WCHAR_MAX 0xffff
  61. #endif
  62. #ifndef WCHAR_MIN
  63. # define WCHAR_MIN 0
  64. #endif
  65. #endif
  66. // Borland C++ Builder 6 and below:
  67. #if (__BORLANDC__ <= 0x564)
  68. # if defined(NDEBUG) && defined(__cplusplus)
  69. // fix broken <cstring> so that Boost.test works:
  70. # include <cstring>
  71. # undef strcmp
  72. # endif
  73. // fix broken errno declaration:
  74. # include <errno.h>
  75. # ifndef errno
  76. # define errno errno
  77. # endif
  78. #endif
  79. //
  80. // new bug in 5.61:
  81. #if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580)
  82. // this seems to be needed by the command line compiler, but not the IDE:
  83. # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
  84. #endif
  85. // Borland C++ Builder 2006 Update 2 and below:
  86. #if (__BORLANDC__ <= 0x582)
  87. # define BOOST_NO_SFINAE
  88. # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
  89. # define BOOST_NO_TEMPLATE_TEMPLATES
  90. # define BOOST_NO_PRIVATE_IN_AGGREGATE
  91. # ifdef _WIN32
  92. # define BOOST_NO_SWPRINTF
  93. # elif defined(linux) || defined(__linux__) || defined(__linux)
  94. // we should really be able to do without this
  95. // but the wcs* functions aren't imported into std::
  96. # define BOOST_NO_STDC_NAMESPACE
  97. // _CPPUNWIND doesn't get automatically set for some reason:
  98. # pragma defineonoption BOOST_CPPUNWIND -x
  99. # endif
  100. #endif
  101. #if (__BORLANDC__ <= 0x613) // Beman has asked Alisdair for more info
  102. // we shouldn't really need this - but too many things choke
  103. // without it, this needs more investigation:
  104. # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
  105. # define BOOST_NO_IS_ABSTRACT
  106. # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS
  107. # define BOOST_NO_USING_TEMPLATE
  108. # define BOOST_SP_NO_SP_CONVERTIBLE
  109. // Temporary workaround
  110. #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
  111. #endif
  112. // Borland C++ Builder 2008 and below:
  113. # define BOOST_NO_INTEGRAL_INT64_T
  114. # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
  115. # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
  116. # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  117. # define BOOST_NO_TWO_PHASE_NAME_LOOKUP
  118. # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
  119. # define BOOST_NO_NESTED_FRIENDSHIP
  120. # define BOOST_NO_TYPENAME_WITH_CTOR
  121. #if (__BORLANDC__ < 0x600)
  122. # define BOOST_ILLEGAL_CV_REFERENCES
  123. #endif
  124. //
  125. // Positive Feature detection
  126. //
  127. // Borland C++ Builder 2008 and below:
  128. #if (__BORLANDC__ >= 0x599)
  129. # pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax
  130. #endif
  131. //
  132. // C++0x Macros:
  133. //
  134. #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610)
  135. # define BOOST_NO_CXX11_CHAR16_T
  136. # define BOOST_NO_CXX11_CHAR32_T
  137. # define BOOST_NO_CXX11_DECLTYPE
  138. # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  139. # define BOOST_NO_CXX11_EXTERN_TEMPLATE
  140. # define BOOST_NO_CXX11_RVALUE_REFERENCES
  141. # define BOOST_NO_CXX11_SCOPED_ENUMS
  142. # define BOOST_NO_CXX11_STATIC_ASSERT
  143. #else
  144. # define BOOST_HAS_ALIGNOF
  145. # define BOOST_HAS_CHAR16_T
  146. # define BOOST_HAS_CHAR32_T
  147. # define BOOST_HAS_DECLTYPE
  148. # define BOOST_HAS_EXPLICIT_CONVERSION_OPS
  149. # define BOOST_HAS_REF_QUALIFIER
  150. # define BOOST_HAS_RVALUE_REFS
  151. # define BOOST_HAS_STATIC_ASSERT
  152. #endif
  153. #define BOOST_NO_CXX11_AUTO_DECLARATIONS
  154. #define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  155. #define BOOST_NO_CXX11_CONSTEXPR
  156. #define BOOST_NO_CXX11_DECLTYPE_N3276
  157. #define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  158. #define BOOST_NO_CXX11_DEFAULTED_MOVES
  159. #define BOOST_NO_CXX11_DELETED_FUNCTIONS
  160. #define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  161. #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  162. #define BOOST_NO_CXX11_LAMBDAS
  163. #define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  164. #define BOOST_NO_CXX11_NULLPTR
  165. #define BOOST_NO_CXX11_RANGE_BASED_FOR
  166. #define BOOST_NO_CXX11_RAW_LITERALS
  167. #define BOOST_NO_CXX11_RVALUE_REFERENCES
  168. #define BOOST_NO_CXX11_SCOPED_ENUMS
  169. #define BOOST_NO_SFINAE_EXPR
  170. #define BOOST_NO_CXX11_SFINAE_EXPR
  171. #define BOOST_NO_CXX11_TEMPLATE_ALIASES
  172. #define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported
  173. #define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  174. #define BOOST_NO_CXX11_NOEXCEPT
  175. #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  176. #define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  177. #define BOOST_NO_CXX11_ALIGNAS
  178. #define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  179. #define BOOST_NO_CXX11_INLINE_NAMESPACES
  180. #define BOOST_NO_CXX11_REF_QUALIFIERS
  181. #define BOOST_NO_CXX11_FINAL
  182. #define BOOST_NO_CXX11_THREAD_LOCAL
  183. // C++ 14:
  184. #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
  185. # define BOOST_NO_CXX14_AGGREGATE_NSDMI
  186. #endif
  187. #if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
  188. # define BOOST_NO_CXX14_BINARY_LITERALS
  189. #endif
  190. #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
  191. # define BOOST_NO_CXX14_CONSTEXPR
  192. #endif
  193. #if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
  194. # define BOOST_NO_CXX14_DECLTYPE_AUTO
  195. #endif
  196. #if (__cplusplus < 201304) // There's no SD6 check for this....
  197. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  198. #endif
  199. #if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
  200. # define BOOST_NO_CXX14_GENERIC_LAMBDAS
  201. #endif
  202. #if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
  203. # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
  204. #endif
  205. #if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
  206. # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
  207. #endif
  208. #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
  209. # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
  210. #endif
  211. // C++17
  212. #if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606)
  213. # define BOOST_NO_CXX17_STRUCTURED_BINDINGS
  214. #endif
  215. #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606)
  216. # define BOOST_NO_CXX17_INLINE_VARIABLES
  217. #endif
  218. #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603)
  219. # define BOOST_NO_CXX17_FOLD_EXPRESSIONS
  220. #endif
  221. #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
  222. # define BOOST_NO_CXX17_IF_CONSTEXPR
  223. #endif
  224. #if __BORLANDC__ >= 0x590
  225. # define BOOST_HAS_TR1_HASH
  226. # define BOOST_HAS_MACRO_USE_FACET
  227. #endif
  228. //
  229. // Post 0x561 we have long long and stdint.h:
  230. #if __BORLANDC__ >= 0x561
  231. # ifndef __NO_LONG_LONG
  232. # define BOOST_HAS_LONG_LONG
  233. # else
  234. # define BOOST_NO_LONG_LONG
  235. # endif
  236. // On non-Win32 platforms let the platform config figure this out:
  237. # ifdef _WIN32
  238. # define BOOST_HAS_STDINT_H
  239. # endif
  240. #endif
  241. // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is
  242. // defined, then we have 0x560 or greater with the Rogue Wave implementation
  243. // which presumably has the std::DBL_MAX bug.
  244. #if defined( BOOST_BCB_WITH_ROGUE_WAVE )
  245. // <climits> is partly broken, some macros define symbols that are really in
  246. // namespace std, so you end up having to use illegal constructs like
  247. // std::DBL_MAX, as a fix we'll just include float.h and have done with:
  248. #include <float.h>
  249. #endif
  250. //
  251. // __int64:
  252. //
  253. #if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__)
  254. # define BOOST_HAS_MS_INT64
  255. #endif
  256. //
  257. // check for exception handling support:
  258. //
  259. #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
  260. # define BOOST_NO_EXCEPTIONS
  261. #endif
  262. //
  263. // all versions have a <dirent.h>:
  264. //
  265. #ifndef __STRICT_ANSI__
  266. # define BOOST_HAS_DIRENT_H
  267. #endif
  268. //
  269. // all versions support __declspec:
  270. //
  271. #if defined(__STRICT_ANSI__)
  272. // config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
  273. # define BOOST_SYMBOL_EXPORT
  274. #endif
  275. //
  276. // ABI fixing headers:
  277. //
  278. #if __BORLANDC__ != 0x600 // not implemented for version 6 compiler yet
  279. #ifndef BOOST_ABI_PREFIX
  280. # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
  281. #endif
  282. #ifndef BOOST_ABI_SUFFIX
  283. # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
  284. #endif
  285. #endif
  286. //
  287. // Disable Win32 support in ANSI mode:
  288. //
  289. #if __BORLANDC__ < 0x600
  290. # pragma defineonoption BOOST_DISABLE_WIN32 -A
  291. #elif defined(__STRICT_ANSI__)
  292. # define BOOST_DISABLE_WIN32
  293. #endif
  294. //
  295. // MSVC compatibility mode does some nasty things:
  296. // TODO: look up if this doesn't apply to the whole 12xx range
  297. //
  298. #if defined(_MSC_VER) && (_MSC_VER <= 1200)
  299. # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  300. # define BOOST_NO_VOID_RETURNS
  301. #endif
  302. // Borland did not implement value-initialization completely, as I reported
  303. // in 2007, Borland Report 51854, "Value-initialization: POD struct should be
  304. // zero-initialized", http://qc.embarcadero.com/wc/qcmain.aspx?d=51854
  305. // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
  306. // (Niels Dekker, LKEB, April 2010)
  307. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  308. #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__)