borland.hpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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_OVERRIDE
  183. #define BOOST_NO_CXX11_THREAD_LOCAL
  184. #define BOOST_NO_CXX11_UNRESTRICTED_UNION
  185. // C++ 14:
  186. #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
  187. # define BOOST_NO_CXX14_AGGREGATE_NSDMI
  188. #endif
  189. #if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
  190. # define BOOST_NO_CXX14_BINARY_LITERALS
  191. #endif
  192. #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
  193. # define BOOST_NO_CXX14_CONSTEXPR
  194. #endif
  195. #if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
  196. # define BOOST_NO_CXX14_DECLTYPE_AUTO
  197. #endif
  198. #if (__cplusplus < 201304) // There's no SD6 check for this....
  199. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  200. #endif
  201. #if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
  202. # define BOOST_NO_CXX14_GENERIC_LAMBDAS
  203. #endif
  204. #if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
  205. # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
  206. #endif
  207. #if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
  208. # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
  209. #endif
  210. #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
  211. # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
  212. #endif
  213. // C++17
  214. #if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606)
  215. # define BOOST_NO_CXX17_STRUCTURED_BINDINGS
  216. #endif
  217. #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606)
  218. # define BOOST_NO_CXX17_INLINE_VARIABLES
  219. #endif
  220. #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603)
  221. # define BOOST_NO_CXX17_FOLD_EXPRESSIONS
  222. #endif
  223. #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
  224. # define BOOST_NO_CXX17_IF_CONSTEXPR
  225. #endif
  226. #if __BORLANDC__ >= 0x590
  227. # define BOOST_HAS_TR1_HASH
  228. # define BOOST_HAS_MACRO_USE_FACET
  229. #endif
  230. //
  231. // Post 0x561 we have long long and stdint.h:
  232. #if __BORLANDC__ >= 0x561
  233. # ifndef __NO_LONG_LONG
  234. # define BOOST_HAS_LONG_LONG
  235. # else
  236. # define BOOST_NO_LONG_LONG
  237. # endif
  238. // On non-Win32 platforms let the platform config figure this out:
  239. # ifdef _WIN32
  240. # define BOOST_HAS_STDINT_H
  241. # endif
  242. #endif
  243. // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is
  244. // defined, then we have 0x560 or greater with the Rogue Wave implementation
  245. // which presumably has the std::DBL_MAX bug.
  246. #if defined( BOOST_BCB_WITH_ROGUE_WAVE )
  247. // <climits> is partly broken, some macros define symbols that are really in
  248. // namespace std, so you end up having to use illegal constructs like
  249. // std::DBL_MAX, as a fix we'll just include float.h and have done with:
  250. #include <float.h>
  251. #endif
  252. //
  253. // __int64:
  254. //
  255. #if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__)
  256. # define BOOST_HAS_MS_INT64
  257. #endif
  258. //
  259. // check for exception handling support:
  260. //
  261. #if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
  262. # define BOOST_NO_EXCEPTIONS
  263. #endif
  264. //
  265. // all versions have a <dirent.h>:
  266. //
  267. #ifndef __STRICT_ANSI__
  268. # define BOOST_HAS_DIRENT_H
  269. #endif
  270. //
  271. // all versions support __declspec:
  272. //
  273. #if defined(__STRICT_ANSI__)
  274. // config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
  275. # define BOOST_SYMBOL_EXPORT
  276. #endif
  277. //
  278. // ABI fixing headers:
  279. //
  280. #if __BORLANDC__ != 0x600 // not implemented for version 6 compiler yet
  281. #ifndef BOOST_ABI_PREFIX
  282. # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
  283. #endif
  284. #ifndef BOOST_ABI_SUFFIX
  285. # define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
  286. #endif
  287. #endif
  288. //
  289. // Disable Win32 support in ANSI mode:
  290. //
  291. #if __BORLANDC__ < 0x600
  292. # pragma defineonoption BOOST_DISABLE_WIN32 -A
  293. #elif defined(__STRICT_ANSI__)
  294. # define BOOST_DISABLE_WIN32
  295. #endif
  296. //
  297. // MSVC compatibility mode does some nasty things:
  298. // TODO: look up if this doesn't apply to the whole 12xx range
  299. //
  300. #if defined(_MSC_VER) && (_MSC_VER <= 1200)
  301. # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  302. # define BOOST_NO_VOID_RETURNS
  303. #endif
  304. // Borland did not implement value-initialization completely, as I reported
  305. // in 2007, Borland Report 51854, "Value-initialization: POD struct should be
  306. // zero-initialized", http://qc.embarcadero.com/wc/qcmain.aspx?d=51854
  307. // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
  308. // (Niels Dekker, LKEB, April 2010)
  309. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  310. #define BOOST_BORLANDC __BORLANDC__
  311. #define BOOST_COMPILER "Classic Borland C++ version " BOOST_STRINGIZE(__BORLANDC__)