blitz Version 0.9
|
00001 /*************************************************************************** 00002 * blitz/compiler.h Compiler specific directives and kludges 00003 * 00004 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * Suggestions: blitz-dev@oonumerics.org 00017 * Bugs: blitz-bugs@oonumerics.org 00018 * 00019 * For more information, please see the Blitz++ Home Page: 00020 * http://oonumerics.org/blitz/ 00021 * 00022 ***************************************************************************/ 00023 00024 00025 #ifndef BZ_COMPILER_H 00026 #define BZ_COMPILER_H 00027 00028 // The file <blitz/bzconfig.h> is used to select a compiler-specific 00029 // config.h file that is generated automatically by configure. 00030 00031 #include <blitz/bzconfig.h> 00032 00033 /* 00034 * Define some kludges. 00035 */ 00036 00037 #ifndef BZ_HAVE_TEMPLATES 00038 #error In <blitz/config.h>: A working template implementation is required by Blitz++ (you may need to rerun the compiler/bzconfig script) 00039 #endif 00040 00041 #ifndef BZ_HAVE_MEMBER_TEMPLATES 00042 #error In <blitz/config.h>: Your compiler does not support member templates. (you may need to rerun the compiler/bzconfig script) 00043 #endif 00044 00045 #ifndef BZ_HAVE_FULL_SPECIALIZATION_SYNTAX 00046 #error In <blitz/config.h>: Your compiler does not support template<> full specialization syntax. You may need to rerun the compiler/bzconfig script. 00047 #endif 00048 00049 #ifndef BZ_HAVE_PARTIAL_ORDERING 00050 #error In <blitz/config.h>: Your compiler does not support partial ordering (you may need to rerun the compiler/bzconfig script) 00051 #endif 00052 00053 #ifndef BZ_HAVE_PARTIAL_SPECIALIZATION 00054 #error In <blitz/config.h>: Your compiler does not support partial specialization (you may need to rerun the compiler/bzconfig script) 00055 #endif 00056 00057 #ifdef BZ_HAVE_NAMESPACES 00058 #define BZ_NAMESPACE(X) namespace X { 00059 #define BZ_NAMESPACE_END } 00060 #define BZ_USING_NAMESPACE(X) using namespace X; 00061 #else 00062 #define BZ_NAMESPACE(X) 00063 #define BZ_NAMESPACE_END 00064 #define BZ_USING_NAMESPACE(X) 00065 #endif 00066 00067 #ifdef BZ_HAVE_TEMPLATE_QUALIFIED_RETURN_TYPE 00068 #define BZ_USE_NUMTRAIT 00069 #endif 00070 00071 #ifdef BZ_HAVE_DEFAULT_TEMPLATE_PARAMETERS 00072 #define BZ_TEMPLATE_DEFAULT(X) = X 00073 #else 00074 #define BZ_TEMPLATE_DEFAULT 00075 #endif 00076 00077 #ifndef BZ_HAVE_EXPLICIT 00078 #define explicit 00079 #endif 00080 00081 #ifdef BZ_HAVE_TYPENAME 00082 #define _bz_typename typename 00083 #else 00084 #define _bz_typename 00085 #endif 00086 00087 #ifndef BZ_HAVE_MUTABLE 00088 #define mutable 00089 #endif 00090 00091 #ifdef BZ_DISABLE_RESTRICT 00092 #undef BZ_HAVE_NCEG_RESTRICT 00093 #endif 00094 00095 #ifndef BZ_HAVE_NCEG_RESTRICT 00096 #if defined(BZ_HAVE_NCEG_RESTRICT_EGCS) 00097 #define restrict __restrict__ 00098 #else 00099 #define restrict 00100 #endif 00101 #endif 00102 00103 #if !defined(BZ_HAVE_BOOL) && !defined(BZ_NO_BOOL_KLUDGE) 00104 #define bool int 00105 #define true 1 00106 #define false 0 00107 #endif 00108 00109 #ifdef BZ_HAVE_ENUM_COMPUTATIONS_WITH_CAST 00110 #define BZ_ENUM_CAST(X) (int)X 00111 #elif defined(BZ_HAVE_ENUM_COMPUTATIONS) 00112 #define BZ_ENUM_CAST(X) X 00113 #else 00114 #error In <blitz/config.h>: Your compiler does not support enum computations. You may have to rerun compiler/bzconfig. 00115 #endif 00116 00117 #if defined(BZ_MATH_FN_IN_NAMESPACE_STD) 00118 #define BZ_MATHFN_SCOPE(x) std::x 00119 #elif defined(BZ_HAVE_NAMESPACES) 00120 #define BZ_MATHFN_SCOPE(x) ::x 00121 #else 00122 #define BZ_MATHFN_SCOPE(x) x 00123 #endif 00124 00125 #if defined(BZ_HAVE_COMPLEX_MATH_IN_NAMESPACE_STD) 00126 #define BZ_CMATHFN_SCOPE(x) std::x 00127 #elif defined(BZ_HAVE_NAMESPACES) 00128 #define BZ_CMATHFN_SCOPE(x) ::x 00129 #else 00130 #define BZ_CMATHFN_SCOPE(x) x 00131 #endif 00132 00133 #if defined(BZ_HAVE_NAMESPACES) 00134 #define BZ_IEEEMATHFN_SCOPE(x) ::x 00135 #else 00136 #define BZ_IEEEMATHFN_SCOPE(x) x 00137 #endif 00138 00139 #if defined(BZ_HAVE_NAMESPACES) 00140 #define BZ_BLITZ_SCOPE(x) blitz::x 00141 #else 00142 #define BZ_BLITZ_SCOPE(x) ::x 00143 #endif 00144 00145 #if defined(BZ_HAVE_NAMESPACES) && defined(BZ_HAVE_STD) 00146 #define BZ_STD_SCOPE(x) std::x 00147 #else 00148 #define BZ_STD_SCOPE(x) ::x 00149 #endif 00150 00151 #endif // BZ_COMPILER_H 00152