remove \r
[extl.git] / extl / config / compiler / vectorc.h
bloba71bd8002766b0622bfe71b752eae7d57cb0b8ee
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: vectorc.h
4 * Created: 08.02.02
5 * Updated: 08.04.14
7 * Brief: Codeplay VectorC C++ compiler traits.
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_CONFIG_COMPILER_H
14 # error This file must be included of config.h
15 #endif
17 #ifndef EXTL_COMPILER_IS_VECTORC
18 # error This file has been erroneously included for a compiler other than Codeplay VectorC C/C++
19 #endif
21 /* ///////////////////////////////////////////////////////////////////////
22 * Workaround
24 #ifdef EXTL_WORKAROUND_VECTORC
25 # undef EXTL_WORKAROUND_VECTORC
26 #endif
28 #define EXTL_WORKAROUND_VECTORC(cmp, ver) ( (__VECTORC != 0) && ( (__VECTORC) cmp (ver) ) )
30 /* ///////////////////////////////////////////////////////////////////////
31 * Interger
34 /* 8-bit */
35 #define EXTL_8BIT_INT_SUPPORT
36 #define EXTL_SI08_BASE_TYPE signed char
37 #define EXTL_UI08_BASE_TYPE unsigned char
39 /* 16-bit */
40 #define EXTL_16BIT_INT_SUPPORT
41 #define EXTL_SI16_BASE_TYPE signed short
42 #define EXTL_UI16_BASE_TYPE unsigned short
44 /* 32-bit */
45 #define EXTL_32BIT_INT_SUPPORT
46 #define EXTL_SI32_BASE_TYPE signed int
47 #define EXTL_UI32_BASE_TYPE unsigned int
49 /* 64-bit */
50 #define EXTL_64BIT_INT_SUPPORT
51 #define EXTL_64BIT_INT_IS_long_long
52 #define EXTL_SI64_BASE_TYPE signed long long
53 #define EXTL_UI64_BASE_TYPE unsigned long long
55 /* ///////////////////////////////////////////////////////////////////////
56 * Class member constants support
58 #define EXTL_MEMBER_CONSTANT_SUPPORT
60 /* 64-bit Class member constants
61 * e.g.
62 struct type
64 static const e_int64_t value = 10;
67 #ifdef EXTL_MEMBER_CONSTANT_SUPPORT
68 # define EXTL_MEMBER_CONSTANT_64BIT_SUPPORT
69 #endif
70 /* ///////////////////////////////////////////////////////////////////////
71 * Namespace support
73 #define EXTL_NAMESPACE_SUPPORT
74 #define EXTL_STD_NAMESPACE
76 /* ///////////////////////////////////////////////////////////////////////
77 * Template support
79 #define EXTL_TEMPLATE_SUPPORT
81 /* Class member template function support */
82 #define EXTL_MEMBER_TEMPLATE_FUNCTION_SUPPORT
84 /* Class member template function overload discriminated support */
85 #define EXTL_MEMBER_TEMPLATE_FUNC_OVERLOAD_DISCRIMINATED_SUPPORT
87 /* Class member template constructor support */
88 #define EXTL_MEMBER_TEMPLATE_CTOR_SUPPORT
90 /* Class member template constructor overload discriminated support */
91 #define EXTL_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED_SUPPORT
93 /* Template specialization support */
94 #define EXTL_TEMPLATE_SPEC_SUPPORT
96 /* Template specialization syntax support: template<> */
97 #define EXTL_TEMPLATE_SPEC_SYNTAX_SUPPORT
99 /* Template partial specialization support */
100 #define EXTL_TEMPLATE_PARTIAL_SPEC_SUPPORT
102 /* Template partial specialization with array type support */
103 #define EXTL_TEMPLATE_PARTIAL_SPEC_ARRAY_TYPE_SUPPORT
105 /* Template partial specialization about function pointer support */
106 /* #define EXTL_TEMPLATE_PARTIAL_SPEC_FUNC_PTR_SUPPORT */
108 /* Template partial specialization about member function pointer support */
109 /* #define EXTL_TEMPLATE_PARTIAL_SPEC_MEM_FUNC_PTR_SUPPORT */
111 /* Template partial specialization with function calling convention support
112 * e.g. <int (__cdecl*)()>
114 /* #define EXTL_TEMPLATE_PARTIAL_SPEC_WITH_FUNC_CALL_CONV_SUPPORT */
116 /* Distinguishes different function calling convention in template partial specialization support
117 * CDECL, FASTCALL and STDCALL are different function calling convention
119 /* #define EXTL_TEMPLATE_PARTIAL_SPEC_DISTINGUISH_DIFFERENT_FUNC_CALL_CONV_SUPPORT */
121 /* Template class default argument support */
122 #define EXTL_TEMPLATE_CLASS_DEFAULT_ARGUMENT_SUPPORT
124 /* Member template class support */
125 #define EXTL_MEMBER_TEMPLATE_CLASS_SUPPORT
127 /* Member template friend support */
128 /* δ²âÊÔ */
129 #define EXTL_MEMBER_TEMPLATE_FRIEND_SUPPORT
131 /* Template type required in template function argument list */
132 /* #define EXTL_TEMPLATE_TYPE_REQUIRED_IN_ARGLIST */
134 /* Function template non-type param support eg:template <typename T, int N> */
135 #define EXTL_FUNCTION_TEMPLATE_NON_TYPE_PARAM_SUPPORT
137 /* template non-type default parameter dependent support
138 * e.g.
140 template< int N = 1
141 , typename T = class1<N> //<=
144 #define EXTL_TEMPLATE_NON_TYPE_DEFAULT_PARAM_DEPENDENT_SUPPORT
146 /* Some compilers just generate one instantiation of function templates whose
147 * template parameters don't appear in the function parameter list
148 * e.g.
149 template <int N>
150 func1() { printf("%d\n", N); }
152 template <typename T>
153 func2() { printf("%s\n", typeid(T).name()); }
155 int main()
157 func1<1>();
158 func1<2>();
159 func2<int>();
160 func2<double>();
162 * If it is supported, the output is: 1 2 int double
163 * otherwise, the output is: 2 2 double double
165 #define EXTL_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS_SUPPORT
167 /* Member function as template param support */
168 #define EXTL_MEM_FUNC_AS_TEMPLATE_PARAM_SUPPORT
170 /* template<typenam T, T N> support */
171 #define EXTL_TEMPLATE_TYPENAME_T_T_N_SUPPORT
173 /* Template template support
174 * e.g.
176 template<typename T>
177 struct class_1{};
179 template<template<typename T> class class_temp = class_1 >
180 struct class_2{};
183 #define EXTL_TEMPLATE_TEMPLATE_SUPPORT
185 /* Template specialization within template classes support(not testing) */
186 /* #define EXTL_TEMPLATE_SPEC_WITHIN_TEMPLATE_CLASS_SUPPORT */
187 /* ///////////////////////////////////////////////////////////////////////
188 * Native bool support
190 #ifdef __cplusplus
191 # define EXTL_NATIVE_BOOL_SUPPORT
192 #endif
194 /* ///////////////////////////////////////////////////////////////////////
195 * wchar_t support
197 #define EXTL_NATIVE_WCHAR_T_SUPPORT
199 /* ///////////////////////////////////////////////////////////////////////
200 * Current function name
202 #define EXTL_CURRENT_FUNCTION __FUNCTION__
204 /* ///////////////////////////////////////////////////////////////////////
205 * Static array size determination support
207 /* #define EXTL_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT */
209 /* ///////////////////////////////////////////////////////////////////////
210 * #pragma message support
212 #ifdef _MSC_VER
213 # define EXTL_PRAGMA_MESSAGE_SUPPORT
214 #endif
216 /* ///////////////////////////////////////////////////////////////////////
217 * #pragma once support
219 /* #define EXTL_PRAGMA_ONCE_SUPPORT */
221 /* ///////////////////////////////////////////////////////////////////////
222 * Member constant initialization support
224 #define EXTL_MEMBER_CONST_INIT_SUPPORT
226 /* ///////////////////////////////////////////////////////////////////////
227 * Inline assembly support
229 #define EXTL_INLINE_ASM_SUPPORT
230 #define EXTL_INLINE_ASM_IN_INLINE_SUPPORT
232 /* ///////////////////////////////////////////////////////////////////////
233 * cv-qualified void specialization support
235 #define EXTL_CV_VOID_SPEC_SUPPORT
237 /* ///////////////////////////////////////////////////////////////////////
238 * cv-qualified specialization support
240 #define EXTL_CV_SPEC_SUPPORT
242 /* ///////////////////////////////////////////////////////////////////////
243 * Call convention support
245 #define EXTL_CDECL_SUPPORT
246 #define EXTL_FASTCALL_SUPPORT
247 #define EXTL_STDCALL_SUPPORT
249 #ifdef EXTL_CDECL_SUPPORT
250 # define EXTL_CDECL __cdecl
251 #endif
253 #ifdef EXTL_FASTCALL_SUPPORT
254 # define EXTL_FASTCALL __fastcall
255 #endif
257 #ifdef EXTL_STDCALL_SUPPORT
258 # define EXTL_STDCALL __stdcall
259 #endif
261 /* ///////////////////////////////////////////////////////////////////////
262 * Ellipsis in function testing support
263 * eg: void func(...);
265 /* no testing */
266 #define EXTL_ELLIPSIS_IN_FUNC_TESTING_SUPPORT
268 /* ///////////////////////////////////////////////////////////////////////
269 * Ellipsis in template partial specializtion about function testing support
270 * eg: template <typename T> struct type<void (*)(...)>
272 #define EXTL_ELLIPSIS_IN_TEMPLATE_PARTIAL_SPEC_FUNC_TESTING_SUPPORT
274 /* ///////////////////////////////////////////////////////////////////////
275 * Keywords support
278 /* typename eg: template < typename T > or template < class T > */
279 #define EXTL_TYPENAME_PARAM_KEYWORD_SUPPORT
281 /* typename typename eg: typedef typename template_class<T>::type type; */
282 #define EXTL_TYPENAME_TYPE_KEYWORD_SUPPORT
284 /* typename eg: template< class A = typename template_class<T>::type > */
285 /* #define EXTL_TYPENAME_TYPE_DEF_KEYWORD_SUPPORT */
287 /* typename qualifier in constructor initialiser lists */
288 /* #define EXTL_TYPENAME_TYPE_MIL_KEYWORD_SUPPORT */
290 /* typename eg: typename template_class<T>::type func(); */
291 /* #define EXTL_TYPENAME_TYPE_RET_KEYWORD_SUPPORT */
293 /* template eg: typedef A::template a<T>::type type; */
294 /* #define EXTL_TEMPLATE_QUAL_KEYWORD_SUPPORT */
296 /* mutable */
297 #define EXTL_MUTABLE_KEYWORD_SUPPORT
299 /* explicit */
300 #define EXTL_EXPLICIT_KEYWORD_SUPPORT
302 /* ///////////////////////////////////////////////////////////////////////
303 * Exception support
305 #ifdef _CPPUNWIND
306 # define EXTL_EXCEPTION_SUPPORT
307 #endif
309 /* Exception signature support (eg: void func() throw(e1, e2, ...);) */
310 #ifdef __CPPUNWIND
311 # define EXTL_EXCEPTION_SIGNATURE_SUPPORT
312 #endif
314 /* throw std::bad_alloc() support */
315 #define EXTL_THROW_BAD_ALLOC_SUPPORT
317 /* ///////////////////////////////////////////////////////////////////////
318 * Return void support
319 * eg: return (void)0;
321 /* #define EXTL_RETURN_VOID_SUPPORT */
323 /* ///////////////////////////////////////////////////////////////////////
324 * Member pointer as bool return support
325 * eg: int (class_type::*) func(){return &class_type::member;}
326 * if(func()){...}
329 /* #define EXTL_MEM_PTR_AS_BOOL_RET_SUPPORT */
331 /* ///////////////////////////////////////////////////////////////////////
332 * 64-bit interger format output support
333 * eg: printf("%I64d", ...);
336 #define EXTL_PRINTF_I64_FORMAT_SUPPORT
338 /* ///////////////////////////////////////////////////////////////////////
339 * Named return value optimization support
341 /* #define EXTL_NRVO_SUPPORT */
343 /* ///////////////////////////////////////////////////////////////////////
344 * Property support (no test)
345 * Note: Compiler extensibity
347 /*#define EXTL_PROPERTY_SUPPORT*/
348 #define EXTL_PROPERTY_GET(type, property_name, method)
349 #define EXTL_PROPERTY_SET(type, property_name, method)
350 #define EXTL_PROPERTY_GETSET(type, property_name, get_method, set_method)
352 /* ///////////////////////////////////////////////////////////////////////
353 * CRTP support
354 * eg: class derived_class : public base_class< derived_class > {};
356 #define EXTL_CRTP_SUPPORT
358 /* ///////////////////////////////////////////////////////////////////////
359 * EBO(empty base optimization) support
362 /* EBO1:
363 * empty_child - empty_base
365 #define EXTL_EBO_FORM_1_SUPPORT
367 /* EBO2:
368 * non_empty_child - empty_base
370 #define EXTL_EBO_FORM_2_SUPPORT
372 /* EBO3:
373 * empty_child - empty_base2 - empty_base1
375 #define EXTL_EBO_FORM_3_SUPPORT
377 /* EBO4:
378 * non_empty_child - empty_base2 - empty_base1
380 #define EXTL_EBO_FORM_4_SUPPORT
382 /* EBO5:
383 * empty_base1
384 * /
385 * empty_child -
387 * empty_base2
389 /* #define EXTL_EBO_FORM_5_SUPPORT */
391 /* EBO6:
392 * empty_base1
393 * /
394 * non_empty_child -
396 * empty_base2
398 /*#define EXTL_EBO_FORM_6_SUPPORT*/
400 /* EBO7:
401 * empty_base1
402 * /
403 * empty_child -
405 * non_empty_base2
407 #define EXTL_EBO_FORM_7_SUPPORT
409 /* ///////////////////////////////////////////////////////////////////////
410 * EDO(empty derived optimization) support
413 /* EDO1:
414 * empty_child - empty_base
416 #define EXTL_EDO_FORM_1_SUPPORT
418 /* EDO2:
419 * empty_child_template - empty_base
421 #define EXTL_EDO_FORM_2_SUPPORT
423 /* EDO3:
424 * empty_child - non_empty_base
426 #define EXTL_EDO_FORM_3_SUPPORT
428 /* EDO4:
429 * empty_child_template - non_empty_base
431 #define EXTL_EDO_FORM_4_SUPPORT
433 /* EDO5:
434 * empty_base1
435 * /
436 * empty_child -
438 * empty_base2
440 /*#define EXTL_EDO_FORM_5_SUPPORT*/
442 /* EDO6:
443 * empty_base1
444 * /
445 * empty_child_template -
447 * empty_base2
449 /*#define EXTL_EDO_FORM_6_SUPPORT*/
451 /* EDO7:
452 * empty_base1
453 * /
454 * empty_child -
456 * non_empty_base2
458 #define EXTL_EDO_FORM_7_SUPPORT
460 /* EDO8:
461 * empty_base1
462 * /
463 * empty_child_template -
465 * non_empty_base2
467 #define EXTL_EDO_FORM_8_SUPPORT
469 /* ///////////////////////////////////////////////////////////////////////
470 * c++0x support
473 /* Rvalue references support */
474 /* #define EXTL_0x_RVALUE_REFERENCE_SUPPORT */
476 /* Variadic templates support */
477 /* #define EXTL_0x_VARIADIC_TEMPLATE_SUPPORT */
479 /* Static assertions support */
480 /* #define EXTL_0x_STATIC_ASSERT_SUPPORT */
482 /* Right angle brackets support
483 * e.g. vector<vector<int>> will be compiled sucessfully
485 /* #define EXTL_0x_RIGHT_ANGLE_BRACKET_SUPPORT */
487 /* Inline namespaces support
488 * e.g. inline namespace{}
490 /* #define EXTL_0x_INLINE_NAMESPACE_SUPPORT */
492 /* ///////////////////////////////////////////////////////////////////////
493 * type alias friend support
494 * e.g.
495 * typedef class_type<T> friend_type;
496 * friend friend_type;
498 #define EXTL_TYPE_ALIAS_FRIEND_SUPPORT