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.

413 lines
14 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: stlsoft/internal/cccap/watcom.h
  3. *
  4. * Purpose: Compiler feature discrimination for Watcom 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/watcom.h
  43. *
  44. * Compiler feature discrimination for Watcom C/C++
  45. * (\ref group__library__internal).
  46. */
  47. #ifdef STLSOFT_INCL_H_STLSOFT_CCCAP_WATCOM
  48. # error This file cannot be included more than once in any compilation unit
  49. #endif /* STLSOFT_INCL_H_STLSOFT_CCCAP_WATCOM */
  50. /* ////////////////////////////////////////////////////////////////////// */
  51. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  52. # define STLSOFT_VER_H_STLSOFT_CCCAP_WATCOM_MAJOR 3
  53. # define STLSOFT_VER_H_STLSOFT_CCCAP_WATCOM_MINOR 18
  54. # define STLSOFT_VER_H_STLSOFT_CCCAP_WATCOM_REVISION 2
  55. # define STLSOFT_VER_H_STLSOFT_CCCAP_WATCOM_EDIT 79
  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. /* Messaging
  68. */
  69. #define STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT
  70. /* Support for #pragma once
  71. */
  72. #if __WATCOMC__ >= 1200
  73. # define STLSOFT_CF_PRAGMA_ONCE_SUPPORT
  74. #endif /* __WATCOMC__ */
  75. /* Support for __FUNCTION__
  76. */
  77. #if __WATCOMC__ >= 1240
  78. # define STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT
  79. #endif /* __WATCOMC__ */
  80. /* Variadic Macros
  81. */
  82. #if __WATCOMC__ >= 1240
  83. # define STLSOFT_CF_SUPPORTS_VARIADIC_MACROS
  84. #endif /* __WATCOMC__ */
  85. /* Types:
  86. */
  87. /* bool */
  88. #ifdef __cplusplus
  89. # define STLSOFT_CF_NATIVE_BOOL_SUPPORT
  90. #endif /* __cplusplus */
  91. /* char (sign) */
  92. #ifndef __CHAR_SIGNED__
  93. # define STLSOFT_CF_CHAR_IS_UNSIGNED
  94. #endif /* !__CHAR_SIGNED__ */
  95. /* wchar_t */
  96. #if __WATCOMC__ >= 1200
  97. # define STLSOFT_CF_NATIVE_WCHAR_T_SUPPORT
  98. #endif /* __WATCOMC__ */
  99. /* ////////////////////////////////////////////////////////////////////// */
  100. /* ////////////////////////////////////////////////////////////////////// */
  101. /* ////////////////////////////////////////////////////////////////////// */
  102. /* ////////////////////////////////////////////////////////////////////// */
  103. /* ////////////////////////////////////////////////////////////////////// */
  104. /* ////////////////////////////////////////////////////////////////////// */
  105. /* ////////////////////////////////////////////////////////////////////// */
  106. /* ////////////////////////////////////////////////////////////////////// */
  107. /* ////////////////////////////////////////////////////////////////////// */
  108. /* ////////////////////////////////////////////////////////////////////// */
  109. /* /////////////////////////////////////////////////////////////////////////
  110. * Integral types
  111. *
  112. * The purpose of this section is to define the following types:
  113. *
  114. * - 8-bit signed and unsigned integers
  115. * - 16-bit signed and unsigned integers
  116. * - 32-bit signed and unsigned integers
  117. * - (optionally) 64-bit signed and unsigned integers
  118. *
  119. * and to define, where appropriate the following symbols (used for
  120. * overloading):
  121. *
  122. * - STLSOFT_CF_CHAR_DISTINCT_INT_TYPE
  123. * - STLSOFT_CF_SHORT_DISTINCT_INT_TYPE
  124. * - STLSOFT_CF_INT_DISTINCT_INT_TYPE
  125. * - STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  126. * - STLSOFT_CF_LONG_LONG_DISTINCT_INT_TYPE
  127. *
  128. * which indicate that a given type is not used in the size-specific types.
  129. */
  130. #if defined(__LP64__)
  131. # define _STLSOFT_SIZEOF_CHAR (1)
  132. # define _STLSOFT_SIZEOF_SHORT (2)
  133. # define _STLSOFT_SIZEOF_INT (4)
  134. # define _STLSOFT_SIZEOF_LONG (8)
  135. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  136. #elif defined(_WIN32) || \
  137. defined(_WIN64)
  138. # define _STLSOFT_SIZEOF_CHAR (1)
  139. # define _STLSOFT_SIZEOF_SHORT (2)
  140. # define _STLSOFT_SIZEOF_INT (4)
  141. # define _STLSOFT_SIZEOF_LONG (4)
  142. # define _STLSOFT_SIZEOF_LONG_LONG (8)
  143. #else /* ? data model */
  144. # error Use of Watcom C/C++ has not been verified on any operation system other than Win32. Please contact Synesis Software
  145. #endif /* data model */
  146. /* 8-bit integer */
  147. #define STLSOFT_CF_8BIT_INT_SUPPORT
  148. #define STLSOFT_SI08_T_BASE_TYPE signed char
  149. #define STLSOFT_UI08_T_BASE_TYPE unsigned char
  150. /* 16-bit integer */
  151. #define STLSOFT_CF_16BIT_INT_SUPPORT
  152. #define STLSOFT_SI16_T_BASE_TYPE signed short
  153. #define STLSOFT_UI16_T_BASE_TYPE unsigned short
  154. /* 32-bit integer */
  155. #define STLSOFT_CF_32BIT_INT_SUPPORT
  156. #define STLSOFT_SI32_T_BASE_TYPE signed int
  157. #define STLSOFT_UI32_T_BASE_TYPE unsigned int
  158. #define STLSOFT_CF_LONG_DISTINCT_INT_TYPE
  159. /* 64-bit integer */
  160. #define STLSOFT_CF_64BIT_INT_SUPPORT
  161. #define STLSOFT_CF_64BIT_INT_IS_long_long
  162. #define STLSOFT_SI64_T_BASE_TYPE signed long long
  163. #define STLSOFT_UI64_T_BASE_TYPE unsigned long long
  164. /* Member constants */
  165. /* #define STLSOFT_CF_MEMBER_CONSTANT_SUPPORT */
  166. /* Static assertions */
  167. #define STLSOFT_CF_STATIC_ASSERT_SUPPORT
  168. /* RTTI support */
  169. #if defined(_CPPRTTI) || \
  170. defined(__CPPRTTI)
  171. # define STLSOFT_CF_RTTI_SUPPORT
  172. #else
  173. /* Not defined */
  174. #endif /* __CPPUNWIND */
  175. /* Exception support */
  176. #if defined(_CPPUNWIND) || \
  177. defined(__CPPUNWIND)
  178. # define STLSOFT_CF_EXCEPTION_SUPPORT
  179. #else
  180. /* Not defined */
  181. #endif /* __CPPUNWIND */
  182. /* */
  183. #define STLSOFT_CF_FUNCTION_SIGNATURE_FULL_ARG_QUALIFICATION_REQUIRED
  184. /* Namespace support */
  185. /* Watcom C/C++ gets confused when declaring ::stlsoft::X, so namespaces are
  186. * suppressed.
  187. */
  188. #if __WATCOMC__ < 1240
  189. # define _STLSOFT_NO_NAMESPACES
  190. #endif /* __WATCOMC__ */
  191. #ifdef __cplusplus
  192. # define STLSOFT_CF_NAMESPACE_SUPPORT
  193. #endif /* __cplusplus */
  194. #define STLSOFT_CF_ANONYMOUS_UNION_SUPPORT
  195. /* #define STLSOFT_CF_COMPILER_SUPPORTS_RETURN_VOID */
  196. /* Template support */
  197. #define STLSOFT_CF_TEMPLATE_SUPPORT
  198. #define STLSOFT_CF_TEMPLATE_TYPE_REQUIRED_IN_ARGS
  199. #ifdef __CPPUNWIND
  200. # define STLSOFT_CF_EXCEPTION_SIGNATURE_SUPPORT
  201. #else
  202. /* Not defined */
  203. #endif /* __CPPUNWIND */
  204. /* #define STLSOFT_CF_EXCEPTION_SPEC_EXPENSIVE */
  205. /* #define STLSOFT_CF_THROW_BAD_ALLOC */
  206. #if __WATCOMC__ >= 1200
  207. # define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_FUNDAMENTAL_ARGUMENT_SUPPORT
  208. #endif /* __WATCOMC__ */
  209. #if __WATCOMC__ >= 1270
  210. # define STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
  211. #endif /* __WATCOMC__ */
  212. /* # define STLSOFT_CF_TEMPLATE_FUNCTION_FUNDAMENTAL_ARGUMENT_SUPPORT */
  213. /* #define STLSOFT_CF_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT */
  214. /* #define STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
  215. /* #define STLSOFT_CF_MEMBER_TEMPLATE_OVERLOAD_DISCRIMINATED */
  216. /* #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT */
  217. /* #define STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED */
  218. /* #define STLSOFT_CF_MEMBER_TEMPLATE_RANGE_METHOD_SUPPORT */
  219. /* #define STLSOFT_CF_MEMBER_TEMPLATE_CLASS_SUPPORT */
  220. /* #define STLSOFT_CF_TEMPLATE_SPECIALISATION_SYNTAX */
  221. /* #define STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
  222. # ifdef STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT
  223. # undef STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT
  224. # endif /* STLSOFT_CF_TEMPLATE_OUTOFCLASSFN_QUALIFIED_TYPE_SUPPORT */
  225. #if __WATCOMC__ >= 1240
  226. # define STLSOFT_CF_std_NAMESPACE
  227. #endif /* __WATCOMC__ */
  228. #define STLSOFT_CF_std_char_traits_AVAILABLE
  229. /* #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_NON_TEMPLATE */
  230. /* #define STLSOFT_CF_PARENT_TYPES_CAN_BE_USED_IN_TEMPLATE */
  231. #define STLSOFT_CF_EXPLICIT_KEYWORD_SUPPORT
  232. #define STLSOFT_CF_MUTABLE_KEYWORD_SUPPORT
  233. /* #define STLSOFT_CF_TYPENAME_PARAM_KEYWORD_SUPPORT */
  234. /* #define STLSOFT_CF_TYPENAME_TYPE_KEYWORD_SUPPORT */
  235. /* #define STLSOFT_CF_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT */
  236. /* #define STLSOFT_CF_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
  237. /* #define STLSOFT_CF_TYPENAME_TYPE_RET_KEYWORD_SUPPORT */
  238. /* #define STLSOFT_CF_TEMPLATE_QUALIFIER_KEYWORD_SUPPORT */
  239. /* #define STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  240. /* #define STLSOFT_CF_ADL_LOOKUP_SUPPORT */
  241. /* #define STLSOFT_CF_TEMPLATE_TEMPLATE_SUPPORT */
  242. /* #define STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */
  243. #define STLSOFT_CF_VENEER_SUPPORT
  244. #define STLSOFT_CF_ALLOCATOR_BASE_EXPENSIVE
  245. /* #define STLSOFT_CF_COMPILER_WARNS_NO_PUBLIC_DTOR */
  246. #define STLSOFT_CF_TEMPLATE_SHIMS_NOT_SUPPORTED
  247. #define STLSOFT_CF_NEGATIVE_MODULUS_POSITIVE_GIVES_NEGATIVE_RESULT
  248. #define STLSOFT_CF_OPERATOR_BOOL_AS_OPERATOR_POINTER_TO_MEMBER_SUPPORT
  249. /* #define STLSOFT_CF_OPERATOR_NOT_VIA_OPERATOR_POINTER_TO_MEMBER_SUPPORT */
  250. /* /////////////////////////////////////////////////////////////////////////
  251. * Quality assurance features
  252. */
  253. #if defined(_STLSOFT_CUSTOM_ASSERT)
  254. /* You have defined the preprocessor symbol _STLSOFT_CUSTOM_ASSERT,
  255. * which stipulates that you will be providing your own assert. This
  256. * requires that you have defined _STLSOFT_CUSTOM_ASSERT() as a macro
  257. * taking 1 parameter (the condition to assert).
  258. *
  259. * Suppose you have a function _DisplayAssert(), which has the
  260. * following signature:
  261. *
  262. * void _DisplayAssert(char const* file, int line, char const* expression);
  263. *
  264. * Presumably you would also have your own assert macro, say MY_ASSERT(),
  265. * defined as:
  266. *
  267. * #define MY_ASSERT(_x) ((void)((!(_x)) ? ((void)(_DisplayAssert(__FILE__, __LINE__, #_x))) : ((void)0)))
  268. *
  269. * so you would simply need to define _STLSOFT_CUSTOM_ASSERT() in terms of
  270. * MY_ASSERT(), as in:
  271. *
  272. * #define _STLSOFT_CUSTOM_ASSERT(_x) MY_ASSERT(_x)
  273. *
  274. * You must also specify the include header name containing your
  275. * custom assertion declaration, in the preprocessor symbol
  276. * _STLSOFT_CUSTOM_ASSERT_INCLUDE
  277. */
  278. # define __STLSOFT_CF_ASSERT_SUPPORT
  279. # define STLSOFT_CF_ASSERT_SUPPORT
  280. # define STLSOFT_ASSERT(_x) _STLSOFT_CUSTOM_ASSERT(_x)
  281. # if defined(_STLSOFT_CUSTOM_ASSERT_INCLUDE)
  282. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME _STLSOFT_CUSTOM_ASSERT_INCLUDE
  283. # else
  284. # error You must define _STLSOFT_CUSTOM_ASSERT_INCLUDE along with _STLSOFT_CUSTOM_ASSERT()
  285. # endif /* !_STLSOFT_CUSTOM_ASSERT_INCLUDE */
  286. #else /* ? _STLSOFT_CUSTOM_ASSERT */
  287. # define __STLSOFT_CF_ASSERT_SUPPORT
  288. # define STLSOFT_CF_ASSERT_SUPPORT
  289. # define __STLSOFT_CF_ASSERT_INCLUDE_NAME <assert.h>
  290. # define STLSOFT_ASSERT(_x) assert(_x)
  291. #endif /* _STLSOFT_CUSTOM_ASSERT */
  292. /* /////////////////////////////////////////////////////////////////////////
  293. * Calling convention
  294. */
  295. #define STLSOFT_CF_THISCALL_SUPPORTED
  296. #define STLSOFT_CF_CDECL_SUPPORTED
  297. #define STLSOFT_CF_STDCALL_SUPPORTED
  298. #ifdef STLSOFT_CF_CDECL_SUPPORTED
  299. # define STLSOFT_CDECL __cdecl
  300. #endif /* STLSOFT_CF_CDECL_SUPPORTED */
  301. #ifdef STLSOFT_CF_STDCALL_SUPPORTED
  302. # define STLSOFT_STDCALL __stdcall
  303. #endif /* STLSOFT_CF_STDCALL_SUPPORTED */
  304. /* /////////////////////////////////////////////////////////////////////////
  305. * Inline assembler
  306. */
  307. #define STSLSOFT_INLINE_ASM_SUPPORTED
  308. /* #define STSLSOFT_ASM_IN_INLINE_SUPPORTED - must use static */
  309. /* /////////////////////////////////////////////////////////////////////////
  310. * inline support
  311. */
  312. #define STLSOFT_CF_C99_INLINE
  313. /* /////////////////////////////////////////////////////////////////////////
  314. * Compiler warning suppression
  315. */
  316. #pragma warning 14 10 /* Suppresses "Warning! W014: no reference to symbol ..." */
  317. #pragma warning 472 10 /* Suppresses "Warning! W472: expression with side effect in 'sizeof' discarded" */
  318. #pragma warning 555 10 /* Suppresses "Warning! W555: expression for 'while' is always false" */
  319. #pragma warning 594 10 /* Suppresses "Warning! W594: construct resolved as a declaration/type" */
  320. #pragma warning 604 10 /* Suppresses "Warning! W604: must look ahead to determine whether construct is a declaration/type or an expression" */
  321. /* ///////////////////////////// end of file //////////////////////////// */