blitz Version 1.0.2
Loading...
Searching...
No Matches
compiler.h
Go to the documentation of this file.
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_TEMPLATE_QUALIFIED_RETURN_TYPE
64 #define BZ_USE_NUMTRAIT
65#endif
66
67#ifdef BZ_HAVE_DEFAULT_TEMPLATE_PARAMETERS
68 #define BZ_TEMPLATE_DEFAULT(X) = X
69#else
70 #define BZ_TEMPLATE_DEFAULT(X)
71#endif
72
73#ifndef BZ_HAVE_EXPLICIT
74 #define explicit
75#endif
76
77#ifdef BZ_HAVE_TYPENAME
78 #define _bz_typename typename
79#else
80 #define _bz_typename
81#endif
82
83#ifndef BZ_HAVE_MUTABLE
84 #define mutable
85#endif
86
87#ifdef BZ_DISABLE_RESTRICT
88 #undef BZ_HAVE_NCEG_RESTRICT
89#endif
90
91#ifndef BZ_HAVE_NCEG_RESTRICT
92 #if defined(BZ_HAVE_NCEG_RESTRICT_EGCS)
93 #define restrict __restrict__
94 #else
95 #define restrict
96 #endif
97#endif
98
99#if !defined(BZ_HAVE_BOOL) && !defined(BZ_NO_BOOL_KLUDGE)
100 #define bool int
101 #define true 1
102 #define false 0
103#endif
104
105#ifdef BZ_HAVE_ENUM_COMPUTATIONS_WITH_CAST
106 #define BZ_ENUM_CAST(X) (int)X
107#elif defined(BZ_HAVE_ENUM_COMPUTATIONS)
108 #define BZ_ENUM_CAST(X) X
109#else
110 #error In <blitz/config.h>: Your compiler does not support enum computations. You may have to rerun compiler/bzconfig.
111#endif
112
113#if defined(BZ_MATH_FN_IN_NAMESPACE_STD)
114 #define BZ_MATHFN_SCOPE(x) std::x
115#else
116 #define BZ_MATHFN_SCOPE(x) ::x
117#endif
118
119#if defined(BZ_MATH_ABSINT_IN_NAMESPACE_STD)
120#include <cstdlib>
121#else
122#include <stdlib.h>
123#endif
124
125#if defined(BZ_MATH_ABSINT_IN_NAMESPACE_STD)
126 #define BZ_MATHABSINT_SCOPE(x) std::x
127#else
128 #define BZ_MATHABSINT_SCOPE(x) ::x
129#endif
130
131#if defined(BZ_HAVE_COMPLEX_MATH_IN_NAMESPACE_STD)
132 #define BZ_CMATHFN_SCOPE(x) std::x
133#else
134 #define BZ_CMATHFN_SCOPE(x) ::x
135#endif
136
137#define BZ_IEEEMATHFN_SCOPE(x) ::x
138
139// These macros are just markers to document the code in the places
140// where playing with the processor branch prediction scheme might
141// help. For now these are just nops.
142
143#define BZ_LIKELY(x) (x)
144#define BZ_UNLIKELY(x) (x)
145
146#endif // BZ_COMPILER_H
147