mirror of
https://github.com/triqs/dft_tools
synced 2024-12-24 13:23:37 +01:00
clean the TRIQS_COMPILER macros
- from now on, C++11 compilers only. - no ressources to maintain old stuff.
This commit is contained in:
parent
7693077b79
commit
1517cdaaeb
@ -17,14 +17,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
|
||||
OUTPUT_VARIABLE _compiler_output RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(compiler_version_min "4.6.3")
|
||||
set(compiler_version_min "4.8.1")
|
||||
set(compiler_name "gcc")
|
||||
set(compiler_group 1)
|
||||
string(REGEX REPLACE ".*([2-5]\\.[0-9]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
|
||||
|
||||
if(NOT compiler_version VERSION_LESS "4.8.0" )
|
||||
set(TRIQS_COMPILER_IS_C11_COMPLIANT ON)
|
||||
endif()
|
||||
#if(compiler_version VERSION_LESS "4.8.0" )
|
||||
# set(compiler_is_obsolete_gcc ON)
|
||||
#endif()
|
||||
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
|
||||
@ -33,7 +33,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANG TRUE )
|
||||
set(compiler_name "clang")
|
||||
set(compiler_group 1)
|
||||
set(TRIQS_COMPILER_IS_C11_COMPLIANT ON)
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# Apple which does not has the official clang version number ...
|
||||
string(REGEX REPLACE ".*LLVM ([2-5]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
|
||||
@ -48,7 +47,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE compiler_version RESULT_VARIABLE returncode OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(CMAKE_COMPILER_IS_ICC TRUE )
|
||||
set(compiler_version_min "13.0.0")
|
||||
set(compiler_version_min "14.0.0")
|
||||
set(compiler_name "Intel icc")
|
||||
set(compiler_group 3)
|
||||
#string(REGEX REPLACE "[^0-9]*([0-9]+\\.[0-9]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
|
||||
|
@ -33,7 +33,6 @@ set(TRIQS_LIBRARY_GSL @GSL_LIBRARIES@)
|
||||
set(TRIQS_WITH_PYTHON_SUPPORT @TRIQS_WITH_PYTHON_SUPPORT@)
|
||||
set(TRIQS_HDF5_DIFF_EXECUTABLE @TRIQS_HDF5_DIFF_EXECUTABLE@)
|
||||
set(TRIQS_PYTHON_LIB_DEST @TRIQS_PYTHON_LIB_DEST@)
|
||||
set(TRIQS_COMPILER_IS_C11_COMPLIANT @TRIQS_COMPILER_IS_C11_COMPLIANT@)
|
||||
|
||||
# Documentation
|
||||
set(TRIQS_WITH_DOCUMENTATION @Build_Documentation@)
|
||||
|
@ -11,8 +11,6 @@
|
||||
#cmakedefine TRIQS_WORKAROUND_INTEL_COMPILER_14_BUGS
|
||||
#cmakedefine BOOST_MATH_DISABLE_STD_FPCLASSIFY
|
||||
|
||||
#cmakedefine TRIQS_COMPILER_IS_C11_COMPLIANT
|
||||
|
||||
#define TRIQS_GIT_HASH @GIT_HASH@
|
||||
|
||||
#define TRIQS_HOSTNAME @TRIQS_HOSTNAME@
|
||||
|
@ -8,9 +8,11 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
link_libraries( ${link_libs} triqs)
|
||||
|
||||
if (NOT compiler_is_obsolete_gcc)
|
||||
add_subdirectory(triqs)
|
||||
add_subdirectory(speed)
|
||||
endif()
|
||||
if (PythonSupport)
|
||||
add_subdirectory(pytriqs)
|
||||
endif()
|
||||
add_subdirectory(speed)
|
||||
|
||||
|
@ -15,21 +15,6 @@ macro(all_tests )
|
||||
endif()
|
||||
ENDFOREACH( TestName1 ${TestList} )
|
||||
|
||||
FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c++11/*.cpp)
|
||||
FOREACH( TestName1 ${TestList} )
|
||||
STRING(REPLACE ".cpp" "" TestName2 ${TestName1})
|
||||
STRING(REPLACE "c++11/" "" TestName ${TestName2})
|
||||
if(TRIQS_COMPILER_IS_C11_COMPLIANT)
|
||||
add_executable( ${TestName} ${CMAKE_CURRENT_SOURCE_DIR}/c++11/${TestName}.cpp )
|
||||
add_test_C_simple( ${TestName})
|
||||
if (TESTS_C_WITH_VALGRIND)
|
||||
add_test ( ${TestName}_valgrind valgrind --error-exitcode=1 ${CMAKE_CURRENT_BINARY_DIR}/c++11/${TestName})
|
||||
endif()
|
||||
else()
|
||||
MESSAGE(STATUS "WARNING: Deactivating the test ${TestName} : this obsolete compiler does not implement the C++ standard")
|
||||
endif()
|
||||
ENDFOREACH( TestName1 ${TestList} )
|
||||
|
||||
endmacro()
|
||||
|
||||
add_all_subdirectories_with_cmakelist()
|
||||
|
@ -11,7 +11,6 @@ int main() {
|
||||
auto G2 = G1;
|
||||
auto G3 = G2;
|
||||
|
||||
#ifndef TRIQS_COMPILER_IS_OBSOLETE
|
||||
// construct some block functions
|
||||
auto B0 = block_gf<imfreq> (3);
|
||||
auto B1 = make_block_gf<imfreq> (3, G1);
|
||||
@ -35,7 +34,6 @@ int main() {
|
||||
B1[0][0] = 98;
|
||||
//not implemented yet
|
||||
//B3["a"][0] = 98;
|
||||
#endif
|
||||
|
||||
auto View = make_block_gf_view(G1,G2,G3);
|
||||
|
||||
|
@ -131,8 +131,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef TRIQS_COMPILER_IS_C11_COMPLIANT
|
||||
|
||||
{ // filter
|
||||
std::cout << " ----- filter ----"<< std::endl ;
|
||||
auto t= std::make_tuple(0,1,2,3,4,"=5");
|
||||
@ -184,7 +182,5 @@ int main(int argc, char **argv) {
|
||||
std::cout << "replace 1,3,5"<< t << triqs::tuple::replace<1,3,5>(t,s)<< std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,8 @@ namespace triqs { namespace arrays {
|
||||
|
||||
#undef IMPL_TYPE
|
||||
|
||||
// This alias is experiemental !! on modern compilers only.
|
||||
#ifndef TRIQS_COMPILER_IS_OBSOLETE
|
||||
template <typename ValueType, int Rank, ull_t Opt=0, ull_t TraversalOrder=0, bool Borrowed=false>
|
||||
using array_const_view = array_view<ValueType, Rank, Opt, TraversalOrder, Borrowed>;
|
||||
#endif
|
||||
|
||||
//------------------------------- array ---------------------------------------------------
|
||||
|
||||
|
@ -60,12 +60,6 @@ namespace boost { namespace serialization { class access;}}
|
||||
#define TRIQS_ARRAYS_DEBUG_CHECK(Cond,Error)
|
||||
#endif
|
||||
|
||||
// In particular, gcc 4.6, 4.7 do not have "rvalue for *this", which forbid the implementation
|
||||
// of weak references. In that case, we will revert to strong view instead.
|
||||
#ifdef TRIQS_COMPILER_IS_OBSOLETE
|
||||
#define TRIQS_ARRAYS_SLICE_DEFAUT_IS_SHARED
|
||||
#endif
|
||||
|
||||
namespace triqs {
|
||||
|
||||
typedef unsigned long long ull_t;
|
||||
|
@ -64,12 +64,8 @@ namespace triqs { namespace arrays { namespace indexmaps { namespace cuboid {
|
||||
size_t number_of_elements() const { return lengths_.product_of_elements();}
|
||||
bool operator==(domain_t const & X) const { return this->lengths_ == X.lengths_;}
|
||||
bool operator!=(domain_t const & X) const { return !(*this==X);}
|
||||
#ifdef TRIQS_COMPILER_IS_C11_COMPLIANT
|
||||
n_uple const & lengths() const & { return lengths_;}
|
||||
n_uple lengths() && { return lengths_;}
|
||||
#else
|
||||
n_uple lengths() const { return lengths_;}
|
||||
#endif
|
||||
/** Generates the value of the indices of a cuboid_domain. */
|
||||
static constexpr ull_t iteration_order_default = permutations::identity(Rank);
|
||||
template <ull_t IterationOrder= iteration_order_default >
|
||||
|
@ -191,11 +191,9 @@ namespace arrays {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
namespace clef {
|
||||
TRIQS_CLEF_MAKE_FNT_LAZY(determinant);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace triqs::arrays
|
||||
#endif
|
||||
|
@ -282,19 +282,9 @@ namespace triqs { namespace clef {
|
||||
Expr ex; // keep a copy of the expression
|
||||
make_fun_impl(Expr const & ex_) : ex(ex_) {}
|
||||
|
||||
// gcc 4.6 crashes (!!!) on the first variant
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
template<typename... Args>
|
||||
auto operator()(Args &&... args) const
|
||||
DECL_AND_RETURN( evaluator<Expr,pair<Is,Args>...>() ( ex, pair<Is,Args>{std::forward<Args>(args)}...));
|
||||
#else
|
||||
template<typename... Args> struct __eval {
|
||||
typedef evaluator<Expr,pair<Is,Args>...> eval_t;
|
||||
auto operator()(Expr const &ex , Args &&... args) const DECL_AND_RETURN( return eval_t() ( ex, pair<Is,Args>{std::forward<Args>(args)}...));
|
||||
};
|
||||
template<typename... Args>
|
||||
auto operator()(Args &&... args) const DECL_AND_RETURN(return __eval<Args...>() ( ex, std::forward<Args>(args)...));
|
||||
#endif
|
||||
};
|
||||
|
||||
// values of the ph, excluding the Is ...
|
||||
@ -471,14 +461,8 @@ namespace triqs { namespace clef {
|
||||
|
||||
ReturnType operator()(T const &... t) const { return (*_fnt_ptr)(t...);}
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
template< typename... Args>
|
||||
auto operator()( Args&&... args ) const DECL_AND_RETURN(make_expr_call (*this,std::forward<Args>(args)...));
|
||||
#else
|
||||
template< typename... Args>
|
||||
typename _result_of::make_expr_call<function const & ,Args...>::type
|
||||
operator()( Args&&... args ) const { return make_expr_call (*this,args...);}
|
||||
#endif
|
||||
|
||||
template<typename RHS> friend void triqs_clef_auto_assign (function const & x, RHS rhs) {
|
||||
* (x._fnt_ptr) = std_function_type (rhs);
|
||||
@ -501,8 +485,6 @@ namespace triqs { namespace clef {
|
||||
template< typename... A> \
|
||||
auto name( A&& ... a) DECL_AND_RETURN(make_expr_call(name##_lazy_impl(),std::forward<A>(a)...));
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
|
||||
#define TRIQS_CLEF_IMPLEMENT_LAZY_METHOD(TY,name)\
|
||||
struct __clef_lazy_method_impl_##name { \
|
||||
TY * _x;\
|
||||
@ -522,28 +504,5 @@ namespace triqs { namespace clef {
|
||||
template< typename... Args>\
|
||||
auto operator()(Args&&... args ) && DECL_AND_RETURN(make_expr_call (std::move(*this),std::forward<Args>(args)...));\
|
||||
|
||||
#else
|
||||
|
||||
#define TRIQS_CLEF_IMPLEMENT_LAZY_METHOD(TY,name,RETURN_TYPE)\
|
||||
struct __clef_lazy_method_impl_##name { \
|
||||
TY * _x;\
|
||||
template<typename... A> RETURN_TYPE operator()(A&&... a) const {return ((*_x).name(std::forward<A>(a)...));}\
|
||||
friend std::ostream & operator<<(std::ostream & out, __clef_lazy_method_impl_##name const & x) { return out<<BOOST_PP_STRINGIZE(TY)<<"."<<BOOST_PP_STRINGIZE(name);}\
|
||||
};\
|
||||
template< typename... A> \
|
||||
typename _result_of::make_expr_call<__clef_lazy_method_impl_##name, A...>::type\
|
||||
name( A&& ... a) {return make_expr_call(__clef_lazy_method_impl_##name{this},std::forward<A>(a)...);}
|
||||
|
||||
#define TRIQS_CLEF_IMPLEMENT_LAZY_CALL(TY)\
|
||||
template< typename... Args>\
|
||||
typename triqs::clef::_result_of::make_expr_call<TY const &,Args...>::type\
|
||||
operator()(Args&&... args ) const {return make_expr_call (*this,std::forward<Args>(args)...);}\
|
||||
\
|
||||
template< typename... Args>\
|
||||
typename triqs::clef::_result_of::make_expr_call<TY &,Args...>::type\
|
||||
operator()(Args&&... args ) {return make_expr_call (*this,std::forward<Args>(args)...);}
|
||||
|
||||
#endif
|
||||
|
||||
}} // namespace triqs::clef
|
||||
#endif
|
||||
|
@ -21,18 +21,14 @@
|
||||
#ifndef TRIQS_GFS_ALL_H
|
||||
#define TRIQS_GFS_ALL_H
|
||||
|
||||
// The basic classes
|
||||
#include <triqs/gfs/block.hpp>
|
||||
#include <triqs/gfs/imtime.hpp>
|
||||
#include <triqs/gfs/imfreq.hpp>
|
||||
#include <triqs/gfs/retime.hpp>
|
||||
#include <triqs/gfs/refreq.hpp>
|
||||
#include <triqs/gfs/legendre.hpp>
|
||||
|
||||
#ifndef TRIQS_COMPILER_IS_OBSOLETE
|
||||
#include <triqs/gfs/product.hpp>
|
||||
#include <triqs/gfs/curry.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -145,11 +145,8 @@ namespace triqs { namespace gfs {
|
||||
template<typename T> size_t n_blocks (gf<block_index,T> const & g) { return g.mesh().size();}
|
||||
template<typename T> size_t n_blocks (gf_view<block_index,T> const & g) { return g.mesh().size();}
|
||||
|
||||
#ifndef TRIQS_COMPILER_IS_OBSOLETE
|
||||
template<typename T> using block_gf = gf<block_index, gf<T>>;
|
||||
#endif
|
||||
|
||||
// also experimental
|
||||
// an iterator over the block
|
||||
template<typename Target, typename Opt>
|
||||
class block_gf_iterator :
|
||||
|
@ -21,9 +21,6 @@
|
||||
#ifndef TRIQS_GF_CURRY_H
|
||||
#define TRIQS_GF_CURRY_H
|
||||
#include "./product.hpp"
|
||||
#ifndef TRIQS_COMPILER_IS_C11_COMPLIANT
|
||||
#error "This header requires a fully C++11 compliant compiler"
|
||||
#endif
|
||||
namespace triqs { namespace gfs {
|
||||
|
||||
template<typename F> struct lambda_valued {};
|
||||
|
@ -65,13 +65,7 @@ namespace triqs { namespace gfs {
|
||||
public :
|
||||
static constexpr int arity = 1;
|
||||
evaluator_one_var() = default;
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
template<typename G> auto operator()(G const * g, double x) const DECL_AND_RETURN(evaluator_fnt_on_mesh<Variable> (g->mesh(),x)(on_mesh(*g)));
|
||||
#else
|
||||
// needed on old gcc ?
|
||||
// template<typename G> auto operator()(G const * g, double x) const DECL_AND_RETURN(evaluator_fnt_on_mesh<Variable> (g->mesh(),x)(typename G::_on_mesh_wrapper_const(*g)));
|
||||
#endif
|
||||
|
||||
template<typename G> auto operator()(G const * g, double x) const DECL_AND_RETURN(evaluator_fnt_on_mesh<Variable> (g->mesh(),x)(on_mesh(*g)));
|
||||
template<typename G> typename G::singularity_t const & operator()(G const * g,freq_infty const &) const {return g->singularity();}
|
||||
};
|
||||
|
||||
|
@ -227,8 +227,6 @@ namespace triqs { namespace gfs {
|
||||
// First, a simple () returns a view, like for an array...
|
||||
view_type operator()() const { return *this;}
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
|
||||
/// Calls are (perfectly) forwarded to the evaluator::operator(), except mesh_point_t and when
|
||||
/// there is at least one lazy argument ...
|
||||
template<typename Arg0, typename... Args > // match any argument list, picking out the first type : () is not permitted
|
||||
@ -262,8 +260,6 @@ namespace triqs { namespace gfs {
|
||||
return clef::make_expr_call(std::move(*this),std::forward<Arg0>(arg0), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
// on mesh component for composite meshes
|
||||
// enable iif the first arg is a mesh_point_t for the first component of the mesh_t
|
||||
@ -293,7 +289,6 @@ namespace triqs { namespace gfs {
|
||||
template<typename ... U>
|
||||
cr_type operator[] (closest_pt_wrap<U...> const & p) const { return _data_proxy(_data, _mesh.index_to_linear( gfs_implementation::get_closest_point<Variable,Target,Opt>::invoke(this,p)));}
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
template<typename Arg>
|
||||
typename clef::_result_of::make_expr_subscript<gf_impl const &,Arg>::type
|
||||
operator[](Arg && arg) const & { return clef::make_expr_subscript(*this,std::forward<Arg>(arg));}
|
||||
@ -305,7 +300,6 @@ namespace triqs { namespace gfs {
|
||||
template<typename Arg>
|
||||
typename clef::_result_of::make_expr_subscript<gf_impl,Arg>::type
|
||||
operator[](Arg && arg) && { return clef::make_expr_subscript(std::move(*this),std::forward<Arg>(arg));}
|
||||
#endif
|
||||
|
||||
/// A direct access to the grid point
|
||||
template<typename... Args>
|
||||
@ -314,9 +308,7 @@ namespace triqs { namespace gfs {
|
||||
template<typename... Args>
|
||||
cr_type on_mesh (Args&&... args) const { return _data_proxy(_data,_mesh.index_to_linear(mesh_index_t(std::forward<Args>(args)...)));}
|
||||
|
||||
#ifndef TRIQS_COMPILER_OBSOLETE_GCC
|
||||
private:
|
||||
#endif
|
||||
struct _on_mesh_wrapper_const {
|
||||
gf_impl const & f; _on_mesh_wrapper_const (gf_impl const & _f) : f(_f) {}
|
||||
template <typename... Args> cr_type operator ()(Args && ... args) const { return f.on_mesh(std::forward<Args>(args)...);}
|
||||
|
@ -31,7 +31,6 @@
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
#if GCC_VERSION < 40801
|
||||
//#warning "gcc compiler" GCC_VERSION
|
||||
#define TRIQS_COMPILER_IS_OBSOLETE
|
||||
#define TRIQS_COMPILER_OBSOLETE_GCC
|
||||
// we still accept gcc 4.6 and 4.7, but only the 4.8.1 and higher is a compliant c++11
|
||||
#endif
|
||||
|
@ -282,8 +282,6 @@ namespace triqs { namespace tuple {
|
||||
template<typename F, typename T1, typename T2, typename R>
|
||||
auto fold_on_zip (F && f,T1 const & t1, T2 const & t2, R && r) DECL_AND_RETURN( fold_on_zip_impl<std::tuple_size<T1>::value-1,T1,T2>()(std::forward<F>(f),t1,t2,std::forward<R>(r)));
|
||||
|
||||
#ifdef TRIQS_COMPILER_IS_C11_COMPLIANT
|
||||
|
||||
/**
|
||||
* filter<int ... I>(t) :
|
||||
* Given a tuple t, and integers, returns the tuple where the elements at initial position I are dropped.
|
||||
@ -431,7 +429,6 @@ namespace triqs { namespace tuple {
|
||||
template<int ...I, typename Tu, typename R>
|
||||
auto replace(Tu const & tu, R const &r) DECL_AND_RETURN ( replace_impl<0,std::tuple_size<Tu>::value-1, I...>()(tu, std::make_tuple(),r));
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* print a tuple
|
||||
|
Loading…
Reference in New Issue
Block a user