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.

482 lines
15 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/internal/cccap/como.h
  3. *
  4. * Purpose: Compiler feature discrimination for Comeau 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/como.h
  43. *
  44. * Compiler feature discrimination for Comeau C/C++
  45. * (\ref group__library__internal).
  46. */
  47. #ifdef STLSOFT_INCL_H_STLSOFT_CCCAP_COMO
  48. # error This file cannot be included more than once in any compilation unit
  49. #endif /* STLSOFT_INCL_H_STLSOFT_CCCAP_COMO */
  50. /* ////////////////////////////////////////////////////////////////////// */
  51. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  52. # define STLSOFT_VER_H_STLSOFT_CCCAP_COMO_MAJOR 3
  53. # define STLSOFT_VER_H_STLSOFT_CCCAP_COMO_MINOR 16
  54. # define STLSOFT_VER_H_STLSOFT_CCCAP_COMO_REVISION 2
  55. # define STLSOFT_VER_H_STLSOFT_CCCAP_COMO_EDIT 69
  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. * Back end discrimination
  66. */
  67. #if defined(__BORLANDC__)
  68. # define STLSOFT_CF_COMO_BACKEND_IS_BORLAND
  69. #elif defined(__DMC__)
  70. # define STLSOFT_CF_COMO_BACKEND_IS_DMC
  71. #elif defined(__GNUC__)
  72. # define STLSOFT_CF_COMO_BACKEND_IS_GCC
  73. #elif defined(__INTEL_COMPILER)
  74. # define STLSOFT_CF_COMO_BACKEND_IS_INTEL
  75. #elif defined(__MWERKS__)
  76. # define STLSOFT_CF_COMO_BACKEND_IS_MWERKS
  77. #elif defined(_MSC_VER)
  78. # define STLSOFT_CF_COMO_BACKEND_IS_MSVC
  79. #else /* ? compiler */
  80. # error Your Comeau back-end is not recognised. Please contact admin hat stlsoft dot org
  81. #endif /* compiler */
  82. /* /////////////////////////////////////////////////////////////////////////
  83. * Compiler features
  84. */
  85. /* Messaging
  86. */
  87. /* #define STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT */
  88. /* Support for #pragma once
  89. */
  90. #define STLSOFT_CF_PRAGMA_ONCE_SUPPORT
  91. /* Support for __FUNCTION__
  92. */
  93. #define STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT
  94. /* Variadic Macros
  95. */
  96. #define STLSOFT_CF_SUPPORTS_VARIADIC_MACROS
  97. /* Types:
  98. */
  99. /* bool */
  100. #ifdef _BOOL
  101. # define STLSOFT_CF_NATIVE_BOOL_SUPPORT
  102. #else
  103. /* Not defined */
  104. #endif /* _BOOL_DEFINED */
  105. /* wchar_t */
  106. #ifdef _WCHAR_T
  107. # define STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  108. #else
  109. /* Not defined */
  110. #endif /* _WCHAR_T_DEFINED */
  111. /* ////////////////////////////////////////////////////////////////////// */
  112. /* ////////////////////////////////////////////////////////////////////// */
  113. /* ////////////////////////////////////////////////////////////////////// */
  114. /* ////////////////////////////////////////////////////////////////////// */
  115. /* ////////////////////////////////////////////////////////////////////// */
  116. /* ////////////////////////////////////////////////////////////////////// */
  117. /* ////////////////////////////////////////////////////////////////////// */
  118. /* ////////////////////////////////////////////////////////////////////// */
  119. /* ////////////////////////////////////////////////////////////////////// */
  120. /* ////////////////////////////////////////////////////////////////////// */
  121. /* /////////////////////////////////////////////////////////////////////////
  122. * Integral types
  123. *
  124. * The purpose of this section is to define the following types:
  125. *
  126. * - 8-bit signed and unsigned integers
  127. * - 16-bit signed and unsigned integers
  128. * - 32-bit signed and unsigned integers
  129. * - (optionally) 64-bit signed and unsigned integers
  130. *
  131. * and to define, where appropriate the following symbols (used for
  132. * overloading):
  133. *
  134. * - STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  135. * - STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  136. * - STLSOFT_CF_INT_DISTINCT_INT_TYPE
  137. * - STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  138. * - STLSOFT_CF_LONG_LONG_DISTINCT_INT_TYPE
  139. *
  140. * which indicate that a given type is not used in the size-specific types.
  141. */
  142. #if defined(__LP64__)
  143. # define _STLSOFT_SIZEOF_CHAR (1)
  144. # define _STLSOFT_SIZEOF_SHORT (2)
  145. # define _STLSOFT_SIZEOF_INT (4)
  146. # define _STLSOFT_SIZEOF_LONG (8)
  147. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  148. #elif defined(__linux__) || \
  149. defined(__APPLE__)
  150. # define _STLSOFT_SIZEOF_CHAR (1)
  151. # define _STLSOFT_SIZEOF_SHORT (2)
  152. # define _STLSOFT_SIZEOF_INT (4)
  153. # define _STLSOFT_SIZEOF_LONG (4)
  154. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  155. #elif defined(_WIN64) || \
  156. defined(_WIN32)
  157. # define _STLSOFT_SIZEOF_CHAR (1)
  158. # define _STLSOFT_SIZEOF_SHORT (2)
  159. # define _STLSOFT_SIZEOF_INT (4)
  160. # define _STLSOFT_SIZEOF_LONG (4)
  161. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  162. #else /* ? data model */
  163. # error Use of Comeau has not been verified on any operation system other than Win32. Please contact Synesis Software
  164. #endif /* data model */
  165. /* 8-bit integer */
  166. #define STLSOFT_CF_8BIT_INT_SUPPORT
  167. #define STLSOFT_SI08_T_BASE_TYPE signed char
  168. #define STLSOFT_UI08_T_BASE_TYPE unsigned char
  169. /* 16-bit integer */
  170. #define STLSOFT_CF_16BIT_INT_SUPPORT
  171. #define STLSOFT_SI16_T_BASE_TYPE signed short
  172. #define STLSOFT_UI16_T_BASE_TYPE unsigned short
  173. /* 32-bit integer */
  174. #define STLSOFT_CF_32BIT_INT_SUPPORT
  175. #define STLSOFT_SI32_T_BASE_TYPE signed int
  176. #define STLSOFT_UI32_T_BASE_TYPE unsigned int
  177. #define STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  178. /* 64-bit integer */
  179. #define STLSOFT_CF_64BIT_INT_SUPPORT
  180. #define STLSOFT_CF_64BIT_INT_IS_long_long
  181. #define STLSOFT_SI64_T_BASE_TYPE signed long long
  182. #define STLSOFT_UI64_T_BASE_TYPE unsigned long long
  183. /* Member constants */
  184. #define STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  185. /* Static assertions */
  186. #define STLSOFT_CF_STATIC_ASSERT_SUPPORT
  187. /* RTTI support */
  188. #ifdef __cplusplus
  189. # define STLSOFT_CF_RTTI_SUPPORT
  190. #endif /* __cplusplus */
  191. /* Exception support */
  192. #ifdef __cplusplus
  193. # define STLSOFT_CF_EXCEPTION_SUPPORT
  194. #endif /* __cplusplus */
  195. /* */
  196. #define STLSOFT_CF_FUNCTION_SIGNATURE_FULL_ARG_QUALIFICATION_REQUIRED
  197. /* Namespace support */
  198. /* #define _STLSOFT_NO_NAMESPACES */
  199. #ifdef __cplusplus
  200. # define STLSOFT_CF_NAMESPACE_SUPPORT
  201. #endif /* __cplusplus */
  202. #define STLSOFT_CF_ANONYMOUS_UNION_SUPPORT
  203. #if __COMO__ >= 4303
  204. # define STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID
  205. #endif /* __COMO__ >= 4303 */
  206. /* Template support */
  207. #define STLSOFT_CF_TEMPLATE_SUPPORT
  208. /* #define STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */
  209. #define STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  210. #define STLSOFT_CF_EXCEPTION_SPEC_EXPENSIVE
  211. #define STLSOFT_CF_THROW_BAD_ALLOC
  212. #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_FUNDAMENTAL_ARGUMENT_SUPPORT
  213. #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
  214. #define STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
  215. #define STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
  216. #define STLSOFT_CF_MEMBER_TEMPLATE_OVERLOAD_DISCRIMINATED
  217. #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
  218. #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED
  219. #define STLSOFT_CF_MEMBER_TEMPLATE_RANGE_METHOD_SUPPORT
  220. #define STLSOFT_CF_MEMBER_TEMPLATE_CLASS_SUPPORT
  221. #define STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX
  222. #define STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT
  223. #define STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT
  224. #define STLSOFT_CF_std_NAMESPACE
  225. #define STLSOFT_CF_std_char_traits_AVAILABLE
  226. #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_NON_TEMPLATE
  227. #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_TEMPLATE
  228. #define STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT
  229. #define STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  230. #define STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT
  231. #define STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT
  232. #define STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT
  233. /* #define STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
  234. #define STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT
  235. #define STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT
  236. /* #define STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  237. #define STLSOFT_CF_ADL_LOOKUP_SUPPORT
  238. #define STLSOFT_CF_TEMPLATE_TEMPLATE_SUPPORT
  239. #define STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT
  240. #define STLSOFT_CF_VENEER_SUPPORT
  241. #define STLSOFT_CF_ALLOCATOR_BASE_EXPENSIVE
  242. /* #define STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR */
  243. /* Shims are supported */
  244. /* #define STLSOFT_CF_TEMPLATE_SHIMS_NOT_SUPPORTED */
  245. #define STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT
  246. #define STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  247. #define STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  248. /* /////////////////////////////////////////////////////////////////////////
  249. * Quality assurance features
  250. */
  251. #if defined(_STLSOFT_CUSTOM_ASSERT)
  252. /* You have defined the preprocessor symbol _STLSOFT_CUSTOM_ASSERT,
  253. * which stipulates that you will be providing your own assert. This
  254. * requires that you have defined _STLSOFT_CUSTOM_ASSERT() as a macro
  255. * taking 1 parameter (the condition to assert).
  256. *
  257. * Suppose you have a function DisplayAssert_(), which has the
  258. * following signature:
  259. *
  260. * void DisplayAssert_(char const* file, int line, char const* expression);
  261. *
  262. * Presumably you would also have your own assert macro, say MY_ASSERT(),
  263. * defined as:
  264. *
  265. * #define MY_ASSERT(_x) ((void)((!(_x)) ? ((void)(DisplayAssert_(__FILE__, __LINE__, #_x))) : ((void)0)))
  266. *
  267. * so you would simply need to define _STLSOFT_CUSTOM_ASSERT() in terms of
  268. * MY_ASSERT(), as in:
  269. *
  270. * #define _STLSOFT_CUSTOM_ASSERT(_x) MY_ASSERT(_x)
  271. *
  272. * where
  273. */
  274. # define __STLSOFT_CF_ASSERT_SUPPORT
  275. # define STLSOFT_CF_ASSERT_SUPPORT
  276. # define STLSOFT_ASSERT(_x) _STLSOFT_CUSTOM_ASSERT(_x)
  277. # if defined(_STLSOFT_CUSTOM_ASSERT_INCLUDE)
  278. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME _STLSOFT_CUSTOM_ASSERT_INCLUDE
  279. # else
  280. # error You must define _STLSOFT_CUSTOM_ASSERT_INCLUDE along with _STLSOFT_CUSTOM_ASSERT()
  281. # endif /* !_STLSOFT_CUSTOM_ASSERT_INCLUDE */
  282. #else /* ? _STLSOFT_CUSTOM_ASSERT */
  283. # if defined(STLSOFT_CF_COMO_BACKEND_IS_BORLAND)
  284. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME <assert.h>
  285. # define STLSOFT_ASSERT(_x) assert(_x)
  286. # else /* compiler */
  287. # define __STLSOFT_CF_ASSERT_SUPPORT
  288. # define STLSOFT_CF_ASSERT_SUPPORT
  289. # define __STLSOFT_CF_USE_cassert
  290. # endif /* compiler */
  291. #endif /* _STLSOFT_CUSTOM_ASSERT */
  292. /* /////////////////////////////////////////////////////////////////////////
  293. * Calling convention
  294. */
  295. #define STLSOFT_CF_CDECL_SUPPORTED
  296. #if defined(__STDC__)
  297. /* Neither fastcall nor stdcall are supported in strict mode. */
  298. #else /* ? std C */
  299. # if defined(STLSOFT_CF_COMO_BACKEND_IS_BORLAND)
  300. # define STLSOFT_CF_THISCALL_SUPPORTED
  301. # define STLSOFT_CF_FASTCALL_SUPPORTED
  302. # define STLSOFT_CF_STDCALL_SUPPORTED
  303. # define STLSOFT_CDECL __cdecl
  304. # define STLSOFT_FASTCALL __msfastcall
  305. # define STLSOFT_STDCALL __stdcall
  306. # elif defined(STLSOFT_CF_COMO_BACKEND_IS_DMC)
  307. # define STLSOFT_CF_THISCALL_SUPPORTED
  308. # define STLSOFT_CF_STDCALL_SUPPORTED
  309. # define STLSOFT_CDECL __cdecl
  310. # define STLSOFT_STDCALL __stdcall
  311. # elif defined(STLSOFT_CF_COMO_BACKEND_IS_GCC)
  312. # if defined(WIN32) || \
  313. defined(WIN64)
  314. # define STLSOFT_CF_THISCALL_SUPPORTED
  315. # define STLSOFT_CF_FASTCALL_SUPPORTED
  316. # define STLSOFT_CF_STDCALL_SUPPORTED
  317. # define STLSOFT_CDECL __cdecl
  318. # define STLSOFT_FASTCALL __fastcall
  319. # define STLSOFT_STDCALL __stdcall
  320. # endif /* Windows */
  321. # elif defined(STLSOFT_CF_COMO_BACKEND_IS_INTEL)
  322. # if defined(WIN32) || \
  323. defined(WIN64)
  324. # define STLSOFT_CF_THISCALL_SUPPORTED
  325. # define STLSOFT_CF_FASTCALL_SUPPORTED
  326. # define STLSOFT_CF_STDCALL_SUPPORTED
  327. # define STLSOFT_CDECL __cdecl
  328. # define STLSOFT_FASTCALL __fastcall
  329. # define STLSOFT_STDCALL __stdcall
  330. # endif /* Windows */
  331. # elif defined(STLSOFT_CF_COMO_BACKEND_IS_MWERKS)
  332. # if defined(WIN32) || \
  333. defined(WIN64)
  334. # define STLSOFT_CF_THISCALL_SUPPORTED
  335. # define STLSOFT_CF_FASTCALL_SUPPORTED
  336. # define STLSOFT_CF_STDCALL_SUPPORTED
  337. # define STLSOFT_CDECL __cdecl
  338. # define STLSOFT_FASTCALL __fastcall
  339. # define STLSOFT_STDCALL __stdcall
  340. # endif /* Windows */
  341. # elif defined(STLSOFT_CF_COMO_BACKEND_IS_MSVC)
  342. # define STLSOFT_CF_THISCALL_SUPPORTED
  343. # define STLSOFT_CF_FASTCALL_SUPPORTED
  344. # define STLSOFT_CF_STDCALL_SUPPORTED
  345. # define STLSOFT_CDECL __cdecl
  346. # define STLSOFT_FASTCALL __fastcall
  347. # define STLSOFT_STDCALL __stdcall
  348. # else
  349. # error Unrecognised compiler
  350. # endif /* ? compiler */
  351. #endif /* std C */
  352. /* /////////////////////////////////////////////////////////////////////////
  353. * Inline assembler
  354. */
  355. #if !defined(_MSC_VER)
  356. # define STSLSOFT_INLINE_ASM_SUPPORTED
  357. # define STSLSOFT_ASM_IN_INLINE_SUPPORTED
  358. #endif /* !_MSC_VER */
  359. /* /////////////////////////////////////////////////////////////////////////
  360. * inline support
  361. */
  362. #define STLSOFT_CF_C99_INLINE
  363. /* /////////////////////////////////////////////////////////////////////////
  364. * Compiler warning suppression
  365. */
  366. /* ///////////////////////////// end of file //////////////////////////// */