1 /* ///////////////////////////////////////////////////////////////////////
7 * Brief: Codeplay VectorC C++ compiler traits.
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
17 #ifndef EXTL_COMPILER_IS_VECTORC
18 # error This file has been erroneously included for a compiler other than Codeplay VectorC C/C++
21 /* ///////////////////////////////////////////////////////////////////////
24 #ifdef EXTL_WORKAROUND_VECTORC
25 # undef EXTL_WORKAROUND_VECTORC
28 #define EXTL_WORKAROUND_VECTORC(cmp, ver) ( (__VECTORC != 0) && ( (__VECTORC) cmp (ver) ) )
30 /* ///////////////////////////////////////////////////////////////////////
35 #define EXTL_8BIT_INT_SUPPORT
36 #define EXTL_SI08_BASE_TYPE signed char
37 #define EXTL_UI08_BASE_TYPE unsigned char
40 #define EXTL_16BIT_INT_SUPPORT
41 #define EXTL_SI16_BASE_TYPE signed short
42 #define EXTL_UI16_BASE_TYPE unsigned short
45 #define EXTL_32BIT_INT_SUPPORT
46 #define EXTL_SI32_BASE_TYPE signed int
47 #define EXTL_UI32_BASE_TYPE unsigned int
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
64 static const e_int64_t value = 10;
67 #ifdef EXTL_MEMBER_CONSTANT_SUPPORT
68 # define EXTL_MEMBER_CONSTANT_64BIT_SUPPORT
70 /* ///////////////////////////////////////////////////////////////////////
73 #define EXTL_NAMESPACE_SUPPORT
74 #define EXTL_STD_NAMESPACE
76 /* ///////////////////////////////////////////////////////////////////////
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 */
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
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
150 func1() { printf("%d\n", N); }
152 template <typename T>
153 func2() { printf("%s\n", typeid(T).name()); }
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
179 template<template<typename T> class class_temp = class_1 >
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
191 # define EXTL_NATIVE_BOOL_SUPPORT
194 /* ///////////////////////////////////////////////////////////////////////
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
213 # define EXTL_PRAGMA_MESSAGE_SUPPORT
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
253 #ifdef EXTL_FASTCALL_SUPPORT
254 # define EXTL_FASTCALL __fastcall
257 #ifdef EXTL_STDCALL_SUPPORT
258 # define EXTL_STDCALL __stdcall
261 /* ///////////////////////////////////////////////////////////////////////
262 * Ellipsis in function testing support
263 * eg: void func(...);
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 /* ///////////////////////////////////////////////////////////////////////
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 */
297 #define EXTL_MUTABLE_KEYWORD_SUPPORT
300 #define EXTL_EXPLICIT_KEYWORD_SUPPORT
302 /* ///////////////////////////////////////////////////////////////////////
306 # define EXTL_EXCEPTION_SUPPORT
309 /* Exception signature support (eg: void func() throw(e1, e2, ...);) */
311 # define EXTL_EXCEPTION_SIGNATURE_SUPPORT
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;}
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 /* ///////////////////////////////////////////////////////////////////////
354 * eg: class derived_class : public base_class< derived_class > {};
356 #define EXTL_CRTP_SUPPORT
358 /* ///////////////////////////////////////////////////////////////////////
359 * EBO(empty base optimization) support
363 * empty_child - empty_base
365 #define EXTL_EBO_FORM_1_SUPPORT
368 * non_empty_child - empty_base
370 #define EXTL_EBO_FORM_2_SUPPORT
373 * empty_child - empty_base2 - empty_base1
375 #define EXTL_EBO_FORM_3_SUPPORT
378 * non_empty_child - empty_base2 - empty_base1
380 #define EXTL_EBO_FORM_4_SUPPORT
389 /* #define EXTL_EBO_FORM_5_SUPPORT */
398 /*#define EXTL_EBO_FORM_6_SUPPORT*/
407 #define EXTL_EBO_FORM_7_SUPPORT
409 /* ///////////////////////////////////////////////////////////////////////
410 * EDO(empty derived optimization) support
414 * empty_child - empty_base
416 #define EXTL_EDO_FORM_1_SUPPORT
419 * empty_child_template - empty_base
421 #define EXTL_EDO_FORM_2_SUPPORT
424 * empty_child - non_empty_base
426 #define EXTL_EDO_FORM_3_SUPPORT
429 * empty_child_template - non_empty_base
431 #define EXTL_EDO_FORM_4_SUPPORT
440 /*#define EXTL_EDO_FORM_5_SUPPORT*/
445 * empty_child_template -
449 /*#define EXTL_EDO_FORM_6_SUPPORT*/
458 #define EXTL_EDO_FORM_7_SUPPORT
463 * empty_child_template -
467 #define EXTL_EDO_FORM_8_SUPPORT
469 /* ///////////////////////////////////////////////////////////////////////
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
495 * typedef class_type<T> friend_type;
496 * friend friend_type;
498 #define EXTL_TYPE_ALIAS_FRIEND_SUPPORT