3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

separate some tests in c++11 dir for old compilers.

new policy : for non standard conforming compilers,
we can skip the tests using new features using recent c++ features.
I.e. compilers below gcc 4.8.1, clang 3.3.
This commit is contained in:
Olivier Parcollet 2013-07-30 22:35:31 +02:00
parent 44bf1e322a
commit 4f4c697897
5 changed files with 23 additions and 2 deletions

View File

@ -414,6 +414,7 @@ endif (PythonSupport)
## Remove the test from the build ?
option(Build_Triqs_General_Tools_Test "Build the test of the general tool ? ( array class , ... ) " ON)
if (Build_Triqs_General_Tools_Test)
message( STATUS "-------- Preparing tests -------------")
add_subdirectory(${TRIQS_SOURCE_DIR}/test )
endif()

View File

@ -32,6 +32,7 @@ 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@)
# for people who want to quickly add everything TRIQS has detected...
set(TRIQS_LIBRARY_ALL ${TRIQS_LIBRARY} ${TRIQS_LIBRARY_BOOST} ${TRIQS_LIBRARY_PYTHON} ${TRIQS_LIBRARY_MPI} ${TRIQS_LIBRARY_HDF5} ${TRIQS_LIBRARY_LAPACK} ${TRIQS_LIBRARY_FFTW} ${TRIQS_LIBRARY_GMP} ${TRIQS_LIBRARY_GSL} )

View File

@ -15,6 +15,21 @@ 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()

View File

@ -22,6 +22,10 @@
#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 {};
@ -54,7 +58,7 @@ namespace triqs { namespace gfs {
// - m : returns from a CP object the corresponding tuple of meshes of the remaining meshes
// after partial eval (of the type computed by "type").
// - auxiliary data :
// pos : position in the CP tuple ( CP::size-1 ->0)
// pos : position in the CP tuple (CP::size-1 ->0)
// ip : position in the tuple of indices (for sl)
// MP : accumulation of the final type metacomputed.
//
@ -77,7 +81,7 @@ namespace triqs { namespace gfs {
};
template<int pos, int ip, typename CP, typename MP, int ... I> struct pv_impl<pos, ip, CP, MP, pos ,I...> {
typedef typename cartesian_product_add_front<typename std::tuple_element<pos,typename CP::type>::type, MP>::type MP2;
typedef typename cartesian_product_add_front<typename std::tuple_element<pos,typename CP::type>::type, MP>::type MP2;
typedef pv_impl<pos-1,ip+1, CP,MP2,I...> B;
typedef typename B::type type;
template<typename T, typename IT> static auto sl (T t, IT const & it) DECL_AND_RETURN( B::sl(triqs::tuple::push_front(t,std::get<ip >(it)),it));