source: XIOS/dev/dev_olga/src/extern/blitz/include/blitz/compiler.h @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 4.9 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/compiler.h      Compiler specific directives and kludges
4 *
5 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
6 *
7 * This file is a part of Blitz.
8 *
9 * Blitz is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation, either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * Blitz is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
21 *
22 * Suggestions:          blitz-devel@lists.sourceforge.net
23 * Bugs:                 blitz-support@lists.sourceforge.net   
24 *
25 * For more information, please see the Blitz++ Home Page:
26 *    https://sourceforge.net/projects/blitz/
27 *
28 ***************************************************************************/
29
30
31#ifndef BZ_COMPILER_H
32#define BZ_COMPILER_H
33
34// The file <blitz/bzconfig.h> is used to select a compiler-specific
35// config.h file that is generated automatically by configure.
36
37#include <blitz/bzconfig.h>
38
39/*
40 * Define some kludges.
41 */
42
43#ifndef BZ_HAVE_TEMPLATES
44    #error  In <blitz/config.h>: A working template implementation is required by Blitz++ (you may need to rerun the compiler/bzconfig script)
45#endif
46
47#ifndef BZ_HAVE_MEMBER_TEMPLATES
48  #error  In <blitz/config.h>: Your compiler does not support member templates.  (you may need to rerun the compiler/bzconfig script)
49#endif
50
51#ifndef BZ_HAVE_FULL_SPECIALIZATION_SYNTAX
52  #error In <blitz/config.h>: Your compiler does not support template<> full specialization syntax.  You may need to rerun the compiler/bzconfig script.
53#endif
54
55#ifndef BZ_HAVE_PARTIAL_ORDERING
56  #error In <blitz/config.h>: Your compiler does not support partial ordering (you may need to rerun the compiler/bzconfig script)
57#endif
58
59#ifndef BZ_HAVE_PARTIAL_SPECIALIZATION
60  #error In <blitz/config.h>: Your compiler does not support partial specialization (you may need to rerun the compiler/bzconfig script)
61#endif
62
63#ifdef BZ_HAVE_NAMESPACES
64    #define BZ_NAMESPACE(X)        namespace X {
65    #define BZ_NAMESPACE_END       }
66    #define BZ_USING_NAMESPACE(X)  using namespace X;
67#else
68    #define BZ_NAMESPACE(X)
69    #define BZ_NAMESPACE_END
70    #define BZ_USING_NAMESPACE(X)
71#endif
72
73#ifdef BZ_HAVE_TEMPLATE_QUALIFIED_RETURN_TYPE
74  #define BZ_USE_NUMTRAIT
75#endif
76
77#ifdef BZ_HAVE_DEFAULT_TEMPLATE_PARAMETERS
78    #define BZ_TEMPLATE_DEFAULT(X)   = X
79#else
80    #define BZ_TEMPLATE_DEFAULT(X) 
81#endif
82
83#ifndef BZ_HAVE_EXPLICIT
84    #define explicit   
85#endif
86
87#ifdef BZ_HAVE_TYPENAME
88    #define _bz_typename     typename
89#else
90    #define _bz_typename
91#endif
92
93#ifndef BZ_HAVE_MUTABLE
94    #define mutable
95#endif
96
97#ifdef BZ_DISABLE_RESTRICT
98 #undef BZ_HAVE_NCEG_RESTRICT
99#endif
100
101#ifndef BZ_HAVE_NCEG_RESTRICT
102    #if defined(BZ_HAVE_NCEG_RESTRICT_EGCS)
103        #define restrict     __restrict__
104    #else
105        #define restrict
106    #endif
107#endif
108
109#if !defined(BZ_HAVE_BOOL) && !defined(BZ_NO_BOOL_KLUDGE)
110    #define bool    int
111    #define true    1
112    #define false   0
113#endif
114
115#ifdef BZ_HAVE_ENUM_COMPUTATIONS_WITH_CAST
116    #define BZ_ENUM_CAST(X)   (int)X
117#elif defined(BZ_HAVE_ENUM_COMPUTATIONS)
118    #define BZ_ENUM_CAST(X)   X
119#else
120    #error In <blitz/config.h>: Your compiler does not support enum computations.  You may have to rerun compiler/bzconfig.
121#endif
122
123#if defined(BZ_MATH_FN_IN_NAMESPACE_STD)
124  #define BZ_MATHFN_SCOPE(x) std::x
125#elif defined(BZ_HAVE_NAMESPACES)
126  #define BZ_MATHFN_SCOPE(x) ::x
127#else
128  #define BZ_MATHFN_SCOPE(x) x
129#endif
130
131#if defined(BZ_MATH_ABSINT_IN_NAMESPACE_STD)
132#include <cstdlib>
133#else
134#include <stdlib.h>
135#endif
136
137#if defined(BZ_MATH_ABSINT_IN_NAMESPACE_STD)
138  #define BZ_MATHABSINT_SCOPE(x) std::x
139#elif defined(BZ_HAVE_NAMESPACES)
140  #define BZ_MATHABSINT_SCOPE(x) ::x
141#else
142  #define BZ_MATHABSINT_SCOPE(x) x
143#endif
144
145#if defined(BZ_HAVE_COMPLEX_MATH_IN_NAMESPACE_STD)
146  #define BZ_CMATHFN_SCOPE(x) std::x
147#elif defined(BZ_HAVE_NAMESPACES)
148  #define BZ_CMATHFN_SCOPE(x) ::x
149#else
150  #define BZ_CMATHFN_SCOPE(x) x
151#endif
152
153#if defined(BZ_HAVE_NAMESPACES)
154  #define BZ_IEEEMATHFN_SCOPE(x) ::x
155#else
156  #define BZ_IEEEMATHFN_SCOPE(x) x
157#endif
158
159#if defined(BZ_HAVE_NAMESPACES)
160  #define BZ_BLITZ_SCOPE(x) blitz::x
161#else
162  #define BZ_BLITZ_SCOPE(x) ::x
163#endif
164
165#if defined(BZ_HAVE_NAMESPACES) && defined(BZ_HAVE_STD)
166  #define BZ_STD_SCOPE(x) std::x
167#else
168  #define BZ_STD_SCOPE(x) ::x
169#endif
170
171//  These macros are just markers to document the code in the places
172//  where playing with the processor branch prediction scheme might
173//  help. For now these are just nops.
174
175#define BZ_LIKELY(x)   (x)
176#define BZ_UNLIKELY(x) (x)
177
178#endif // BZ_COMPILER_H
179
Note: See TracBrowser for help on using the repository browser.