You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
13 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/internal/cccap/borland.h
  3. *
  4. * Purpose: Compiler feature discrimination for Borland C/C++.
  5. *
  6. * Created: 7th February 2003
  7. * Updated: 3rd February 2012
  8. *
  9. * Thanks to: markitus82 for pointing out overlooking of support for
  10. * __FUNCTION__.
  11. *
  12. * Home: http://stlsoft.org/
  13. *
  14. * Copyright (c) 2003-2012, Matthew Wilson and Synesis Software
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without
  18. * modification, are permitted provided that the following conditions are met:
  19. *
  20. * - Redistributions of source code must retain the above copyright notice, this
  21. * list of conditions and the following disclaimer.
  22. * - Redistributions in binary form must reproduce the above copyright notice,
  23. * this list of conditions and the following disclaimer in the documentation
  24. * and/or other materials provided with the distribution.
  25. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  26. * any contributors may be used to endorse or promote products derived from
  27. * this software without specific prior written permission.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  30. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  33. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  34. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  35. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  36. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  37. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  38. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  39. * POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. * ////////////////////////////////////////////////////////////////////// */
  42. #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
  43. # error This file must not be included independently of stlsoft/stlsoft.h
  44. #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
  45. /** \file stlsoft/internal/cccap/borland.h
  46. *
  47. * Compiler feature discrimination for Borland C/C++
  48. * (\ref group__library__internal).
  49. */
  50. #ifdef STLSOFT_INCL_H_STLSOFT_CCCAP_BORLAND
  51. # error This file cannot be included more than once in any compilation unit
  52. #endif /* STLSOFT_INCL_H_STLSOFT_CCCAP_BORLAND */
  53. /* ////////////////////////////////////////////////////////////////////// */
  54. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  55. # define STLSOFT_VER_H_STLSOFT_CCCAP_BORLAND_MAJOR 3
  56. # define STLSOFT_VER_H_STLSOFT_CCCAP_BORLAND_MINOR 18
  57. # define STLSOFT_VER_H_STLSOFT_CCCAP_BORLAND_REVISION 2
  58. # define STLSOFT_VER_H_STLSOFT_CCCAP_BORLAND_EDIT 84
  59. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  60. /* /////////////////////////////////////////////////////////////////////////
  61. * Auto-generation and compatibility
  62. */
  63. /*
  64. [<[STLSOFT-AUTO:NO-DOCFILELABEL]>]
  65. [<[STLSOFT-AUTO:NO-UNITTEST]>]
  66. */
  67. /* /////////////////////////////////////////////////////////////////////////
  68. * Compiler features
  69. */
  70. /* Messaging
  71. */
  72. #define STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT
  73. /* Support for #pragma once
  74. */
  75. #if (__BORLANDC__ & 0xfff0) >= 0x0580
  76. # define STLSOFT_CF_PRAGMA_ONCE_SUPPORT
  77. #endif /* __BORLANDC__ */
  78. /* Variadic Macros
  79. */
  80. /* Support for __FUNCTION__
  81. */
  82. /* #define STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT */
  83. /* Variadic Macros
  84. */
  85. #if (__BORLANDC__ & 0xfff0) >= 0x0580
  86. # define STLSOFT_CF_SUPPORTS_VARIADIC_MACROS
  87. #endif /* __BORLANDC__ */
  88. /* Types:
  89. */
  90. /* bool */
  91. #ifdef __cplusplus
  92. # define STLSOFT_CF_NATIVE_BOOL_SUPPORT
  93. #endif /* __cplusplus */
  94. /* char (sign) */
  95. #ifdef _CHAR_UNSIGNED
  96. # define STLSOFT_CF_CHAR_IS_UNSIGNED
  97. #endif /* _CHAR_UNSIGNED */
  98. /* wchar_t */
  99. #ifdef _WCHAR_T_DEFINED
  100. # define STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  101. #else
  102. /* Not defined */
  103. #endif /* _WCHAR_T_DEFINED */
  104. /* ////////////////////////////////////////////////////////////////////// */
  105. /* ////////////////////////////////////////////////////////////////////// */
  106. /* ////////////////////////////////////////////////////////////////////// */
  107. /* ////////////////////////////////////////////////////////////////////// */
  108. /* ////////////////////////////////////////////////////////////////////// */
  109. /* ////////////////////////////////////////////////////////////////////// */
  110. /* ////////////////////////////////////////////////////////////////////// */
  111. /* ////////////////////////////////////////////////////////////////////// */
  112. /* ////////////////////////////////////////////////////////////////////// */
  113. /* ////////////////////////////////////////////////////////////////////// */
  114. /* /////////////////////////////////////////////////////////////////////////
  115. * Integral types
  116. *
  117. * The purpose of this section is to define the following types:
  118. *
  119. * - 8-bit signed and unsigned integers
  120. * - 16-bit signed and unsigned integers
  121. * - 32-bit signed and unsigned integers
  122. * - (optionally) 64-bit signed and unsigned integers
  123. *
  124. * and to define, where appropriate the following symbols (used for
  125. * overloading):
  126. *
  127. * - STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  128. * - STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  129. * - STLSOFT_CF_INT_DISTINCT_INT_TYPE
  130. * - STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  131. * - STLSOFT_CF_LONG_LONG_DISTINCT_INT_TYPE
  132. *
  133. * which indicate that a given type is not used in the size-specific types.
  134. */
  135. #define _STLSOFT_SIZEOF_CHAR (1)
  136. #define _STLSOFT_SIZEOF_SHORT (2)
  137. #define _STLSOFT_SIZEOF_INT (4)
  138. #define _STLSOFT_SIZEOF_LONG (4)
  139. #define _STLSOFT_SIZEOF_LONG_LONG (8)
  140. /* 8-bit integer */
  141. #define STLSOFT_CF_8BIT_INT_SUPPORT
  142. #if 0
  143. #define STLSOFT_SI08_T_BASE_TYPE signed __int8
  144. #define STLSOFT_UI08_T_BASE_TYPE unsigned __int8
  145. #define STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  146. #else /* ? 0 */
  147. #define STLSOFT_SI08_T_BASE_TYPE signed char
  148. #define STLSOFT_UI08_T_BASE_TYPE unsigned char
  149. #endif /* 0 */
  150. /* 16-bit integer */
  151. #define STLSOFT_CF_16BIT_INT_SUPPORT
  152. #if 0
  153. #define STLSOFT_SI16_T_BASE_TYPE signed __int16
  154. #define STLSOFT_UI16_T_BASE_TYPE unsigned __int16
  155. #define STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  156. #else /* ? 0 */
  157. #define STLSOFT_SI16_T_BASE_TYPE signed short
  158. #define STLSOFT_UI16_T_BASE_TYPE unsigned short
  159. #endif /* 0 */
  160. /* 32-bit integer */
  161. #define STLSOFT_CF_32BIT_INT_SUPPORT
  162. #if 0
  163. #define STLSOFT_SI32_T_BASE_TYPE signed __int32
  164. #define STLSOFT_UI32_T_BASE_TYPE unsigned __int32
  165. #define STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  166. #else /* ? 0 */
  167. #define STLSOFT_SI32_T_BASE_TYPE signed int
  168. #define STLSOFT_UI32_T_BASE_TYPE unsigned int
  169. #define STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  170. #endif /* 0 */
  171. /* 64-bit integer */
  172. #define STLSOFT_CF_64BIT_INT_SUPPORT
  173. #define STLSOFT_CF_64BIT_INT_IS___int64
  174. #define STLSOFT_SI64_T_BASE_TYPE signed __int64
  175. #define STLSOFT_UI64_T_BASE_TYPE unsigned __int64
  176. /* Member constants */
  177. #if __BORLANDC__ >= 0x0550
  178. # define STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  179. #endif /* compiler */
  180. /* It transpires that Borland cannot elide the contents of the static
  181. * asserts, so we only do them in debug mode.
  182. */
  183. #ifdef _DEBUG
  184. # define STLSOFT_CF_STATIC_ASSERT_SUPPORT
  185. #endif /* _DEBUG */
  186. /* RTTI support */
  187. #ifdef __cplusplus
  188. # define STLSOFT_CF_RTTI_SUPPORT
  189. #endif /* __cplusplus */
  190. /* Exception support */
  191. #ifdef __cplusplus
  192. # define STLSOFT_CF_EXCEPTION_SUPPORT
  193. #endif /* __cplusplus */
  194. /* */
  195. #define STLSOFT_CF_FUNCTION_SIGNATURE_FULL_ARG_QUALIFICATION_REQUIRED
  196. /* Namespace support */
  197. #if __BORLANDC__ < 0x0550
  198. # define _STLSOFT_NO_NAMESPACES
  199. #endif /* compiler */
  200. #ifdef __cplusplus
  201. # define STLSOFT_CF_NAMESPACE_SUPPORT
  202. #endif /* __cplusplus */
  203. #define STLSOFT_CF_ANONYMOUS_UNION_SUPPORT
  204. #define STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID
  205. /* Template support */
  206. #ifdef __TEMPLATES__
  207. # define STLSOFT_CF_TEMPLATE_SUPPORT
  208. #else
  209. /* Not defined */
  210. #endif /* __TEMPLATES__ */
  211. /* #define STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */
  212. #define STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  213. #define STLSOFT_CF_EXCEPTION_SPEC_EXPENSIVE
  214. #define STLSOFT_CF_THROW_BAD_ALLOC
  215. #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_FUNDAMENTAL_ARGUMENT_SUPPORT
  216. #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
  217. /* #define STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT */
  218. #define STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
  219. #define STLSOFT_CF_MEMBER_TEMPLATE_OVERLOAD_DISCRIMINATED
  220. #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
  221. #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED
  222. #if __BORLANDC__ >= 0x0560
  223. # define STLSOFT_CF_MEMBER_TEMPLATE_RANGE_METHOD_SUPPORT
  224. #endif /* compiler */
  225. #define STLSOFT_CF_MEMBER_TEMPLATE_CLASS_SUPPORT
  226. #define STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX
  227. #define STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT
  228. #define STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT
  229. #define STLSOFT_CF_std_NAMESPACE
  230. #define STLSOFT_CF_std_char_traits_AVAILABLE
  231. #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_NON_TEMPLATE
  232. /* #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_TEMPLATE */
  233. #define STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT
  234. #define STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  235. #define STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT
  236. #define STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT
  237. /* #define STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT */
  238. /* #define STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
  239. #define STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT
  240. #define STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT
  241. /* #define STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  242. #define STLSOFT_CF_ADL_LOOKUP_SUPPORT
  243. #define STLSOFT_CF_TEMPLATE_TEMPLATE_SUPPORT
  244. #if __BORLANDC__ >= 0x0582
  245. /* # define STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */
  246. #endif /* compiler */
  247. /* #define STLSOFT_CF_VENEER_SUPPORT */
  248. #define STLSOFT_CF_ALLOCATOR_BASE_EXPENSIVE
  249. /* #define STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR */
  250. /* Shims are supported. */
  251. /* #define STLSOFT_CF_TEMPLATE_SHIMS_NOT_SUPPORTED */
  252. #define STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT
  253. /* #define STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
  254. /* #define STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
  255. /* /////////////////////////////////////////////////////////////////////////
  256. * Quality assurance features
  257. */
  258. #if defined(_STLSOFT_CUSTOM_ASSERT)
  259. /* You have defined the preprocessor symbol _STLSOFT_CUSTOM_ASSERT,
  260. * which stipulates that you will be providing your own assert. This
  261. * requires that you have defined _STLSOFT_CUSTOM_ASSERT() as a macro
  262. * taking 1 parameter (the condition to assert).
  263. *
  264. * Suppose you have a function DisplayAssert_(), which has the
  265. * following signature:
  266. *
  267. * void DisplayAssert_(char const* file, int line, char const* expression);
  268. *
  269. * Presumably you would also have your own assert macro, say MY_ASSERT(),
  270. * defined as:
  271. *
  272. * #define MY_ASSERT(_x) ((void)((!(_x)) ? ((void)(DisplayAssert_(__FILE__, __LINE__, #_x))) : ((void)0)))
  273. *
  274. * so you would simply need to define _STLSOFT_CUSTOM_ASSERT() in terms of
  275. * MY_ASSERT(), as in:
  276. *
  277. * #define _STLSOFT_CUSTOM_ASSERT(_x) MY_ASSERT(_x)
  278. *
  279. * where
  280. */
  281. # define __STLSOFT_CF_ASSERT_SUPPORT
  282. # define STLSOFT_CF_ASSERT_SUPPORT
  283. # define STLSOFT_ASSERT(_x) _STLSOFT_CUSTOM_ASSERT(_x)
  284. # if defined(_STLSOFT_CUSTOM_ASSERT_INCLUDE)
  285. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME _STLSOFT_CUSTOM_ASSERT_INCLUDE
  286. # else
  287. # error You must define _STLSOFT_CUSTOM_ASSERT_INCLUDE along with _STLSOFT_CUSTOM_ASSERT()
  288. # endif /* !_STLSOFT_CUSTOM_ASSERT_INCLUDE */
  289. #else /* ? _STLSOFT_CUSTOM_ASSERT */
  290. # define __STLSOFT_CF_ASSERT_SUPPORT
  291. # define STLSOFT_CF_ASSERT_SUPPORT
  292. /* #define __STLSOFT_CF_USE_cassert */
  293. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME <assert.h>
  294. # define STLSOFT_ASSERT(_x) assert(_x)
  295. #endif /* _STLSOFT_CUSTOM_ASSERT */
  296. /* /////////////////////////////////////////////////////////////////////////
  297. * Calling convention
  298. */
  299. #define STLSOFT_CF_THISCALL_SUPPORTED
  300. #define STLSOFT_CF_CDECL_SUPPORTED
  301. #define STLSOFT_CF_FASTCALL_SUPPORTED
  302. #define STLSOFT_CF_STDCALL_SUPPORTED
  303. #ifdef STLSOFT_CF_CDECL_SUPPORTED
  304. # define STLSOFT_CDECL __cdecl
  305. #endif /* STLSOFT_CF_CDECL_SUPPORTED */
  306. #ifdef STLSOFT_CF_FASTCALL_SUPPORTED
  307. # define STLSOFT_FASTCALL __msfastcall
  308. #endif /* STLSOFT_CF_FASTCALL_SUPPORTED */
  309. #ifdef STLSOFT_CF_STDCALL_SUPPORTED
  310. # define STLSOFT_STDCALL __stdcall
  311. #endif /* STLSOFT_CF_STDCALL_SUPPORTED */
  312. /* /////////////////////////////////////////////////////////////////////////
  313. * Inline assembler
  314. */
  315. #if __BORLANDC__ >= 0x0560
  316. # define STSLSOFT_INLINE_ASM_SUPPORTED
  317. #endif /* compiler */
  318. /* #define STSLSOFT_ASM_IN_INLINE_SUPPORTED */
  319. /* /////////////////////////////////////////////////////////////////////////
  320. * inline support
  321. */
  322. #define STLSOFT_CUSTOM_C_INLINE __inline
  323. /* /////////////////////////////////////////////////////////////////////////
  324. * Compiler warning suppression
  325. */
  326. #if __BORLANDC__ >= 0x0550
  327. # if __BORLANDC__ < 0x0560
  328. /* Borland: "Condition is always false in function ..." */
  329. # pragma warn -8008
  330. /* Borland: "Unreachable code in function ..." */
  331. # pragma warn -8066
  332. # endif /* compiler */
  333. /* Borland: "Functions with exception specifications are not expanded inline" */
  334. # pragma warn -8026
  335. /* Borland: "Functions containing reserved words are not expanded inline" */
  336. # pragma warn -8027
  337. #endif /* compiler */
  338. /* ///////////////////////////// end of file //////////////////////////// */