From 72deb2e6742c1db228feba22e5cc7285ba2441c8 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 21 May 2020 22:48:08 -0500 Subject: [PATCH] remove DEAL_II_WITH_CXX* from the source code --- Jenkinsfile | 1 - doc/doxygen/options.dox.in | 2 - include/deal.II/base/config.h.in | 7 +-- include/deal.II/base/partitioner.templates.h | 4 +- include/deal.II/base/std_cxx14/algorithm.h | 37 +------------- include/deal.II/base/std_cxx14/memory.h | 44 ---------------- include/deal.II/base/std_cxx14/utility.h | 50 ------------------- include/deal.II/base/utilities.h | 6 +-- include/deal.II/lac/sparse_matrix.templates.h | 2 +- .../deal.II/lac/vector_operations_internal.h | 4 +- .../physics/elasticity/standard_tensors.h | 8 +-- source/physics/elasticity/standard_tensors.cc | 8 +-- tests/symengine/CMakeLists.txt | 2 +- 13 files changed, 22 insertions(+), 153 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3eb6036563..b0f6f99a2a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -139,7 +139,6 @@ pipeline -D DEAL_II_CXX_FLAGS='-Werror' \ -D CMAKE_BUILD_TYPE=Debug \ -D DEAL_II_WITH_MPI=OFF \ - -D DEAL_II_WITH_CXX14=OFF \ -D DEAL_II_UNITY_BUILD=ON \ $WORKSPACE/ time ninja -j $NP diff --git a/doc/doxygen/options.dox.in b/doc/doxygen/options.dox.in index dbed47b97e..1d65cb36d6 100644 --- a/doc/doxygen/options.dox.in +++ b/doc/doxygen/options.dox.in @@ -194,8 +194,6 @@ PREDEFINED = DOXYGEN=1 \ DEAL_II_WITH_COMPLEX_VALUES=1 \ DEAL_II_WITH_CUDA=1 \ DEAL_II_COMPILER_CUDA_AWARE=1 \ - DEAL_II_WITH_CXX14=1 \ - DEAL_II_WITH_CXX17=1 \ DEAL_II_WITH_GINKGO=1 \ DEAL_II_WITH_GMSH=1 \ DEAL_II_WITH_GSL=1 \ diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 61181c61fa..970b005357 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -86,11 +86,9 @@ #cmakedefine DEAL_II_HAVE_GLIBC_STACKTRACE #cmakedefine DEAL_II_HAVE_LIBSTDCXX_DEMANGLER #cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@ -#cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@ #cmakedefine DEAL_II_ALWAYS_INLINE @DEAL_II_ALWAYS_INLINE@ #cmakedefine DEAL_II_RESTRICT @DEAL_II_RESTRICT@ #cmakedefine DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA -#cmakedefine DEAL_II_CONSTEXPR @DEAL_II_CONSTEXPR@ /* * A variable to tell if the compiler used in the current compilation process @@ -139,10 +137,13 @@ #cmakedefine DEAL_II_HAVE_CXX17 -#cmakedefine DEAL_II_HAVE_CXX14_CONSTEXPR #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS +#cmakedefine DEAL_II_CXX14_CONSTEXPR_BUG_OK + +#define DEAL_II_DEPRECATED [[deprecated]] #cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@ +#cmakedefine DEAL_II_CONSTEXPR @DEAL_II_CONSTEXPR@ /*********************************************************************** diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 68e2621159..dd10f66c3f 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -535,7 +535,7 @@ namespace Utilities else # endif { -# ifdef DEAL_II_WITH_CXX17 +# ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivial::value) # else if (std::is_trivial::value) @@ -738,7 +738,7 @@ namespace Utilities else # endif { -# ifdef DEAL_II_WITH_CXX17 +# ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivial::value) # else if (std::is_trivial::value) diff --git a/include/deal.II/base/std_cxx14/algorithm.h b/include/deal.II/base/std_cxx14/algorithm.h index 483c5a8126..9925c5db76 100644 --- a/include/deal.II/base/std_cxx14/algorithm.h +++ b/include/deal.II/base/std_cxx14/algorithm.h @@ -17,49 +17,14 @@ #include -#ifdef DEAL_II_WITH_CXX14 -# include -#endif +#include DEAL_II_NAMESPACE_OPEN namespace std_cxx14 { -#ifdef DEAL_II_WITH_CXX14 using std::max; using std::min; - -#else - - template - constexpr const T & - max(const T &a, const T &b) - { - return (a < b) ? b : a; - } - - template - constexpr const T & - max(const T &a, const T &b, Compare comp) - { - return (comp(a, b)) ? b : a; - } - - template - constexpr const T & - min(const T &a, const T &b) - { - return (b < a) ? b : a; - } - - template - constexpr const T & - min(const T &a, const T &b, Compare comp) - { - return (comp(b, a)) ? b : a; - } - -#endif } // namespace std_cxx14 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/std_cxx14/memory.h b/include/deal.II/base/std_cxx14/memory.h index 3f722c2446..b24fc1cd86 100644 --- a/include/deal.II/base/std_cxx14/memory.h +++ b/include/deal.II/base/std_cxx14/memory.h @@ -19,55 +19,11 @@ #include -#ifndef DEAL_II_WITH_CXX14 -// needed for array type check -# include -#endif - DEAL_II_NAMESPACE_OPEN namespace std_cxx14 { -#ifdef DEAL_II_WITH_CXX14 using std::make_unique; - -#else - - namespace internal - { - template - struct is_bounded_array - { - static constexpr bool value = false; - }; - - template - struct is_bounded_array - { - static constexpr bool value = true; - }; - } // namespace internal - - template - inline - typename std::enable_if::value, std::unique_ptr>::type - make_unique(Args &&... constructor_arguments) - { - return std::unique_ptr( - new T(std::forward(constructor_arguments)...)); - } - - template - inline - typename std::enable_if::value, std::unique_ptr>::type - make_unique(std::size_t n) - { - static_assert(!internal::is_bounded_array::value, - "This function is not implemented for bounded array types."); - return std::unique_ptr(new typename std::remove_extent::type[n]); - } - -#endif } // namespace std_cxx14 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/std_cxx14/utility.h b/include/deal.II/base/std_cxx14/utility.h index 3656c98de7..1d6008b4b5 100644 --- a/include/deal.II/base/std_cxx14/utility.h +++ b/include/deal.II/base/std_cxx14/utility.h @@ -19,63 +19,13 @@ #include -#ifndef DEAL_II_WITH_CXX14 -// needed for array type check -# include -#endif - DEAL_II_NAMESPACE_OPEN namespace std_cxx14 { -#ifdef DEAL_II_WITH_CXX14 using std::index_sequence; using std::index_sequence_for; using std::make_index_sequence; - -#else - - template - struct index_sequence - { - using type = index_sequence; - using value_type = size_t; - static constexpr std::size_t - size() noexcept - { - return sizeof...(Ints); - } - }; - - // -------------------------------------------------------------- - namespace internal - { - template - struct merge_and_renumber; - - template - struct merge_and_renumber, index_sequence> - : index_sequence - {}; - } // namespace internal - // -------------------------------------------------------------- - - template - struct make_index_sequence : internal::merge_and_renumber< - typename make_index_sequence::type, - typename make_index_sequence::type> - {}; - - template <> - struct make_index_sequence<0> : index_sequence<> - {}; - template <> - struct make_index_sequence<1> : index_sequence<0> - {}; - - template - using index_sequence_for = make_index_sequence; -#endif } // namespace std_cxx14 DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index f83995c14f..63be355f77 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -475,7 +475,7 @@ namespace Utilities constexpr T pow(const T base, const int iexp) { -#if defined(DEBUG) && defined(DEAL_II_HAVE_CXX14_CONSTEXPR) +#if defined(DEBUG) && defined(DEAL_II_CXX14_CONSTEXPR_BUG_OK) // Up to __builtin_expect this is the same code as in the 'Assert' macro. // The call to __builtin_expect turns out to be problematic. if (!(iexp >= 0)) @@ -1225,7 +1225,7 @@ namespace Utilities #if __GNUG__ && __GNUC__ < 5 if (__has_trivial_copy(T) && sizeof(T) < 256) #else -# ifdef DEAL_II_WITH_CXX17 +# ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivially_copyable() && sizeof(T) < 256) # else if (std::is_trivially_copyable() && sizeof(T) < 256) @@ -1307,7 +1307,7 @@ namespace Utilities #if __GNUG__ && __GNUC__ < 5 if (__has_trivial_copy(T) && sizeof(T) < 256) #else -# ifdef DEAL_II_WITH_CXX17 +# ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivially_copyable() && sizeof(T) < 256) # else if (std::is_trivially_copyable() && sizeof(T) < 256) diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 3933a20fa6..77d8798ecf 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -219,7 +219,7 @@ SparseMatrix::operator=(const double d) grain_size); else if (matrix_size > 0) { -#ifdef DEAL_II_WITH_CXX17 +#ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivial::value) #else if (std::is_trivial::value) diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index c0d7868547..50c3748f47 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -213,7 +213,7 @@ namespace internal if (value == Number()) { -#ifdef DEAL_II_WITH_CXX17 +#ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivial::value) #else if (std::is_trivial::value) @@ -250,7 +250,7 @@ namespace internal if (__has_trivial_copy(Number) && std::is_same::value) #else -# ifdef DEAL_II_WITH_CXX17 +# ifdef DEAL_II_HAVE_CXX17 if constexpr (std::is_trivially_copyable() && std::is_same::value) # else diff --git a/include/deal.II/physics/elasticity/standard_tensors.h b/include/deal.II/physics/elasticity/standard_tensors.h index 7796f84de1..dd8d355c67 100644 --- a/include/deal.II/physics/elasticity/standard_tensors.h +++ b/include/deal.II/physics/elasticity/standard_tensors.h @@ -70,7 +70,7 @@ namespace Physics * matrix, then this simply corresponds to the identity matrix. */ static DEAL_II_CONSTEXPR const SymmetricTensor<2, dim> I -#ifdef DEAL_II_HAVE_CXX14_CONSTEXPR +#ifdef DEAL_II_CXX14_CONSTEXPR_BUG_OK = unit_symmetric_tensor() #endif ; @@ -103,7 +103,7 @@ namespace Physics * operator. */ static DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> S -#ifdef DEAL_II_HAVE_CXX14_CONSTEXPR +#ifdef DEAL_II_CXX14_CONSTEXPR_BUG_OK = identity_tensor() #endif ; @@ -119,7 +119,7 @@ namespace Physics * @f] */ static DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> IxI -#ifdef DEAL_II_HAVE_CXX14_CONSTEXPR +#ifdef DEAL_II_CXX14_CONSTEXPR_BUG_OK = outer_product(unit_symmetric_tensor(), unit_symmetric_tensor()) #endif @@ -169,7 +169,7 @@ namespace Physics * @dealiiHolzapfelA{232,6.105} */ static DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> dev_P -#ifdef DEAL_II_HAVE_CXX14_CONSTEXPR +#ifdef DEAL_II_CXX14_CONSTEXPR_BUG_OK = deviator_tensor() #endif ; diff --git a/source/physics/elasticity/standard_tensors.cc b/source/physics/elasticity/standard_tensors.cc index a71d15fa8f..886a7ff220 100644 --- a/source/physics/elasticity/standard_tensors.cc +++ b/source/physics/elasticity/standard_tensors.cc @@ -24,7 +24,7 @@ DEAL_II_NAMESPACE_OPEN template DEAL_II_CONSTEXPR const SymmetricTensor<2, dim> Physics::Elasticity::StandardTensors::I -# ifndef DEAL_II_HAVE_CXX14_CONSTEXPR +# ifndef DEAL_II_CXX14_CONSTEXPR_BUG_OK = unit_symmetric_tensor() # endif ; @@ -34,7 +34,7 @@ DEAL_II_CONSTEXPR const SymmetricTensor<2, dim> template DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> Physics::Elasticity::StandardTensors::S -# ifndef DEAL_II_HAVE_CXX14_CONSTEXPR +# ifndef DEAL_II_CXX14_CONSTEXPR_BUG_OK = identity_tensor() # endif ; @@ -44,7 +44,7 @@ DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> template DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> Physics::Elasticity::StandardTensors::IxI -# ifndef DEAL_II_HAVE_CXX14_CONSTEXPR +# ifndef DEAL_II_CXX14_CONSTEXPR_BUG_OK = outer_product(unit_symmetric_tensor(), unit_symmetric_tensor()) # endif ; @@ -54,7 +54,7 @@ DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> template DEAL_II_CONSTEXPR const SymmetricTensor<4, dim> Physics::Elasticity::StandardTensors::dev_P -# ifndef DEAL_II_HAVE_CXX14_CONSTEXPR +# ifndef DEAL_II_CXX14_CONSTEXPR_BUG_OK = deviator_tensor() # endif ; diff --git a/tests/symengine/CMakeLists.txt b/tests/symengine/CMakeLists.txt index 46145a0466..09f74f39eb 100644 --- a/tests/symengine/CMakeLists.txt +++ b/tests/symengine/CMakeLists.txt @@ -1,6 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(../setup_testsubproject.cmake) PROJECT(testsuite CXX) -IF(DEAL_II_WITH_SYMENGINE AND DEAL_II_WITH_CXX11) +IF(DEAL_II_WITH_SYMENGINE) DEAL_II_PICKUP_TESTS() ENDIF() -- 2.39.5