compiler_setup.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2010 NICTA and the authors listed below
00002 // http://nicta.com.au
00003 // 
00004 // Authors:
00005 // - Conrad Sanderson (conradsand at ieee dot org)
00006 // 
00007 // This file is part of the Armadillo C++ library.
00008 // It is provided without any warranty of fitness
00009 // for any purpose. You can redistribute this file
00010 // and/or modify it under the terms of the GNU
00011 // Lesser General Public License (LGPL) as published
00012 // by the Free Software Foundation, either version 3
00013 // of the License or (at your option) any later version.
00014 // (see http://www.opensource.org/licenses for more info)
00015 
00016 
00017 
00018 #define arma_hot
00019 #define arma_cold
00020 #define arma_pure
00021 #define arma_const
00022 #define arma_inline  inline
00023 #define arma_aligned
00024 #define arma_warn_unused
00025 #define arma_deprecated
00026 
00027 #if defined(__GNUG__)
00028   
00029   #if (__GNUC__ < 4)
00030     #error "*** Need a newer compiler ***"
00031   #endif
00032   
00033   #define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00034   
00035   #define ARMA_GOOD_COMPILER
00036   #undef  ARMA_HAVE_STD_TR1
00037   
00038   #undef  arma_pure
00039   #undef  arma_const
00040   #undef  arma_inline
00041   #undef  arma_aligned
00042   #undef  arma_warn_unused
00043   #undef  arma_deprecated
00044   
00045   #define arma_pure               __attribute__((pure))
00046   #define arma_const              __attribute__((const))
00047   #define arma_inline      inline __attribute__((always_inline))
00048   #define arma_aligned            __attribute__((aligned))
00049   #define arma_warn_unused        __attribute__((warn_unused_result))
00050   #define arma_deprecated         __attribute__((deprecated))
00051   
00052   #if (ARMA_GCC_VERSION >= 40200)
00053     #define ARMA_HAVE_STD_TR1
00054   #endif
00055   
00056   #if (ARMA_GCC_VERSION >= 40300)
00057     #undef  arma_hot
00058     #undef  arma_cold
00059     
00060     #define arma_hot  __attribute__((hot))
00061     #define arma_cold __attribute__((cold))
00062   #endif
00063   
00064   #undef ARMA_GCC_VERSION
00065   
00066 #elif defined(__INTEL_COMPILER)
00067   
00068   #if (__INTEL_COMPILER < 1000)
00069     #error "*** Need a newer compiler ***"
00070   #endif
00071   
00072   #define ARMA_GOOD_COMPILER
00073   #undef  ARMA_HAVE_STD_TR1
00074   
00075   #if (__INTEL_COMPILER <= 1110)
00076     #undef ARMA_HAVE_STD_ISFINITE
00077   #endif
00078 
00079 #endif
00080 
00081 
00082 #if defined(_MSC_VER)
00083   
00084   #pragma message ("*** WARNING: This compiler may have an incomplete implementation of the C++ standard ***")
00085   
00086   #undef ARMA_GOOD_COMPILER
00087   #undef ARMA_HAVE_STD_ISFINITE
00088   #undef ARMA_HAVE_STD_SNPRINTF
00089   #undef ARMA_HAVE_LOG1P
00090   #undef ARMA_HAVE_STD_ISINF
00091   #undef ARMA_HAVE_STD_ISNAN
00092   #undef ARMA_HAVE_STD_TR1
00093   
00094   #undef  arma_inline
00095   #define arma_inline inline __forceinline
00096   
00097 #endif
00098 
00099 
00100 #if defined(__CUDACC__)
00101   #undef ARMA_HAVE_STD_ISFINITE
00102   #undef ARMA_HAVE_STD_SNPRINTF
00103   #undef ARMA_HAVE_LOG1P
00104   #undef ARMA_HAVE_STD_ISINF
00105   #undef ARMA_HAVE_STD_ISNAN
00106   #undef ARMA_HAVE_STD_TR1
00107 #endif
00108 
00109 
00110 #if defined(__SUNPRO_CC)
00111   #undef ARMA_HAVE_STD_ISFINITE
00112   #undef ARMA_HAVE_STD_SNPRINTF
00113   #undef ARMA_HAVE_LOG1P
00114   #undef ARMA_HAVE_STD_ISINF
00115   #undef ARMA_HAVE_STD_ISNAN
00116   #undef ARMA_HAVE_STD_TR1
00117 #endif