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.

461 lines
14 KiB

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