1 | /*************************************************************************** |
---|
2 | * blitz/compiler.h Compiler specific directives and kludges |
---|
3 | * |
---|
4 | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of the GNU General Public License |
---|
8 | * as published by the Free Software Foundation; either version 2 |
---|
9 | * of the License, or (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * Suggestions: blitz-dev@oonumerics.org |
---|
17 | * Bugs: blitz-bugs@oonumerics.org |
---|
18 | * |
---|
19 | * For more information, please see the Blitz++ Home Page: |
---|
20 | * http://oonumerics.org/blitz/ |
---|
21 | * |
---|
22 | ***************************************************************************/ |
---|
23 | |
---|
24 | |
---|
25 | #ifndef BZ_COMPILER_H |
---|
26 | #define BZ_COMPILER_H |
---|
27 | |
---|
28 | // The file <blitz/bzconfig.h> is used to select a compiler-specific |
---|
29 | // config.h file that is generated automatically by configure. |
---|
30 | |
---|
31 | #include <blitz/bzconfig.h> |
---|
32 | |
---|
33 | /* |
---|
34 | * Define some kludges. |
---|
35 | */ |
---|
36 | |
---|
37 | #ifndef BZ_HAVE_TEMPLATES |
---|
38 | #error In <blitz/config.h>: A working template implementation is required by Blitz++ (you may need to rerun the compiler/bzconfig script) |
---|
39 | #endif |
---|
40 | |
---|
41 | #ifndef BZ_HAVE_MEMBER_TEMPLATES |
---|
42 | #error In <blitz/config.h>: Your compiler does not support member templates. (you may need to rerun the compiler/bzconfig script) |
---|
43 | #endif |
---|
44 | |
---|
45 | #ifndef BZ_HAVE_FULL_SPECIALIZATION_SYNTAX |
---|
46 | #error In <blitz/config.h>: Your compiler does not support template<> full specialization syntax. You may need to rerun the compiler/bzconfig script. |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifndef BZ_HAVE_PARTIAL_ORDERING |
---|
50 | #error In <blitz/config.h>: Your compiler does not support partial ordering (you may need to rerun the compiler/bzconfig script) |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifndef BZ_HAVE_PARTIAL_SPECIALIZATION |
---|
54 | #error In <blitz/config.h>: Your compiler does not support partial specialization (you may need to rerun the compiler/bzconfig script) |
---|
55 | #endif |
---|
56 | |
---|
57 | #ifdef BZ_HAVE_NAMESPACES |
---|
58 | #define BZ_NAMESPACE(X) namespace X { |
---|
59 | #define BZ_NAMESPACE_END } |
---|
60 | #define BZ_USING_NAMESPACE(X) using namespace X; |
---|
61 | #else |
---|
62 | #define BZ_NAMESPACE(X) |
---|
63 | #define BZ_NAMESPACE_END |
---|
64 | #define BZ_USING_NAMESPACE(X) |
---|
65 | #endif |
---|
66 | |
---|
67 | #ifdef BZ_HAVE_TEMPLATE_QUALIFIED_RETURN_TYPE |
---|
68 | #define BZ_USE_NUMTRAIT |
---|
69 | #endif |
---|
70 | |
---|
71 | #ifdef BZ_HAVE_DEFAULT_TEMPLATE_PARAMETERS |
---|
72 | #define BZ_TEMPLATE_DEFAULT(X) = X |
---|
73 | #else |
---|
74 | #define BZ_TEMPLATE_DEFAULT |
---|
75 | #endif |
---|
76 | |
---|
77 | #ifndef BZ_HAVE_EXPLICIT |
---|
78 | #define explicit |
---|
79 | #endif |
---|
80 | |
---|
81 | #ifdef BZ_HAVE_TYPENAME |
---|
82 | #define _bz_typename typename |
---|
83 | #else |
---|
84 | #define _bz_typename |
---|
85 | #endif |
---|
86 | |
---|
87 | #ifndef BZ_HAVE_MUTABLE |
---|
88 | #define mutable |
---|
89 | #endif |
---|
90 | |
---|
91 | #ifdef BZ_DISABLE_RESTRICT |
---|
92 | #undef BZ_HAVE_NCEG_RESTRICT |
---|
93 | #endif |
---|
94 | |
---|
95 | #ifndef BZ_HAVE_NCEG_RESTRICT |
---|
96 | #if defined(BZ_HAVE_NCEG_RESTRICT_EGCS) |
---|
97 | #define restrict __restrict__ |
---|
98 | #else |
---|
99 | #define restrict |
---|
100 | #endif |
---|
101 | #endif |
---|
102 | |
---|
103 | #if !defined(BZ_HAVE_BOOL) && !defined(BZ_NO_BOOL_KLUDGE) |
---|
104 | #define bool int |
---|
105 | #define true 1 |
---|
106 | #define false 0 |
---|
107 | #endif |
---|
108 | |
---|
109 | #ifdef BZ_HAVE_ENUM_COMPUTATIONS_WITH_CAST |
---|
110 | #define BZ_ENUM_CAST(X) (int)X |
---|
111 | #elif defined(BZ_HAVE_ENUM_COMPUTATIONS) |
---|
112 | #define BZ_ENUM_CAST(X) X |
---|
113 | #else |
---|
114 | #error In <blitz/config.h>: Your compiler does not support enum computations. You may have to rerun compiler/bzconfig. |
---|
115 | #endif |
---|
116 | |
---|
117 | #if defined(BZ_MATH_FN_IN_NAMESPACE_STD) |
---|
118 | #define BZ_MATHFN_SCOPE(x) std::x |
---|
119 | #elif defined(BZ_HAVE_NAMESPACES) |
---|
120 | #define BZ_MATHFN_SCOPE(x) ::x |
---|
121 | #else |
---|
122 | #define BZ_MATHFN_SCOPE(x) x |
---|
123 | #endif |
---|
124 | |
---|
125 | #if defined(BZ_HAVE_COMPLEX_MATH_IN_NAMESPACE_STD) |
---|
126 | #define BZ_CMATHFN_SCOPE(x) std::x |
---|
127 | #elif defined(BZ_HAVE_NAMESPACES) |
---|
128 | #define BZ_CMATHFN_SCOPE(x) ::x |
---|
129 | #else |
---|
130 | #define BZ_CMATHFN_SCOPE(x) x |
---|
131 | #endif |
---|
132 | |
---|
133 | #if defined(BZ_HAVE_NAMESPACES) |
---|
134 | #define BZ_IEEEMATHFN_SCOPE(x) ::x |
---|
135 | #else |
---|
136 | #define BZ_IEEEMATHFN_SCOPE(x) x |
---|
137 | #endif |
---|
138 | |
---|
139 | #if defined(BZ_HAVE_NAMESPACES) |
---|
140 | #define BZ_BLITZ_SCOPE(x) blitz::x |
---|
141 | #else |
---|
142 | #define BZ_BLITZ_SCOPE(x) ::x |
---|
143 | #endif |
---|
144 | |
---|
145 | #if defined(BZ_HAVE_NAMESPACES) && defined(BZ_HAVE_STD) |
---|
146 | #define BZ_STD_SCOPE(x) std::x |
---|
147 | #else |
---|
148 | #define BZ_STD_SCOPE(x) ::x |
---|
149 | #endif |
---|
150 | |
---|
151 | #endif // BZ_COMPILER_H |
---|
152 | |
---|