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.

467 lines
16 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/internal/cccap/sunpro.h
  3. *
  4. * Purpose: Compiler feature discrimination for SunPro C / SunPro C++.
  5. *
  6. * Created: 24th April 2008
  7. * Updated: 3rd February 2012
  8. *
  9. * Thanks to: Jonathan Wakely and Lars Ivar Igesund for help with
  10. * getting STLSoft (and Pantheios) compatible with Solaris.
  11. *
  12. * Austin Ziegler for pointing out __func__ support
  13. *
  14. * Home: http://stlsoft.org/
  15. *
  16. * Copyright (c) 2008-2012, Matthew Wilson and Synesis Software
  17. * All rights reserved.
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * - Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. * - Redistributions in binary form must reproduce the above copyright notice,
  25. * this list of conditions and the following disclaimer in the documentation
  26. * and/or other materials provided with the distribution.
  27. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  28. * any contributors may be used to endorse or promote products derived from
  29. * this software without specific prior written permission.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  35. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  38. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  39. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGE.
  42. *
  43. * ////////////////////////////////////////////////////////////////////// */
  44. #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
  45. # error This file must not be included independently of stlsoft/stlsoft.h
  46. #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
  47. /** \file stlsoft/internal/cccap/sunpro.h
  48. *
  49. * Compiler feature discrimination for SunPro C / SunPro C++.
  50. * (\ref group__library__internal).
  51. */
  52. #ifdef STLSOFT_INCL_H_STLSOFT_CCCAP_SUNPRO
  53. # error This file cannot be included more than once in any compilation unit
  54. #endif /* STLSOFT_INCL_H_STLSOFT_CCCAP_SUNPRO */
  55. /* ////////////////////////////////////////////////////////////////////// */
  56. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  57. # define STLSOFT_VER_H_STLSOFT_CCCAP_SUNPRO_MAJOR 1
  58. # define STLSOFT_VER_H_STLSOFT_CCCAP_SUNPRO_MINOR 0
  59. # define STLSOFT_VER_H_STLSOFT_CCCAP_SUNPRO_REVISION 3
  60. # define STLSOFT_VER_H_STLSOFT_CCCAP_SUNPRO_EDIT 8
  61. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  62. /* /////////////////////////////////////////////////////////////////////////
  63. * Auto-generation and compatibility
  64. */
  65. /*
  66. [<[STLSOFT-AUTO:NO-DOCFILELABEL]>]
  67. [<[STLSOFT-AUTO:NO-UNITTEST]>]
  68. */
  69. /* /////////////////////////////////////////////////////////////////////////
  70. * Helper definitions
  71. *
  72. * NOTE: These are #undef'd at the end of this file
  73. */
  74. #ifdef __cplusplus
  75. # define _STLSOFT_SUNPRO_VER_ __SUNPRO_CC
  76. #else /* ? __cplusplus */
  77. # define _STLSOFT_SUNPRO_VER_ __SUNPRO_C
  78. #endif /* __cplusplus */
  79. #define _STLSOFT_SUNPRO_VER_MAJOR ((_STLSOFT_SUNPRO_VER_ & 0xff00) >> 8)
  80. #define _STLSOFT_SUNPRO_VER_MINOR ((_STLSOFT_SUNPRO_VER_ & 0x00f0) >> 4)
  81. /* /////////////////////////////////////////////////////////////////////////
  82. * Compiler features
  83. */
  84. #if (5 != _STLSOFT_SUNPRO_VER_MAJOR) || \
  85. (9 != _STLSOFT_SUNPRO_VER_MINOR)
  86. # error The STLSoft libraries have only been verified with Sun Pro 5.9.x. Please contact Synesis Software
  87. #endif /* major.minor */
  88. /* ///////////////////////////////////////////////
  89. * Pre-processor / compiler
  90. */
  91. /* Messaging
  92. */
  93. /* #define STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT */
  94. /* Support for #pragma once
  95. */
  96. /* #define STLSOFT_CF_PRAGMA_ONCE_SUPPORT */
  97. /* Support for __FUNCTION__
  98. */
  99. /* #define STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT */
  100. #define STLSOFT_CF_func_SYMBOL_SUPPORT
  101. /* Variadic Macros
  102. *
  103. * Feature was buggy at one point, require 5.5 to be safe.
  104. */
  105. #if _STLSOFT_SUNPRO_VER_ > 0x0550
  106. # define STLSOFT_CF_SUPPORTS_VARIADIC_MACROS
  107. #endif /* _STLSOFT_SUNPRO_VER_ */
  108. /* ///////////////////////////////////////////////
  109. * Types
  110. */
  111. /* bool */
  112. #if defined(__cplusplus) && \
  113. defined(_BOOL)
  114. # define STLSOFT_CF_NATIVE_BOOL_SUPPORT
  115. #endif /* __cplusplus */
  116. /* char (sign) */
  117. /* #define STLSOFT_CF_CHAR_IS_UNSIGNED */
  118. /* wchar_t */
  119. #ifdef _WCHAR_T
  120. # define STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  121. #endif
  122. /* ////////////////////////////////////////////////////////////////////// */
  123. /* ////////////////////////////////////////////////////////////////////// */
  124. /* ////////////////////////////////////////////////////////////////////// */
  125. /* ////////////////////////////////////////////////////////////////////// */
  126. /* ////////////////////////////////////////////////////////////////////// */
  127. /* ////////////////////////////////////////////////////////////////////// */
  128. /* ////////////////////////////////////////////////////////////////////// */
  129. /* ////////////////////////////////////////////////////////////////////// */
  130. /* ////////////////////////////////////////////////////////////////////// */
  131. /* ////////////////////////////////////////////////////////////////////// */
  132. /* /////////////////////////////////////////////////////////////////////////
  133. * Integral types
  134. *
  135. * The purpose of this section is to define the following types:
  136. *
  137. * - 8-bit signed and unsigned integers
  138. * - 16-bit signed and unsigned integers
  139. * - 32-bit signed and unsigned integers
  140. * - (optionally) 64-bit signed and unsigned integers
  141. *
  142. * and to define, where appropriate the following symbols (used for
  143. * overloading):
  144. *
  145. * - STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  146. * - STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  147. * - STLSOFT_CF_INT_DISTINCT_INT_TYPE
  148. * - STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  149. * - STLSOFT_CF_LONG_LONG_DISTINCT_INT_TYPE
  150. *
  151. * which indicate that a given type is not used in the size-specific types.
  152. */
  153. #if defined(_LP64) || \
  154. defined(__LP64__)
  155. # define _STLSOFT_SIZEOF_CHAR (1)
  156. # define _STLSOFT_SIZEOF_SHORT (2)
  157. # define _STLSOFT_SIZEOF_INT (4)
  158. # define _STLSOFT_SIZEOF_LONG (8)
  159. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  160. #else /* ? data model */
  161. # define _STLSOFT_SIZEOF_CHAR (1)
  162. # define _STLSOFT_SIZEOF_SHORT (2)
  163. # define _STLSOFT_SIZEOF_INT (4)
  164. # define _STLSOFT_SIZEOF_LONG (4)
  165. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  166. #endif /* data model */
  167. #if 0
  168. #if defined(__sparcv9)
  169. # error Use of Sun Pro has not yet been verified on 64-bit Sparc. Please contact Synesis Software
  170. #elif defined(__amd64)
  171. # error Use of Sun Pro has not yet been verified on x64. Please contact Synesis Software
  172. # ifndef __LP64__
  173. # error LP64 memory model is assumed on x64. Please contact Synesis Software
  174. # endif /* __LP64__ */
  175. # define _STLSOFT_SIZEOF_CHAR (1)
  176. # define _STLSOFT_SIZEOF_SHORT (2)
  177. # define _STLSOFT_SIZEOF_INT (4)
  178. # define _STLSOFT_SIZEOF_LONG (8)
  179. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  180. #elif defined(__sparc) || \
  181. defined(__i386)
  182. # define _STLSOFT_SIZEOF_CHAR (1)
  183. # define _STLSOFT_SIZEOF_SHORT (2)
  184. # define _STLSOFT_SIZEOF_INT (4)
  185. # define _STLSOFT_SIZEOF_LONG (4)
  186. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  187. #else /* ? data model */
  188. # error Use of Sun Pro has not been verified on any operation system other than x86, x64 and Sparc. Please contact Synesis Software
  189. #endif /* data model */
  190. #endif /* 0 */
  191. /* 8-bit integer */
  192. #define STLSOFT_CF_8BIT_INT_SUPPORT
  193. #define STLSOFT_SI08_T_BASE_TYPE signed char
  194. #define STLSOFT_UI08_T_BASE_TYPE unsigned char
  195. /* 16-bit integer */
  196. #define STLSOFT_CF_16BIT_INT_SUPPORT
  197. #define STLSOFT_SI16_T_BASE_TYPE signed short
  198. #define STLSOFT_UI16_T_BASE_TYPE unsigned short
  199. /* 32-bit integer */
  200. #define STLSOFT_CF_32BIT_INT_SUPPORT
  201. #define STLSOFT_SI32_T_BASE_TYPE signed int
  202. #define STLSOFT_UI32_T_BASE_TYPE unsigned int
  203. #define STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  204. /* 64-bit integer */
  205. #define STLSOFT_CF_64BIT_INT_SUPPORT
  206. #define STLSOFT_CF_64BIT_INT_IS_long_long
  207. #define STLSOFT_SI64_T_BASE_TYPE signed long long
  208. #define STLSOFT_UI64_T_BASE_TYPE unsigned long long
  209. /* ///////////////////////////////////////////////
  210. * Language features
  211. */
  212. /* Anonymous unions */
  213. #ifdef __cplusplus
  214. # define STLSOFT_CF_ANONYMOUS_UNION_SUPPORT
  215. #endif /* __cplusplus */
  216. /* Member constants */
  217. #ifdef __cplusplus
  218. # define STLSOFT_CF_MEMBER_CONSTANT_SUPPORT
  219. #endif /* __cplusplus */
  220. /* Static assertions */
  221. #define STLSOFT_CF_STATIC_ASSERT_SUPPORT
  222. /* sign of modulus of negative numbers */
  223. #define STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT
  224. /* RTTI support */
  225. #ifdef __cplusplus
  226. # define STLSOFT_CF_RTTI_SUPPORT
  227. #endif /* __cplusplus */
  228. /* Exception support */
  229. #ifdef __cplusplus
  230. # define STLSOFT_CF_EXCEPTION_SUPPORT
  231. #endif /* __cplusplus */
  232. #ifdef __cplusplus
  233. # define STLSOFT_CF_THROW_BAD_ALLOC
  234. #endif /* __cplusplus */
  235. /* Namespace support */
  236. #ifdef __cplusplus
  237. # define STLSOFT_CF_NAMESPACE_SUPPORT
  238. #endif /* __cplusplus */
  239. #ifdef __cplusplus
  240. # define STLSOFT_CF_std_NAMESPACE
  241. #endif /* __cplusplus */
  242. /* return void */
  243. #ifdef __cplusplus
  244. # define STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID
  245. #endif /* __cplusplus */
  246. /* Template support */
  247. #ifdef __cplusplus
  248. # define STLSOFT_CF_TEMPLATE_SUPPORT
  249. #endif /* __cplusplus */
  250. /* #define STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS */
  251. /* */
  252. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_FUNCTION_SIGNATURE_FULL_ARG_QUALIFICATION_REQUIRED
  253. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  254. /* !!! Assumed. Not yet verified !!! */ /* #define STLSOFT_CF_EXCEPTION_SPEC_EXPENSIVE */
  255. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_FUNDAMENTAL_ARGUMENT_SUPPORT
  256. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
  257. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
  258. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
  259. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_OVERLOAD_DISCRIMINATED
  260. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
  261. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED
  262. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_RANGE_METHOD_SUPPORT
  263. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_MEMBER_TEMPLATE_CLASS_SUPPORT
  264. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX
  265. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT
  266. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT
  267. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_std_char_traits_AVAILABLE
  268. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_NON_TEMPLATE
  269. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_TEMPLATE
  270. #define STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT
  271. #define STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  272. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT
  273. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT
  274. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT
  275. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT
  276. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT
  277. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT
  278. /* !!! Assumed. Not yet verified !!! */ /* #define STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  279. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_ADL_LOOKUP_SUPPORT
  280. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_TEMPLATE_TEMPLATE_SUPPORT
  281. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT
  282. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_VENEER_SUPPORT
  283. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_ALLOCATOR_BASE_EXPENSIVE
  284. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR
  285. /* Shims are supported?
  286. */
  287. /* #define STLSOFT_CF_TEMPLATE_SHIMS_NOT_SUPPORTED */
  288. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  289. /* !!! Assumed. Not yet verified !!! */ #define STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  290. /* /////////////////////////////////////////////////////////////////////////
  291. * Quality assurance features
  292. */
  293. #if defined(_STLSOFT_CUSTOM_ASSERT)
  294. /* You have defined the preprocessor symbol _STLSOFT_CUSTOM_ASSERT,
  295. * which stipulates that you will be providing your own assert. This
  296. * requires that you have defined _STLSOFT_CUSTOM_ASSERT() as a macro
  297. * taking 1 parameter (the condition to assert).
  298. *
  299. * Suppose you have a function DisplayAssert_(), which has the
  300. * following signature:
  301. *
  302. * void DisplayAssert_(char const* file, int line, char const* expression);
  303. *
  304. * Presumably you would also have your own assert macro, say MY_ASSERT(),
  305. * defined as:
  306. *
  307. * #define MY_ASSERT(_x) ((void)((!(_x)) ? ((void)(DisplayAssert_(__FILE__, __LINE__, #_x))) : ((void)0)))
  308. *
  309. * so you would simply need to define _STLSOFT_CUSTOM_ASSERT() in terms of
  310. * MY_ASSERT(), as in:
  311. *
  312. * #define _STLSOFT_CUSTOM_ASSERT(_x) MY_ASSERT(_x)
  313. *
  314. * where
  315. */
  316. # define __STLSOFT_CF_ASSERT_SUPPORT
  317. # define STLSOFT_CF_ASSERT_SUPPORT
  318. # define STLSOFT_ASSERT(_x) _STLSOFT_CUSTOM_ASSERT(_x)
  319. # if defined(_STLSOFT_CUSTOM_ASSERT_INCLUDE)
  320. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME _STLSOFT_CUSTOM_ASSERT_INCLUDE
  321. # else
  322. # error You must define _STLSOFT_CUSTOM_ASSERT_INCLUDE along with _STLSOFT_CUSTOM_ASSERT()
  323. # endif /* !_STLSOFT_CUSTOM_ASSERT_INCLUDE */
  324. #else /* ? _STLSOFT_CUSTOM_ASSERT */
  325. # define __STLSOFT_CF_ASSERT_SUPPORT
  326. # define STLSOFT_CF_ASSERT_SUPPORT
  327. /* # define __STLSOFT_CF_USE_cassert */
  328. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME <assert.h>
  329. # define STLSOFT_ASSERT(_x) assert(_x)
  330. #endif /* _STLSOFT_CUSTOM_ASSERT */
  331. /* /////////////////////////////////////////////////////////////////////////
  332. * Calling convention
  333. */
  334. #define STLSOFT_CF_CDECL_SUPPORTED
  335. #ifdef STLSOFT_CF_CDECL_SUPPORTED
  336. # define STLSOFT_CDECL
  337. #endif /* STLSOFT_CF_CDECL_SUPPORTED */
  338. /* /////////////////////////////////////////////////////////////////////////
  339. * Inline assembler
  340. */
  341. /* #define STSLSOFT_INLINE_ASM_SUPPORTED */
  342. /* #define STSLSOFT_ASM_IN_INLINE_SUPPORTED */
  343. /* /////////////////////////////////////////////////////////////////////////
  344. * inline support
  345. */
  346. #define STLSOFT_CF_C99_INLINE
  347. /* /////////////////////////////////////////////////////////////////////////
  348. * If <cwchar> gets included after <stdio.h> or <cstdio> then it fails to
  349. * declare mbstate_t and various wchar functions, so include it now to try
  350. * and reduce problem (too late if <stdio.h> has already been included.)
  351. * http://forum.java.sun.com/thread.jspa?messageID=10035724
  352. */
  353. #ifdef STLSOFT_LINUX_STDIO_ORDER_BUG
  354. # ifdef __cplusplus
  355. # include <cwchar>
  356. # endif /* __cplusplus */
  357. #endif /* STLSOFT_LINUX_STDIO_ORDER_BUG */
  358. /* /////////////////////////////////////////////////////////////////////////
  359. * Compiler warning suppression
  360. */
  361. /* /////////////////////////////////////////////////////////////////////////
  362. * Helper definitions
  363. */
  364. #undef _STLSOFT_SUNPRO_VER_
  365. #undef _STLSOFT_SUNPRO_VER_MAJOR
  366. #undef _STLSOFT_SUNPRO_VER_MINOR
  367. /* ///////////////////////////// end of file //////////////////////////// */