diff --git a/cmake/modules/DuneXtMacros.cmake b/cmake/modules/DuneXtMacros.cmake index b52731c495b2c328e03eadbd96861621b1abd7b4..1813e2ae4eb01659fe285a71b5dc04410227ff0b 100644 --- a/cmake/modules/DuneXtMacros.cmake +++ b/cmake/modules/DuneXtMacros.cmake @@ -22,7 +22,7 @@ include(Hints) # library checks ######################################################################### find_package(PkgConfig) -set(DS_REQUIRED_BOOST_LIBS atomic chrono date_time filesystem system thread timer) +set(DS_REQUIRED_BOOST_LIBS atomic chrono date_time system thread timer) set(BOOST_ROOT_HINTS "$ENV{BOOST_ROOT}" ${root_hints}) # check if any hints are provided by user if(DEFINED BOOST_ROOT OR DEFINED BOOOST_INCLUDEDIR OR DEFINED BOOST_LIBRARYDIR) diff --git a/cmake/modules/XtCompilerSupport.cmake b/cmake/modules/XtCompilerSupport.cmake index b649a881b771dba4d57f381395335995cf66d0ec..060349056d4300ebea9a90b0bdb1fe5ab2926694 100644 --- a/cmake/modules/XtCompilerSupport.cmake +++ b/cmake/modules/XtCompilerSupport.cmake @@ -58,13 +58,6 @@ check_cxx_source_compiles(" }; " HAS_STD_BEGIN_END) -check_cxx_source_compiles(" - int main(void) - { - int a __attribute__((unused)) = 0; - }; -" HAS_WORKING_UNUSED_ATTRIBUTE) - check_cxx_source_compiles(" #include <map> int main(void) diff --git a/config.h.cmake b/config.h.cmake index 54bec481f7d8522facd482d6a7da07f17c44cd86..7b2f98bf51130b611f0ef4daa56a51ee0fbdd10b 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -67,10 +67,6 @@ #define DXT_DISABLE_LARGE_TESTS 0 #endif -#ifndef HAS_WORKING_UNUSED_ATTRIBUTE -#cmakedefine HAS_WORKING_UNUSED_ATTRIBUTE 1 -#endif - #ifndef HAVE_LIKWID #cmakedefine01 HAVE_LIKWID #endif diff --git a/dune/xt/common/algorithm.hh b/dune/xt/common/algorithm.hh index 946ac48e0af0fdf9cd69ed2e35e377426ba23c23..006b7b66008080d4a24839552c33dd1ec1252d19 100644 --- a/dune/xt/common/algorithm.hh +++ b/dune/xt/common/algorithm.hh @@ -22,6 +22,7 @@ namespace Dune { namespace XT { namespace Common { + //! same as std::copy_if, but with move template <class InputIt, class OutputIt, class UnaryPredicate> OutputIt move_if(InputIt first, InputIt last, OutputIt d_first, UnaryPredicate pred) @@ -43,6 +44,7 @@ SequenceType make_string_sequence(InputIt first, InputIt last) return ret; } + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/cblas.cc b/dune/xt/common/cblas.cc index c9c8167fa7058bcaf35ca8f459ca2b9980d20659..db47db8c752d01b8d56dcc23324d6ccab2242076 100644 --- a/dune/xt/common/cblas.cc +++ b/dune/xt/common/cblas.cc @@ -20,14 +20,13 @@ #endif #include <dune/xt/common/exceptions.hh> -#include <dune/xt/common/unused.hh> #include "cblas.hh" #if HAVE_MKL -# define DXTC_CBLAS_ONLY(param) param +# define DXTC_CBLAS_ONLY #else -# define DXTC_CBLAS_ONLY(param) DXTC_UNUSED(param) +# define DXTC_CBLAS_ONLY [[maybe_unused]] #endif namespace Dune { @@ -159,18 +158,18 @@ int non_unit() } -void dgemv(const int DXTC_CBLAS_ONLY(layout), - const int DXTC_CBLAS_ONLY(trans), - const int DXTC_CBLAS_ONLY(m), - const int DXTC_CBLAS_ONLY(n), - const double DXTC_CBLAS_ONLY(alpha), - const double* DXTC_CBLAS_ONLY(a), - const int DXTC_CBLAS_ONLY(lda), - const double* DXTC_CBLAS_ONLY(x), - const int DXTC_CBLAS_ONLY(incx), - const double DXTC_CBLAS_ONLY(beta), - double* DXTC_CBLAS_ONLY(y), - const int DXTC_CBLAS_ONLY(incy)) +void dgemv(DXTC_CBLAS_ONLY const int layout, + DXTC_CBLAS_ONLY const int trans, + DXTC_CBLAS_ONLY const int m, + DXTC_CBLAS_ONLY const int n, + DXTC_CBLAS_ONLY const double alpha, + DXTC_CBLAS_ONLY const double* a, + DXTC_CBLAS_ONLY const int lda, + DXTC_CBLAS_ONLY const double* x, + DXTC_CBLAS_ONLY const int incx, + DXTC_CBLAS_ONLY const double beta, + DXTC_CBLAS_ONLY double* y, + DXTC_CBLAS_ONLY const int incy) { #if HAVE_MKL cblas_dgemv(static_cast<CBLAS_LAYOUT>(layout), @@ -191,18 +190,18 @@ void dgemv(const int DXTC_CBLAS_ONLY(layout), } -void dtrsm(const int DXTC_CBLAS_ONLY(layout), - const int DXTC_CBLAS_ONLY(side), - const int DXTC_CBLAS_ONLY(uplo), - const int DXTC_CBLAS_ONLY(transa), - const int DXTC_CBLAS_ONLY(diag), - const int DXTC_CBLAS_ONLY(m), - const int DXTC_CBLAS_ONLY(n), - const double DXTC_CBLAS_ONLY(alpha), - const double* DXTC_CBLAS_ONLY(a), - const int DXTC_CBLAS_ONLY(lda), - double* DXTC_CBLAS_ONLY(b), - const int DXTC_CBLAS_ONLY(ldb)) +void dtrsm(DXTC_CBLAS_ONLY const int layout, + DXTC_CBLAS_ONLY const int side, + DXTC_CBLAS_ONLY const int uplo, + DXTC_CBLAS_ONLY const int transa, + DXTC_CBLAS_ONLY const int diag, + DXTC_CBLAS_ONLY const int m, + DXTC_CBLAS_ONLY const int n, + DXTC_CBLAS_ONLY const double alpha, + DXTC_CBLAS_ONLY const double* a, + DXTC_CBLAS_ONLY const int lda, + DXTC_CBLAS_ONLY double* b, + DXTC_CBLAS_ONLY const int ldb) { #if HAVE_MKL cblas_dtrsm(static_cast<CBLAS_LAYOUT>(layout), @@ -228,15 +227,15 @@ void dtrsm(const int DXTC_CBLAS_ONLY(layout), } -void dtrsv(const int DXTC_CBLAS_ONLY(layout), - const int DXTC_CBLAS_ONLY(uplo), - const int DXTC_CBLAS_ONLY(transa), - const int DXTC_CBLAS_ONLY(diag), - const int DXTC_CBLAS_ONLY(n), - const double* DXTC_CBLAS_ONLY(a), - const int DXTC_CBLAS_ONLY(lda), - double* DXTC_CBLAS_ONLY(x), - const int DXTC_CBLAS_ONLY(incx)) +void dtrsv(DXTC_CBLAS_ONLY const int layout, + DXTC_CBLAS_ONLY const int uplo, + DXTC_CBLAS_ONLY const int transa, + DXTC_CBLAS_ONLY const int diag, + DXTC_CBLAS_ONLY const int n, + DXTC_CBLAS_ONLY const double* a, + DXTC_CBLAS_ONLY const int lda, + DXTC_CBLAS_ONLY double* x, + DXTC_CBLAS_ONLY const int incx) { #if HAVE_MKL cblas_dtrsv(static_cast<CBLAS_LAYOUT>(layout), @@ -259,18 +258,18 @@ void dtrsv(const int DXTC_CBLAS_ONLY(layout), } -void ztrsm(const int DXTC_CBLAS_ONLY(layout), - const int DXTC_CBLAS_ONLY(side), - const int DXTC_CBLAS_ONLY(uplo), - const int DXTC_CBLAS_ONLY(transa), - const int DXTC_CBLAS_ONLY(diag), - const int DXTC_CBLAS_ONLY(m), - const int DXTC_CBLAS_ONLY(n), - const void* DXTC_CBLAS_ONLY(alpha), - const void* DXTC_CBLAS_ONLY(a), - const int DXTC_CBLAS_ONLY(lda), - void* DXTC_CBLAS_ONLY(b), - const int DXTC_CBLAS_ONLY(ldb)) +void ztrsm(DXTC_CBLAS_ONLY const int layout, + DXTC_CBLAS_ONLY const int side, + DXTC_CBLAS_ONLY const int uplo, + DXTC_CBLAS_ONLY const int transa, + DXTC_CBLAS_ONLY const int diag, + DXTC_CBLAS_ONLY const int m, + DXTC_CBLAS_ONLY const int n, + DXTC_CBLAS_ONLY const void* alpha, + DXTC_CBLAS_ONLY const void* a, + DXTC_CBLAS_ONLY const int lda, + DXTC_CBLAS_ONLY void* b, + DXTC_CBLAS_ONLY const int ldb) { #if HAVE_MKL cblas_ztrsm(static_cast<CBLAS_LAYOUT>(layout), @@ -297,15 +296,15 @@ void ztrsm(const int DXTC_CBLAS_ONLY(layout), } -void ztrsv(const int DXTC_CBLAS_ONLY(layout), - const int DXTC_CBLAS_ONLY(uplo), - const int DXTC_CBLAS_ONLY(transa), - const int DXTC_CBLAS_ONLY(diag), - const int DXTC_CBLAS_ONLY(n), - const void* DXTC_CBLAS_ONLY(a), - const int DXTC_CBLAS_ONLY(lda), - void* DXTC_CBLAS_ONLY(x), - const int DXTC_CBLAS_ONLY(incx)) +void ztrsv(DXTC_CBLAS_ONLY const int layout, + DXTC_CBLAS_ONLY const int uplo, + DXTC_CBLAS_ONLY const int transa, + DXTC_CBLAS_ONLY const int diag, + DXTC_CBLAS_ONLY const int n, + DXTC_CBLAS_ONLY const void* a, + DXTC_CBLAS_ONLY const int lda, + DXTC_CBLAS_ONLY void* x, + DXTC_CBLAS_ONLY const int incx) { #if HAVE_MKL cblas_ztrsv(static_cast<CBLAS_LAYOUT>(layout), diff --git a/dune/xt/common/configuration.cc b/dune/xt/common/configuration.cc index 5254ad12c5dd75a51602a22fc702397e0835225b..7bdc4dc83d8fc1c4b78d76b86028d8b2447ec3f5 100644 --- a/dune/xt/common/configuration.cc +++ b/dune/xt/common/configuration.cc @@ -12,6 +12,8 @@ #include "config.h" +#include <filesystem> + #include <boost/format.hpp> #include <dune/common/parametertreeparser.hh> @@ -24,6 +26,7 @@ namespace Dune { namespace XT { namespace Common { + ConfigurationDefaults::ConfigurationDefaults(bool warn_on_default_access_in, bool log_on_exit_in, std::string logfile_in) @@ -230,7 +233,7 @@ void Configuration::read_command_line(int argc, char* argv[]) boost::format usage("usage: %s parameter.file *[-section.key override-value]"); DUNE_THROW(Dune::Exception, (usage % argv[0]).str()); } - if (boost::filesystem::exists(argv[1])) + if (std::filesystem::exists(argv[1])) Dune::ParameterTreeParser::readINITree(argv[1], *this); Dune::ParameterTreeParser::readOptions(argc, argv, *this); // datadir and logdir may be given from the command line... @@ -245,12 +248,12 @@ void Configuration::read_options(int argc, char* argv[]) void Configuration::setup_() { if (logfile_.empty()) - logfile_ = boost::filesystem::path(ConfigurationDefaults().logfile).string(); + logfile_ = std::filesystem::path(ConfigurationDefaults().logfile).string(); if (has_key("global.datadir") && has_key("logging.dir")) - logfile_ = (boost::filesystem::path(get<std::string>("global.datadir")) / get<std::string>("logging.dir") + logfile_ = (std::filesystem::path(get<std::string>("global.datadir")) / get<std::string>("logging.dir") / "dxtc_parameter.log") .string(); - logfile_ = boost::filesystem::path(logfile_).string(); + logfile_ = std::filesystem::path(logfile_).string(); } // ... setup_(...) void Configuration::add_tree_(const Configuration& other, const std::string sub_id, const bool overwrite) @@ -400,6 +403,7 @@ bool operator!=(const ParameterTree& left, const ParameterTree& right) return !(left == right); } + } // namespace Dune namespace std { diff --git a/dune/xt/common/configuration.hh b/dune/xt/common/configuration.hh index e71dcf44df16c0eb6c504ffa693b1a060f5c2d2f..816ec167baf9cca565b80806f3dc54ba1b3c64ca 100644 --- a/dune/xt/common/configuration.hh +++ b/dune/xt/common/configuration.hh @@ -23,8 +23,6 @@ #include <dune/common/parametertree.hh> #include <dune/xt/common/algorithm.hh> -#include <dune/xt/common/color.hh> -#include <dune/xt/common/exceptions.hh> #include <dune/xt/common/validation.hh> namespace Dune { diff --git a/dune/xt/common/debug.hh b/dune/xt/common/debug.hh index 9a911e4965495db751fe427b0c96caebb1bd3551..248eef2d74a74aba47df0d50cd24c05f829d9f18 100644 --- a/dune/xt/common/debug.hh +++ b/dune/xt/common/debug.hh @@ -14,10 +14,6 @@ #include <cstring> -#include <boost/assert.hpp> -#include <boost/format.hpp> - -#include <dune/xt/common/unused.hh> #include <dune/xt/common/exceptions.hh> @@ -40,7 +36,7 @@ inline char* charcopy(const char* s) //! try to ensure var is not optimized out -#define DXTC_DEBUG_AUTO(name) volatile auto DXTC_UNUSED(name) +#define DXTC_DEBUG_AUTO(name) [[maybe_unused]] volatile auto name #ifndef NDEBUG # define DXT_ASSERT(condition) \ diff --git a/dune/xt/common/filesystem.cc b/dune/xt/common/filesystem.cc index 7b488bc2279a90939e1a31dc42ac8bf1a8fd8904..3f0dc4f710907ea916e20247b31fb01e52c100bf 100644 --- a/dune/xt/common/filesystem.cc +++ b/dune/xt/common/filesystem.cc @@ -18,20 +18,17 @@ namespace Dune { namespace XT { namespace Common { + //! strip filename from \path if present, return empty string if only filename present std::string directory_only(std::string _path) { - return boost::filesystem::path(_path).parent_path().string(); + return std::filesystem::path(_path).parent_path().string(); } //! return everything after the last slash std::string filename_only(const std::string& _path) { -#if BOOST_FILESYSTEM_VERSION > 2 - return boost::filesystem::path(_path).filename().string(); -#else // if BOOST_FILESYSTEM_VERSION > 2 - return boost::filesystem::path(_path).filename(); -#endif // if BOOST_FILESYSTEM_VERSION > 2 + return std::filesystem::path(_path).filename().string(); } // filename_only //! may include filename, will be stripped @@ -39,7 +36,7 @@ void test_create_directory(const std::string _path) { std::string pathonly = directory_only(_path); if (!pathonly.empty()) - boost::filesystem::create_directories(pathonly); + std::filesystem::create_directories(pathonly); } //! pure c++ emulation of system's touch binary @@ -48,18 +45,16 @@ bool touch(const std::string& _path) return std::ofstream(_path.c_str()).is_open(); } -std::unique_ptr<boost::filesystem::ofstream> make_ofstream(const boost::filesystem::path& path, - const std::ios_base::openmode mode) +std::unique_ptr<std::ofstream> make_ofstream(const std::filesystem::path& path, const std::ios_base::openmode mode) { test_create_directory(path.string()); - return std::make_unique<boost::filesystem::ofstream>(path, mode); + return std::make_unique<std::ofstream>(path, mode); } -std::unique_ptr<boost::filesystem::ifstream> make_ifstream(const boost::filesystem::path& path, - const std::ios_base::openmode mode) +std::unique_ptr<std::ifstream> make_ifstream(const std::filesystem::path& path, const std::ios_base::openmode mode) { test_create_directory(path.string()); - return std::make_unique<boost::filesystem::ifstream>(path, mode); + return std::make_unique<std::ifstream>(path, mode); } //! read a file and output all lines containing filter string to a stream @@ -89,6 +84,7 @@ void meminfo(LogStream& stream) stream << "------------ \n\n" << std::endl; } // meminfo + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/filesystem.hh b/dune/xt/common/filesystem.hh index 14f0f9158f1b46e5399978f6d63eb9d9c185694c..8b519d30991a349edd734bd00a0e10aa5a63be13 100644 --- a/dune/xt/common/filesystem.hh +++ b/dune/xt/common/filesystem.hh @@ -13,19 +13,19 @@ #ifndef DUNE_XT_COMMON_FILESYSTEM_HH #define DUNE_XT_COMMON_FILESYSTEM_HH -#include "debug.hh" -#include "string.hh" -#include "logstreams.hh" -#include <string> +#include <filesystem> #include <fstream> +#include <ios> +#include <memory> +#include <string> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> +#include <dune/xt/common/logstreams.hh> namespace Dune { namespace XT { namespace Common { + //! strip filename from \path if present, return empty string if only filename present std::string directory_only(std::string _path); @@ -38,11 +38,11 @@ void test_create_directory(const std::string _path); //! pure c++ emulation of system's touch binary bool touch(const std::string& _path); -std::unique_ptr<boost::filesystem::ofstream> make_ofstream(const boost::filesystem::path& path, - const std::ios_base::openmode mode = std::ios_base::out); +std::unique_ptr<std::ofstream> make_ofstream(const std::filesystem::path& path, + const std::ios_base::openmode mode = std::ios_base::out); -std::unique_ptr<boost::filesystem::ifstream> make_ifstream(const boost::filesystem::path& path, - const std::ios_base::openmode mode = std::ios_base::in); +std::unique_ptr<std::ifstream> make_ifstream(const std::filesystem::path& path, + const std::ios_base::openmode mode = std::ios_base::in); //! read a file and output all lines containing filter string to a stream void file_to_stream_filtered(std::ostream& stream, std::string filename, std::string filter); @@ -50,6 +50,7 @@ void file_to_stream_filtered(std::ostream& stream, std::string filename, std::st //! output programs mem usage stats by reading from /proc void meminfo(LogStream& stream); + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/fixed_map.hh b/dune/xt/common/fixed_map.hh index 3ff9bf3d4b40897e16cf4df1dc224b337a7ab5e2..ca4b88ab67be4425b6def86309683163ede05b5d 100644 --- a/dune/xt/common/fixed_map.hh +++ b/dune/xt/common/fixed_map.hh @@ -15,16 +15,15 @@ #include <array> #include <utility> -#include <boost/array.hpp> -#include <boost/range/adaptor/map.hpp> -#include <boost/iterator/iterator_facade.hpp> + #include <boost/assign/list_of.hpp> -#include <dune/common/exceptions.hh> +#include <boost/iterator/iterator_facade.hpp> namespace Dune { namespace XT { namespace Common { + //! custom iterator for \ref FixedMap template <class FixedMapType> class FixedMapIterator @@ -117,7 +116,7 @@ public: static constexpr std::size_t N = nin; private: - typedef boost::array<value_type, nin> MapType; + typedef std::array<value_type, nin> MapType; template <class R> friend class FixedMapIterator; @@ -126,7 +125,7 @@ private: typedef FixedMap<key_imp, T, nin> ThisType; - std::string range_error_message(key_imp key) const + std::string range_error_message([[maybe_unused]] key_imp key) const { std::stringstream ss; if constexpr (std::is_convertible<key_imp, std::string>::value) { @@ -238,12 +237,16 @@ private: } // namespace Dune namespace std { + + template <class key_imp, class T, std::size_t nin> inline ostream& operator<<(ostream& out, const Dune::XT::Common::FixedMap<key_imp, T, nin>& map) { map.print(out); return out; } + + } // namespace std #endif // DUNE_XT_COMMON_FIXED_MAP_HH diff --git a/dune/xt/common/fmatrix-2.6.hh b/dune/xt/common/fmatrix-2.6.hh index 019cd1347b9d236853934b13be9d80761814c466..ab81de582ec5ac31c2073eca8c6faf86cae6e5ef 100644 --- a/dune/xt/common/fmatrix-2.6.hh +++ b/dune/xt/common/fmatrix-2.6.hh @@ -15,14 +15,12 @@ #include <initializer_list> -#include <dune/common/fmatrix.hh> -#include <dune/common/fvector.hh> - -#include <dune/xt/common/exceptions.hh> #include <dune/xt/common/debug.hh> -#include <dune/xt/common/matrix.hh> +#include <dune/xt/common/exceptions.hh> #include <dune/xt/common/fvector.hh> +#include <dune/xt/common/matrix.hh> #include <dune/xt/common/type_traits.hh> +#include <dune/xt/common/unused.hh> namespace Dune { namespace XT { @@ -53,8 +51,8 @@ public: } } - FieldMatrix(const size_t DXTC_DEBUG_ONLY(rr), - const size_t DXTC_DEBUG_ONLY(cc), + FieldMatrix(DXTC_DEBUG_ONLY const size_t rr, + DXTC_DEBUG_ONLY const size_t cc, const K& kk = suitable_default<K>::value()) : BaseType() { @@ -470,8 +468,8 @@ public: } } // FieldMatrix(std::initializer_list<std::initializer_list<K>> list_of_rows) - FieldMatrix(const size_t DXTC_DEBUG_ONLY(rr), - const size_t DXTC_DEBUG_ONLY(cc), + FieldMatrix(DXTC_DEBUG_ONLY const size_t rr, + DXTC_DEBUG_ONLY const size_t cc, const K& kk = suitable_default<K>::value()) : BaseType() { @@ -538,7 +536,7 @@ public: : backend_(BlockType(val)) {} - BlockedFieldMatrix(const size_t DXTC_DEBUG_ONLY(rows), const size_t DXTC_DEBUG_ONLY(cols), const K& val = K(0.)) + BlockedFieldMatrix(DXTC_DEBUG_ONLY const size_t rows, DXTC_DEBUG_ONLY const size_t cols, const K& val = K(0.)) : backend_(BlockType(val)) { assert(rows == num_rows && cols == num_cols && "Requested shape has to match static shape!"); diff --git a/dune/xt/common/fmatrix-2.7.hh b/dune/xt/common/fmatrix-2.7.hh index c8cc7e37eea9f006db03c023aa510f8c4d71c575..8df09029987198460067fffb3d4d31e4b9cfb155 100644 --- a/dune/xt/common/fmatrix-2.7.hh +++ b/dune/xt/common/fmatrix-2.7.hh @@ -15,14 +15,12 @@ #include <initializer_list> -#include <dune/common/fmatrix.hh> -#include <dune/common/fvector.hh> - -#include <dune/xt/common/exceptions.hh> #include <dune/xt/common/debug.hh> -#include <dune/xt/common/matrix.hh> +#include <dune/xt/common/exceptions.hh> #include <dune/xt/common/fvector.hh> +#include <dune/xt/common/matrix.hh> #include <dune/xt/common/type_traits.hh> +#include <dune/xt/common/unused.hh> namespace Dune { namespace XT { @@ -53,8 +51,8 @@ public: } } - FieldMatrix(const size_t DXTC_DEBUG_ONLY(rr), - const size_t DXTC_DEBUG_ONLY(cc), + FieldMatrix(DXTC_DEBUG_ONLY const size_t rr, + DXTC_DEBUG_ONLY const size_t cc, const K& kk = suitable_default<K>::value()) : BaseType() { @@ -271,8 +269,8 @@ public: } } // FieldMatrix(std::initializer_list<std::initializer_list<K>> list_of_rows) - FieldMatrix(const size_t DXTC_DEBUG_ONLY(rr), - const size_t DXTC_DEBUG_ONLY(cc), + FieldMatrix(DXTC_DEBUG_ONLY const size_t rr, + DXTC_DEBUG_ONLY const size_t cc, const K& kk = suitable_default<K>::value()) : BaseType() { @@ -424,7 +422,7 @@ public: : backend_(BlockType(val)) {} - BlockedFieldMatrix(const size_t DXTC_DEBUG_ONLY(rows), const size_t DXTC_DEBUG_ONLY(cols), const K& val = K(0.)) + BlockedFieldMatrix(DXTC_DEBUG_ONLY const size_t rows, DXTC_DEBUG_ONLY const size_t cols, const K& val = K(0.)) : backend_(BlockType(val)) { assert(rows == num_rows && cols == num_cols && "Requested shape has to match static shape!"); diff --git a/dune/xt/common/lapacke.cc b/dune/xt/common/lapacke.cc index 11370f27703ceb2553d54b14a6534af8e81f2ebc..90c30ce6c7e5ae677b4e9601885cc57f3b77e914 100644 --- a/dune/xt/common/lapacke.cc +++ b/dune/xt/common/lapacke.cc @@ -24,14 +24,13 @@ #endif #include <dune/xt/common/exceptions.hh> -#include <dune/xt/common/unused.hh> #include "lapacke.hh" #if HAVE_MKL || HAVE_LAPACKE -# define DXTC_LAPACKE_ONLY(param) param +# define DXTC_LAPACKE_ONLY #else -# define DXTC_LAPACKE_ONLY(param) DXTC_UNUSED(param) +# define DXTC_LAPACKE_ONLY [[maybe_unused]] #endif namespace Dune { @@ -72,18 +71,18 @@ int col_major() } -int dgeev(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(jobvl), - char DXTC_LAPACKE_ONLY(jobvr), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(wr), - double* DXTC_LAPACKE_ONLY(wi), - double* DXTC_LAPACKE_ONLY(vl), - int DXTC_LAPACKE_ONLY(ldvl), - double* DXTC_LAPACKE_ONLY(vr), - int DXTC_LAPACKE_ONLY(ldvr)) +int dgeev(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char jobvl, + DXTC_LAPACKE_ONLY char jobvr, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* wr, + DXTC_LAPACKE_ONLY double* wi, + DXTC_LAPACKE_ONLY double* vl, + DXTC_LAPACKE_ONLY int ldvl, + DXTC_LAPACKE_ONLY double* vr, + DXTC_LAPACKE_ONLY int ldvr) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeev(matrix_layout, jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr); @@ -92,20 +91,20 @@ int dgeev(int DXTC_LAPACKE_ONLY(matrix_layout), return 1; #endif } -int dgeev_work(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(jobvl), - char DXTC_LAPACKE_ONLY(jobvr), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(wr), - double* DXTC_LAPACKE_ONLY(wi), - double* DXTC_LAPACKE_ONLY(vl), - int DXTC_LAPACKE_ONLY(ldvl), - double* DXTC_LAPACKE_ONLY(vr), - int DXTC_LAPACKE_ONLY(ldvr), - double* DXTC_LAPACKE_ONLY(work), - int DXTC_LAPACKE_ONLY(lwork)) +int dgeev_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char jobvl, + DXTC_LAPACKE_ONLY char jobvr, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* wr, + DXTC_LAPACKE_ONLY double* wi, + DXTC_LAPACKE_ONLY double* vl, + DXTC_LAPACKE_ONLY int ldvl, + DXTC_LAPACKE_ONLY double* vr, + DXTC_LAPACKE_ONLY int ldvr, + DXTC_LAPACKE_ONLY double* work, + DXTC_LAPACKE_ONLY int lwork) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeev_work(matrix_layout, jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork); @@ -116,26 +115,26 @@ int dgeev_work(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dgeevx(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(balanc), - char DXTC_LAPACKE_ONLY(jobvl), - char DXTC_LAPACKE_ONLY(jobvr), - char DXTC_LAPACKE_ONLY(sense), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(wr), - double* DXTC_LAPACKE_ONLY(wi), - double* DXTC_LAPACKE_ONLY(vl), - int DXTC_LAPACKE_ONLY(ldvl), - double* DXTC_LAPACKE_ONLY(vr), - int DXTC_LAPACKE_ONLY(ldvr), - int* DXTC_LAPACKE_ONLY(ilo), - int* DXTC_LAPACKE_ONLY(ihi), - double* DXTC_LAPACKE_ONLY(scale), - double* DXTC_LAPACKE_ONLY(abnrm), - double* DXTC_LAPACKE_ONLY(rconde), - double* DXTC_LAPACKE_ONLY(rcondv)) +int dgeevx(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char balanc, + DXTC_LAPACKE_ONLY char jobvl, + DXTC_LAPACKE_ONLY char jobvr, + DXTC_LAPACKE_ONLY char sense, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* wr, + DXTC_LAPACKE_ONLY double* wi, + DXTC_LAPACKE_ONLY double* vl, + DXTC_LAPACKE_ONLY int ldvl, + DXTC_LAPACKE_ONLY double* vr, + DXTC_LAPACKE_ONLY int ldvr, + DXTC_LAPACKE_ONLY int* ilo, + DXTC_LAPACKE_ONLY int* ihi, + DXTC_LAPACKE_ONLY double* scale, + DXTC_LAPACKE_ONLY double* abnrm, + DXTC_LAPACKE_ONLY double* rconde, + DXTC_LAPACKE_ONLY double* rcondv) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeevx(matrix_layout, @@ -164,29 +163,29 @@ int dgeevx(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dgeevx_work(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(balanc), - char DXTC_LAPACKE_ONLY(jobvl), - char DXTC_LAPACKE_ONLY(jobvr), - char DXTC_LAPACKE_ONLY(sense), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(wr), - double* DXTC_LAPACKE_ONLY(wi), - double* DXTC_LAPACKE_ONLY(vl), - int DXTC_LAPACKE_ONLY(ldvl), - double* DXTC_LAPACKE_ONLY(vr), - int DXTC_LAPACKE_ONLY(ldvr), - int* DXTC_LAPACKE_ONLY(ilo), - int* DXTC_LAPACKE_ONLY(ihi), - double* DXTC_LAPACKE_ONLY(scale), - double* DXTC_LAPACKE_ONLY(abnrm), - double* DXTC_LAPACKE_ONLY(rconde), - double* DXTC_LAPACKE_ONLY(rcondv), - double* DXTC_LAPACKE_ONLY(work), - int DXTC_LAPACKE_ONLY(lwork), - int* DXTC_LAPACKE_ONLY(iwork)) +int dgeevx_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char balanc, + DXTC_LAPACKE_ONLY char jobvl, + DXTC_LAPACKE_ONLY char jobvr, + DXTC_LAPACKE_ONLY char sense, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* wr, + DXTC_LAPACKE_ONLY double* wi, + DXTC_LAPACKE_ONLY double* vl, + DXTC_LAPACKE_ONLY int ldvl, + DXTC_LAPACKE_ONLY double* vr, + DXTC_LAPACKE_ONLY int ldvr, + DXTC_LAPACKE_ONLY int* ilo, + DXTC_LAPACKE_ONLY int* ihi, + DXTC_LAPACKE_ONLY double* scale, + DXTC_LAPACKE_ONLY double* abnrm, + DXTC_LAPACKE_ONLY double* rconde, + DXTC_LAPACKE_ONLY double* rcondv, + DXTC_LAPACKE_ONLY double* work, + DXTC_LAPACKE_ONLY int lwork, + DXTC_LAPACKE_ONLY int* iwork) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeevx_work(matrix_layout, @@ -219,13 +218,13 @@ int dgeevx_work(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dgeqp3(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - int* DXTC_LAPACKE_ONLY(jpvt), - double* DXTC_LAPACKE_ONLY(tau)) +int dgeqp3(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY int* jpvt, + DXTC_LAPACKE_ONLY double* tau) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeqp3(matrix_layout, m, n, a, lda, jpvt, tau); @@ -235,15 +234,15 @@ int dgeqp3(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dgeqp3_work(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - int* DXTC_LAPACKE_ONLY(jpvt), - double* DXTC_LAPACKE_ONLY(tau), - double* DXTC_LAPACKE_ONLY(work), - int DXTC_LAPACKE_ONLY(lwork)) +int dgeqp3_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY int* jpvt, + DXTC_LAPACKE_ONLY double* tau, + DXTC_LAPACKE_ONLY double* work, + DXTC_LAPACKE_ONLY int lwork) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgeqp3_work(matrix_layout, m, n, a, lda, jpvt, tau, work, lwork); @@ -253,19 +252,19 @@ int dgeqp3_work(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dgesvd(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(jobu), - char DXTC_LAPACKE_ONLY(jobvt), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(s), - double* DXTC_LAPACKE_ONLY(u), - int DXTC_LAPACKE_ONLY(ldu), - double* DXTC_LAPACKE_ONLY(vt), - int DXTC_LAPACKE_ONLY(ldvt), - double* DXTC_LAPACKE_ONLY(superb)) +int dgesvd(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char jobu, + DXTC_LAPACKE_ONLY char jobvt, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* s, + DXTC_LAPACKE_ONLY double* u, + DXTC_LAPACKE_ONLY int ldu, + DXTC_LAPACKE_ONLY double* vt, + DXTC_LAPACKE_ONLY int ldvt, + DXTC_LAPACKE_ONLY double* superb) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dgesvd(matrix_layout, jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, superb); @@ -285,13 +284,13 @@ double dlamch(char DXTC_LAPACKE_ONLY(cmach)) #endif } -int dorgqr(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const double* DXTC_LAPACKE_ONLY(tau)) +int dorgqr(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const double* tau) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dorgqr(matrix_layout, m, n, k, a, lda, tau); @@ -301,15 +300,15 @@ int dorgqr(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dorgqr_work(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const double* DXTC_LAPACKE_ONLY(tau), - double* DXTC_LAPACKE_ONLY(work), - int DXTC_LAPACKE_ONLY(lwork)) +int dorgqr_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const double* tau, + DXTC_LAPACKE_ONLY double* work, + DXTC_LAPACKE_ONLY int lwork) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dorgqr_work(matrix_layout, m, n, k, a, lda, tau, work, lwork); @@ -320,17 +319,17 @@ int dorgqr_work(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dormqr(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(side), - char DXTC_LAPACKE_ONLY(trans), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - const double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const double* DXTC_LAPACKE_ONLY(tau), - double* DXTC_LAPACKE_ONLY(c), - int DXTC_LAPACKE_ONLY(ldc)) +int dormqr(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char side, + DXTC_LAPACKE_ONLY char trans, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY const double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const double* tau, + DXTC_LAPACKE_ONLY double* c, + DXTC_LAPACKE_ONLY int ldc) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dormqr(matrix_layout, side, trans, m, n, k, a, lda, tau, c, ldc); @@ -340,19 +339,19 @@ int dormqr(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dormqr_work(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(side), - char DXTC_LAPACKE_ONLY(trans), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - const double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const double* DXTC_LAPACKE_ONLY(tau), - double* DXTC_LAPACKE_ONLY(c), - int DXTC_LAPACKE_ONLY(ldc), - double* DXTC_LAPACKE_ONLY(work), - int DXTC_LAPACKE_ONLY(lwork)) +int dormqr_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char side, + DXTC_LAPACKE_ONLY char trans, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY const double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const double* tau, + DXTC_LAPACKE_ONLY double* c, + DXTC_LAPACKE_ONLY int ldc, + DXTC_LAPACKE_ONLY double* work, + DXTC_LAPACKE_ONLY int lwork) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dormqr_work(matrix_layout, side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork); @@ -363,11 +362,11 @@ int dormqr_work(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dpotrf(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(uplo), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda)) +int dpotrf(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char uplo, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dpotrf(matrix_layout, uplo, n, a, lda); @@ -377,11 +376,11 @@ int dpotrf(int DXTC_LAPACKE_ONLY(matrix_layout), #endif } -int dpotrf_work(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(uplo), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda)) +int dpotrf_work(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char uplo, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dpotrf_work(matrix_layout, uplo, n, a, lda); @@ -392,11 +391,11 @@ int dpotrf_work(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dptcon(int DXTC_LAPACKE_ONLY(n), - const double* DXTC_LAPACKE_ONLY(d), - const double* DXTC_LAPACKE_ONLY(e), - double DXTC_LAPACKE_ONLY(anorm), - double* DXTC_LAPACKE_ONLY(rcond)) +int dptcon(DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY const double* d, + DXTC_LAPACKE_ONLY const double* e, + DXTC_LAPACKE_ONLY double anorm, + DXTC_LAPACKE_ONLY double* rcond) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dptcon(n, d, e, anorm, rcond); @@ -407,13 +406,13 @@ int dptcon(int DXTC_LAPACKE_ONLY(n), } -int dpocon(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(uplo), - int DXTC_LAPACKE_ONLY(n), - const double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double DXTC_LAPACKE_ONLY(anorm), - double* DXTC_LAPACKE_ONLY(rcond)) +int dpocon(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char uplo, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY const double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double anorm, + DXTC_LAPACKE_ONLY double* rcond) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dpocon(matrix_layout, uplo, n, a, lda, anorm, rcond); @@ -424,16 +423,16 @@ int dpocon(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dsygv(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(itype), - char DXTC_LAPACKE_ONLY(jobz), - char DXTC_LAPACKE_ONLY(uplo), - int DXTC_LAPACKE_ONLY(n), - double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(b), - int DXTC_LAPACKE_ONLY(ldb), - double* DXTC_LAPACKE_ONLY(w)) +int dsygv(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int itype, + DXTC_LAPACKE_ONLY char jobz, + DXTC_LAPACKE_ONLY char uplo, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* b, + DXTC_LAPACKE_ONLY int ldb, + DXTC_LAPACKE_ONLY double* w) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dsygv(matrix_layout, itype, jobz, uplo, n, a, lda, b, ldb, w); @@ -444,14 +443,14 @@ int dsygv(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dtrcon(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(norm), - char DXTC_LAPACKE_ONLY(uplo), - char DXTC_LAPACKE_ONLY(diag), - int DXTC_LAPACKE_ONLY(n), - const double* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - double* DXTC_LAPACKE_ONLY(rcond)) +int dtrcon(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char norm, + DXTC_LAPACKE_ONLY char uplo, + DXTC_LAPACKE_ONLY char diag, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY const double* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY double* rcond) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dtrcon(matrix_layout, norm, uplo, diag, n, a, lda, rcond); @@ -462,7 +461,7 @@ int dtrcon(int DXTC_LAPACKE_ONLY(matrix_layout), } -int dpttrf(int DXTC_LAPACKE_ONLY(n), double* DXTC_LAPACKE_ONLY(d), double* DXTC_LAPACKE_ONLY(e)) +int dpttrf(DXTC_LAPACKE_ONLY int n, DXTC_LAPACKE_ONLY double* d, DXTC_LAPACKE_ONLY double* e) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dpttrf(n, d, e); @@ -473,13 +472,13 @@ int dpttrf(int DXTC_LAPACKE_ONLY(n), double* DXTC_LAPACKE_ONLY(d), double* DXTC_ } -int dpttrs(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(nrhs), - const double* DXTC_LAPACKE_ONLY(d), - const double* DXTC_LAPACKE_ONLY(e), - double* DXTC_LAPACKE_ONLY(b), - int DXTC_LAPACKE_ONLY(ldb)) +int dpttrs(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int nrhs, + DXTC_LAPACKE_ONLY const double* d, + DXTC_LAPACKE_ONLY const double* e, + DXTC_LAPACKE_ONLY double* b, + DXTC_LAPACKE_ONLY int ldb) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_dpttrs(matrix_layout, n, nrhs, d, e, b, ldb); @@ -490,13 +489,13 @@ int dpttrs(int DXTC_LAPACKE_ONLY(matrix_layout), } -int zgeqp3(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - std::complex<double>* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - int* DXTC_LAPACKE_ONLY(jpvt), - std::complex<double>* DXTC_LAPACKE_ONLY(tau)) +int zgeqp3(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY std::complex<double>* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY int* jpvt, + DXTC_LAPACKE_ONLY std::complex<double>* tau) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_zgeqp3(matrix_layout, m, n, a, lda, jpvt, tau); @@ -507,13 +506,13 @@ int zgeqp3(int DXTC_LAPACKE_ONLY(matrix_layout), } -int zungqr(int DXTC_LAPACKE_ONLY(matrix_layout), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - std::complex<double>* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const std::complex<double>* DXTC_LAPACKE_ONLY(tau)) +int zungqr(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY std::complex<double>* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const std::complex<double>* tau) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_zungqr(matrix_layout, m, n, k, a, lda, tau); @@ -524,17 +523,17 @@ int zungqr(int DXTC_LAPACKE_ONLY(matrix_layout), } -int zunmqr(int DXTC_LAPACKE_ONLY(matrix_layout), - char DXTC_LAPACKE_ONLY(side), - char DXTC_LAPACKE_ONLY(trans), - int DXTC_LAPACKE_ONLY(m), - int DXTC_LAPACKE_ONLY(n), - int DXTC_LAPACKE_ONLY(k), - const std::complex<double>* DXTC_LAPACKE_ONLY(a), - int DXTC_LAPACKE_ONLY(lda), - const std::complex<double>* DXTC_LAPACKE_ONLY(tau), - std::complex<double>* DXTC_LAPACKE_ONLY(c), - int DXTC_LAPACKE_ONLY(ldc)) +int zunmqr(DXTC_LAPACKE_ONLY int matrix_layout, + DXTC_LAPACKE_ONLY char side, + DXTC_LAPACKE_ONLY char trans, + DXTC_LAPACKE_ONLY int m, + DXTC_LAPACKE_ONLY int n, + DXTC_LAPACKE_ONLY int k, + DXTC_LAPACKE_ONLY const std::complex<double>* a, + DXTC_LAPACKE_ONLY int lda, + DXTC_LAPACKE_ONLY const std::complex<double>* tau, + DXTC_LAPACKE_ONLY std::complex<double>* c, + DXTC_LAPACKE_ONLY int ldc) { #if HAVE_MKL || HAVE_LAPACKE return LAPACKE_zunmqr(matrix_layout, side, trans, m, n, k, a, lda, tau, c, ldc); diff --git a/dune/xt/common/logging.cc b/dune/xt/common/logging.cc index b964e74a581a1ccadd2b2032af888810cecec112..ec6f60116f898e49ac5b5642afdad5cd432cd232 100644 --- a/dune/xt/common/logging.cc +++ b/dune/xt/common/logging.cc @@ -13,11 +13,10 @@ #include <boost/format.hpp> -#include <dune/common/unused.hh> +// #include <dune/xt/common/memory.hh> +#include <dune/xt/common/exceptions.hh> +#include <dune/xt/common/filesystem.hh> -#include "memory.hh" -#include "exceptions.hh" -#include "filesystem.hh" #include "logging.hh" namespace Dune { @@ -49,7 +48,7 @@ Logging::~Logging() void Logging::create(int logflags, const std::string logfile, const std::string datadir, const std::string _logdir) { - using namespace boost::filesystem; + using namespace std::filesystem; const auto& comm = Dune::MPIHelper::getCollectiveCommunication(); boost::format log_fn("%s%s"); if (comm.size() > 1) { diff --git a/dune/xt/common/logging.hh b/dune/xt/common/logging.hh index 9174af0aaf10958d557b5a558b867d216e053867..7771d0e214af792c6df57b404e7463ffeeb1e8f5 100644 --- a/dune/xt/common/logging.hh +++ b/dune/xt/common/logging.hh @@ -9,30 +9,22 @@ // René Fritze (2009 - 2019) // Tobias Leibner (2014, 2018, 2020) -/** - * \file logging.hh - * \brief logging - **/ #ifndef DUNE_XT_COMMON_LOGGING_HH #define DUNE_XT_COMMON_LOGGING_HH #include <map> #include <string> -#include <mutex> +#include <filesystem> #include <dune/common/visibility.hh> -#include <dune/xt/common/disable_warnings.hh> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> -#include <dune/xt/common/reenable_warnings.hh> - #include <dune/xt/common/logstreams.hh> namespace Dune { namespace XT { namespace Common { + class Logging; //! global Logging instance inline Logging& Logger(); @@ -134,9 +126,9 @@ public: }; private: - boost::filesystem::path filename_; - boost::filesystem::path filenameWoTime_; - boost::filesystem::ofstream logfile_; + std::filesystem::path filename_; + std::filesystem::path filenameWoTime_; + std::ofstream logfile_; typedef std::map<int, int> FlagMap; FlagMap flagmap_; typedef std::map<int, std::unique_ptr<LogStream>> StreamMap; @@ -158,6 +150,7 @@ DUNE_EXPORT inline Logging& Logger() return log; } + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/logstreams.cc b/dune/xt/common/logstreams.cc index 7bde36155f811a594b7a9af383c31291d3b4315c..c6169034b65ed880ecd5ff2b712a9663650139c9 100644 --- a/dune/xt/common/logstreams.cc +++ b/dune/xt/common/logstreams.cc @@ -11,14 +11,19 @@ // Tobias Leibner (2016, 2019 - 2020) #include "config.h" -#include "logstreams.hh" -#include <dune/common/unused.hh> +#include <boost/algorithm/string/constants.hpp> +#include <boost/format.hpp> + +#include <dune/xt/common/string.hh> + +#include "logstreams.hh" namespace Dune { namespace XT { namespace Common { + SuspendableStrBuffer::SuspendableStrBuffer(int loglevel, int& logflags) : logflags_(logflags) , loglevel_(loglevel) @@ -84,7 +89,7 @@ TimedPrefixedStreamBuffer::TimedPrefixedStreamBuffer(const Timer& timer, const s int TimedPrefixedStreamBuffer::sync() { - DUNE_UNUSED std::lock_guard<std::mutex> guard(mutex_); + [[maybe_unused]] std::lock_guard<std::mutex> guard(mutex_); const std::string tmp_str = str(); if (prefix_needed_ && !tmp_str.empty()) { out_ << elapsed_time_str() << prefix_; @@ -210,6 +215,7 @@ EmptyLogStream::EmptyLogStream(int& logflags) : LogStream(new EmptyBuffer(int(LOG_NONE), logflags)) {} + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/logstreams.hh b/dune/xt/common/logstreams.hh index 053e07820ce74734a4977cc9a9d1d1e491b63a36..ae82ed77c275c027b6a191cb2842008827954b2b 100644 --- a/dune/xt/common/logstreams.hh +++ b/dune/xt/common/logstreams.hh @@ -23,13 +23,13 @@ #include <dune/common/timer.hh> -#include "memory.hh" -#include "string.hh" +#include <dune/xt/common/memory.hh> namespace Dune { namespace XT { namespace Common { + enum LogFlags { LOG_NONE = 1, @@ -271,6 +271,7 @@ int dev_null_logflag; EmptyLogStream dev_null(dev_null_logflag); } // namespace + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/memory.cc b/dune/xt/common/memory.cc index 7eaca0d55faa77048adff9ab0b88b00f306bb51f..91917e3d072a58972717cdf07786112c77ab663a 100644 --- a/dune/xt/common/memory.cc +++ b/dune/xt/common/memory.cc @@ -18,8 +18,6 @@ #include <dune/xt/common/configuration.hh> #include <sys/resource.h> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> namespace Dune { namespace XT { @@ -39,7 +37,7 @@ void mem_usage(std::string filename) long meanPeakMemConsumption = totalPeakMemConsumption / comm.size(); // write output on rank zero if (comm.rank() == 0) { - std::unique_ptr<boost::filesystem::ofstream> memoryConsFile(make_ofstream(filename)); + std::unique_ptr<std::ofstream> memoryConsFile(make_ofstream(filename)); *memoryConsFile << "global.maxPeakMemoryConsumption,global.meanPeakMemoryConsumption\n" << maxPeakMemConsumption << "," << meanPeakMemConsumption << std::endl; } diff --git a/dune/xt/common/memory.hh b/dune/xt/common/memory.hh index c84c62b399a33a34a484e85fbd23a2c6b7cb7c4d..c2bfcd0a3c5dd9f6061a0aefb5060d6d08998f25 100644 --- a/dune/xt/common/memory.hh +++ b/dune/xt/common/memory.hh @@ -14,7 +14,6 @@ #include <cassert> #include <memory> -#include <boost/noncopyable.hpp> #include <dune/xt/common/debug.hh> diff --git a/dune/xt/common/misc.cc b/dune/xt/common/misc.cc index 555c53a28ce049c669db3ea2eff6d90d2b66a1ac..68a8faa7751f3925fe235178f34747f6c8f01007 100644 --- a/dune/xt/common/misc.cc +++ b/dune/xt/common/misc.cc @@ -26,7 +26,7 @@ namespace Dune { namespace XT { namespace Common { -void dump_environment(boost::filesystem::ofstream& file, std::string csv_sep) +void dump_environment(std::ofstream& file, std::string csv_sep) { using namespace std; vector<string> header, values; diff --git a/dune/xt/common/misc.hh b/dune/xt/common/misc.hh index 35869eef2c31c521cc88ee16753cdce2b5997701..0066a9fb3cae63ddf529b4d8f61be4709f90726f 100644 --- a/dune/xt/common/misc.hh +++ b/dune/xt/common/misc.hh @@ -39,7 +39,6 @@ #include <dune/xt/common/disable_warnings.hh> #include <boost/algorithm/string.hpp> #include <dune/xt/common/reenable_warnings.hh> -#include <boost/filesystem/fstream.hpp> #include <dune/xt/common/exceptions.hh> #include <dune/xt/common/logging.hh> @@ -95,7 +94,7 @@ std::array<T, N> make_array(const std::vector<T>& v) } //! writes process environment to file -void dump_environment(boost::filesystem::ofstream& file, std::string csv_sep = ","); +void dump_environment(std::ofstream& file, std::string csv_sep = ","); } // namespace Common } // namespace XT diff --git a/dune/xt/common/string.hh b/dune/xt/common/string.hh index 5f16a9435e78d76cbd822466588c284f542b106f..11b186f6193336e4abc2e96004bea8a7d95a5f2a 100644 --- a/dune/xt/common/string.hh +++ b/dune/xt/common/string.hh @@ -129,10 +129,8 @@ std::string whitespaceify(const T& t, const char whitespace = ' ') { const std::string s = to_string(t); std::string ret = ""; - for (auto ii : value_range(s.size())) { + for ([[maybe_unused]] auto ii : value_range(s.size())) ret += whitespace; - (void)ii; - } return ret; } // ... whitespaceify(...) diff --git a/dune/xt/common/string_internal.hh b/dune/xt/common/string_internal.hh index e48543dc4275183b89a9553eb244fc8480a1c207..cbae0c1c0d17141ded5306cdc208d1200f14093f 100644 --- a/dune/xt/common/string_internal.hh +++ b/dune/xt/common/string_internal.hh @@ -29,10 +29,11 @@ #include <dune/xt/common/debug.hh> #include <dune/xt/common/exceptions.hh> +#include <dune/xt/common/matrix.hh> #include <dune/xt/common/ranges.hh> #include <dune/xt/common/type_traits.hh> +#include <dune/xt/common/unused.hh> #include <dune/xt/common/vector.hh> -#include <dune/xt/common/matrix.hh> namespace Dune { namespace XT { @@ -183,7 +184,7 @@ ComplexType complex_from_string(std::string ss, const size_t /*size*/ = 0, const } template <class VectorType> -VectorType vector_from_string(std::string vector_str, const size_t size, const size_t DXTC_DEBUG_ONLY(cols) = 0) +VectorType vector_from_string(std::string vector_str, const size_t size, DXTC_DEBUG_ONLY const size_t cols = 0) { typedef typename VectorAbstraction<VectorType>::S S; DXT_ASSERT(cols == 0); diff --git a/dune/xt/common/timedlogging.cc b/dune/xt/common/timedlogging.cc index 1bcf5a23417f49eb7ee39084a2cccafcc740e9c7..6aae01442186260e79f4dd92065c57732fbd08cb 100644 --- a/dune/xt/common/timedlogging.cc +++ b/dune/xt/common/timedlogging.cc @@ -15,8 +15,6 @@ #include <boost/format.hpp> -#include <dune/common/unused.hh> - #include "memory.hh" #include "exceptions.hh" #include "filesystem.hh" @@ -220,7 +218,7 @@ void TimedLogging::create(const ssize_t max_info_level, const std::string& debug_color, const std::string& warning_color) { - DUNE_UNUSED std::lock_guard<std::mutex> guard(mutex_); + [[maybe_unused]] std::lock_guard<std::mutex> guard(mutex_); DUNE_THROW_IF(created_, Exceptions::logger_error, "Do not call create() more than once!"); max_info_level_ = max_info_level; max_debug_level_ = max_debug_level; @@ -236,7 +234,7 @@ void TimedLogging::create(const ssize_t max_info_level, TimedLogManager TimedLogging::get(const std::string& id) { - DUNE_UNUSED std::lock_guard<std::mutex> guard(mutex_); + [[maybe_unused]] std::lock_guard<std::mutex> guard(mutex_); ++current_level_; return TimedLogManager(timer_, info_prefix_ + (id.empty() ? "info" : id) + ": " + info_suffix_, diff --git a/dune/xt/common/timedlogging.hh b/dune/xt/common/timedlogging.hh index 54ebcc75945e0143407e23123073549869d63cdd..3cb3581fbe8c0b598e69f2286fe33abc8cac25b4 100644 --- a/dune/xt/common/timedlogging.hh +++ b/dune/xt/common/timedlogging.hh @@ -21,9 +21,6 @@ #include <mutex> #include <atomic> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> - #include <dune/common/parallel/mpihelper.hh> #include <dune/common/timer.hh> #include <dune/common/visibility.hh> diff --git a/dune/xt/common/timings.cc b/dune/xt/common/timings.cc index d8124eed6def31b684e4b0ec06cd38224fb13ab2..c9481d56dcb1c98618d58222cabded1c121a348e 100644 --- a/dune/xt/common/timings.cc +++ b/dune/xt/common/timings.cc @@ -11,9 +11,8 @@ // Tobias Leibner (2014, 2018, 2020) #include "config.h" -#include "timings.hh" -#include <dune/common/version.hh> +#include "timings.hh" #if HAVE_LIKWID && ENABLE_PERFMON # include <likwid.h> @@ -28,34 +27,19 @@ # define DXTC_LIKWID_CLOSE #endif -#include <dune/common/parallel/mpihelper.hh> - -#include <dune/xt/common/string.hh> +// #include <dune/xt/common/string.hh> #include <dune/xt/common/ranges.hh> #include <dune/xt/common/filesystem.hh> -#include <dune/xt/common/logging.hh> -#include <dune/xt/common/parallel/threadmanager.hh> -#include <dune/xt/common/parallel/threadstorage.hh> - -#include <map> -#include <string> #include <dune/xt/common/disable_warnings.hh> -#include <boost/foreach.hpp> #include <boost/format.hpp> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> -#include <boost/foreach.hpp> -#include <boost/format.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/config.hpp> -#include <boost/timer/timer.hpp> #include <dune/xt/common/reenable_warnings.hh> namespace Dune { namespace XT { namespace Common { + TimingData::TimingData(std::string _name) : timer_(new boost::timer::cpu_timer) , name(_name) @@ -165,15 +149,15 @@ void Timings::set_outputdir(std::string dir) void Timings::output_per_rank(std::string csv_base) const { const auto rank = MPIHelper::getCollectiveCommunication().rank(); - boost::filesystem::path dir(output_dir_); - boost::filesystem::path filename = dir / (boost::format("%s_p%08d.csv") % csv_base % rank).str(); - boost::filesystem::ofstream out(filename); + std::filesystem::path dir(output_dir_); + std::filesystem::path filename = dir / (boost::format("%s_p%08d.csv") % csv_base % rank).str(); + std::ofstream out(filename); output_all_measures(out, MPIHelper::getLocalCommunicator()); std::stringstream tmp_out; output_all_measures(tmp_out, MPIHelper::getCommunicator()); if (rank == 0) { - boost::filesystem::path a_filename = dir / (boost::format("%s.csv") % csv_base).str(); - boost::filesystem::ofstream a_out(a_filename); + std::filesystem::path a_filename = dir / (boost::format("%s.csv") % csv_base).str(); + std::ofstream a_out(a_filename); a_out << tmp_out.str() << std::endl; } } @@ -248,6 +232,7 @@ OutputScopedTiming::~OutputScopedTiming() out_ << "Executing " << section_name_ << " took " << duration / 1000.f << "s\n"; } + } // namespace Common } // namespace XT } // namespace Dune diff --git a/dune/xt/common/timings.hh b/dune/xt/common/timings.hh index e5efc72237eb8e4f4d394eb5c9527ae8bd748ac1..43dd4e2c7bdb8009b14ced7cd0b873ab5aba9f8d 100644 --- a/dune/xt/common/timings.hh +++ b/dune/xt/common/timings.hh @@ -21,28 +21,27 @@ # define DUNE_XT_COMMON_DO_TIMING 0 #endif -#include <string> -#include <map> -#include <vector> +#include <array> +#include <atomic> #include <ctime> -#include <memory> #include <iostream> -#include <atomic> +#include <map> +#include <memory> #include <mutex> +#include <string> #include <boost/noncopyable.hpp> #include <boost/timer/timer.hpp> -#include <dune/common/unused.hh> #include <dune/common/parallel/mpihelper.hh> -#include <dune/xt/common/parallel/threadmanager.hh> #include <dune/xt/common/parallel/threadstorage.hh> namespace Dune { namespace XT { namespace Common { + class Timings; //! XT::Profiler global instance @@ -173,6 +172,7 @@ protected: std::ostream& out_; }; + } // namespace Common } // namespace XT } // namespace Dune @@ -180,7 +180,7 @@ protected: #define DXTC_TIMINGS Dune::XT::Common::timings() #if DUNE_XT_COMMON_DO_TIMING -# define DUNE_XT_COMMON_TIMING_SCOPE(section_name) Dune::XT::Common::ScopedTiming DXTC_UNUSED(timer)(section_name) +# define DUNE_XT_COMMON_TIMING_SCOPE(section_name) [[maybe_unused]] Dune::XT::Common::ScopedTiming timer(section_name) #else # define DUNE_XT_COMMON_TIMING_SCOPE(section_name) #endif diff --git a/dune/xt/common/tuple.hh b/dune/xt/common/tuple.hh index 5867b6f6d2a84bd2803b38f06e4b88bba4f93907..54f9e75830387fce6c2e5dbf5c0c67f321fe313f 100644 --- a/dune/xt/common/tuple.hh +++ b/dune/xt/common/tuple.hh @@ -13,17 +13,15 @@ #ifndef DUNE_XT_COMMON_TUPLE_HH #define DUNE_XT_COMMON_TUPLE_HH +#include <type_traits> #include <utility> -#include <dune/common/typetraits.hh> - #include <boost/mpl/if.hpp> #include <boost/mpl/deref.hpp> #include <boost/mpl/begin.hpp> #include <boost/mpl/end.hpp> #include <boost/mpl/next.hpp> #include <boost/mpl/vector.hpp> -#include <boost/type_traits.hpp> #define TMAX(t_, no_) (std::tuple_size<t_>::value >= (no_ + 1) ? no_ : 0) #define TELE(t_, s_, no_) typename std::tuple_element<TMAX(t_, no_), t_>::type::s_ @@ -160,7 +158,6 @@ namespace Common { // reduced from // http://stackoverflow.com/questions/1492204/is-it-possible-to-generate-types-with-all-combinations-of-template-arguments namespace TupleProduct { -using boost::is_same; using boost::mpl::begin; using boost::mpl::deref; using boost::mpl::end; @@ -200,8 +197,8 @@ struct Combine typedef typename next<VIterator>::type v_next; typedef - typename if_<boost::is_same<v_next, v_end>, - typename if_<boost::is_same<u_next, u_end>, end_of_recursion_tag, Generate<u_next, v_begin>>::type, + typename if_<std::is_same<v_next, v_end>, + typename if_<std::is_same<u_next, u_end>, end_of_recursion_tag, Generate<u_next, v_begin>>::type, Generate<UIterator, v_next>>::type type; }; diff --git a/dune/xt/common/type_traits.hh b/dune/xt/common/type_traits.hh index e36ee0973b5361ceb2e7e8b594461a5df77b7b20..092bc688211536c0685e02cb4808a79eb67a6ec0 100644 --- a/dune/xt/common/type_traits.hh +++ b/dune/xt/common/type_traits.hh @@ -23,7 +23,6 @@ #include <dune/common/bigunsignedint.hh> #include <dune/common/typetraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/exceptions.hh> @@ -223,10 +222,9 @@ void real_type_id(T& obj, std::string name = "", size_t maxlevel = 10000) template <typename T> struct Typename { - static std::string value(bool fail_wo_typeid = false) + static std::string value([[maybe_unused]] bool fail_wo_typeid = false) { #if defined(__GNUC__) && defined(__GXX_RTTI) - DUNE_UNUSED_PARAMETER(fail_wo_typeid); return demangle_typename(typeid(T).name()); #else if (fail_wo_typeid) diff --git a/dune/xt/common/unused.hh b/dune/xt/common/unused.hh index b4b4de634a136653d0fe794f0d7f920f225e141d..d31c39310490db8205d17c8122c3475a3b3a28b7 100644 --- a/dune/xt/common/unused.hh +++ b/dune/xt/common/unused.hh @@ -12,22 +12,16 @@ #ifndef DXTC_UNUSED_HH #define DXTC_UNUSED_HH -#ifdef HAS_WORKING_UNUSED_ATTRIBUTE -# define DXTC_UNUSED(identifier) identifier __attribute__((unused)) -#else -# define DXTC_UNUSED(identifier) /*identifier*/ -#endif - #ifndef NDEBUG -# define DXTC_DEBUG_ONLY(param) param +# define DXTC_DEBUG_ONLY #else -# define DXTC_DEBUG_ONLY(param) DXTC_UNUSED(param) +# define DXTC_DEBUG_ONLY [[maybe_unused]] #endif #if defined(HAVE_MPI) && HAVE_MPI -# define DXTC_MPI_ONLY(param) param +# define DXTC_MPI_ONLY #else -# define DXTC_MPI_ONLY(param) DXTC_UNUSED(param) +# define DXTC_MPI_ONLY [[maybe_unused]] #endif #endif // DXTC_UNUSED_HH diff --git a/dune/xt/functions/base/visualization.hh b/dune/xt/functions/base/visualization.hh index 7b4bb2358bcf45c4aee42bddcc4352e5bdf5fa44..b2dc10e8016959fdebbf32be0037dd04b097fda5 100644 --- a/dune/xt/functions/base/visualization.hh +++ b/dune/xt/functions/base/visualization.hh @@ -20,6 +20,7 @@ #include <dune/xt/common/numeric_cast.hh> #include <dune/xt/common/memory.hh> #include <dune/xt/common/parameter.hh> +#include <dune/xt/common/unused.hh> #include <dune/xt/grid/type_traits.hh> #include <dune/xt/functions/type_traits.hh> @@ -120,7 +121,7 @@ public: return 1; } - double evaluate(const int& DXTC_DEBUG_ONLY(comp), const RangeType& val) const override final + double evaluate(DXTC_DEBUG_ONLY const int& comp, const RangeType& val) const override final { assert(comp == 0); return std::accumulate(val.begin(), val.end(), 0.); diff --git a/dune/xt/functions/expression/default.hh b/dune/xt/functions/expression/default.hh index 94acad1cffe3a6d27993bdc78a5127990683f5b4..2eca621e5ed82d8636e5659fdc8493de0ac3d323 100644 --- a/dune/xt/functions/expression/default.hh +++ b/dune/xt/functions/expression/default.hh @@ -19,6 +19,7 @@ #include <dune/xt/common/configuration.hh> #include <dune/xt/common/fmatrix.hh> #include <dune/xt/common/parallel/threadstorage.hh> +#include <dune/xt/common/unused.hh> #include "base.hh" #include <dune/xt/functions/interfaces/function.hh> @@ -212,8 +213,7 @@ public: template <class V> - void check_value(const DomainType& DXTC_DEBUG_ONLY(point_in_global_coordinates), - const V& DXTC_DEBUG_ONLY(value)) const + void check_value(DXTC_DEBUG_ONLY const DomainType& point_in_global_coordinates, DXTC_DEBUG_ONLY const V& value) const { #ifndef NDEBUG # ifndef DUNE_XT_FUNCTIONS_EXPRESSION_DISABLE_CHECKS @@ -395,8 +395,7 @@ public: private: template <class V> - void check_value(const DomainType& DXTC_DEBUG_ONLY(point_in_global_coordinates), - const V& DXTC_DEBUG_ONLY(value)) const + void check_value(DXTC_DEBUG_ONLY const DomainType& point_in_global_coordinates, DXTC_DEBUG_ONLY const V& value) const { #ifndef NDEBUG # ifndef DUNE_XT_FUNCTIONS_EXPRESSION_DISABLE_CHECKS diff --git a/dune/xt/functions/interfaces/element-functions.hh b/dune/xt/functions/interfaces/element-functions.hh index 3a93d69fcd0106757d68cff28c840873d7475401..9604f97302099094d8ca8fe6efd5d0a2ea16ef79 100644 --- a/dune/xt/functions/interfaces/element-functions.hh +++ b/dune/xt/functions/interfaces/element-functions.hh @@ -425,10 +425,11 @@ private: template <class FullType, class SingleType> void single_derivative_helper_call(const std::vector<FullType>& val, const size_t row, - const size_t col, + [[maybe_unused]] const size_t col, std::vector<SingleType>& ret) const { if constexpr (rC == 1) { + assert(col == 0); for (size_t ii = 0; ii < val.size(); ++ii) ret[ii] = val[ii][row]; } else { @@ -731,9 +732,10 @@ public: private: template <class FullType> static SingleDerivativeRangeType - single_derivative_helper_call(const FullType& val, const size_t row, const size_t col) + single_derivative_helper_call(const FullType& val, const size_t row, [[maybe_unused]] const size_t col) { if constexpr (rC == 1) { + assert(col == 0); return val[row]; } else { SingleDerivativeRangeType ret; diff --git a/dune/xt/grid/information.hh b/dune/xt/grid/information.hh index d301147e86ff47f2de28e99a9cc71a3e65a976ca..353474baddbf28051af63a0726cb84bc6b6335e9 100644 --- a/dune/xt/grid/information.hh +++ b/dune/xt/grid/information.hh @@ -18,8 +18,6 @@ #include <boost/format.hpp> #include <boost/range/adaptor/reversed.hpp> -#include <dune/common/unused.hh> - #include <dune/grid/common/rangegenerators.hh> #include <dune/xt/common/math.hh> @@ -85,10 +83,8 @@ size_t max_number_of_neighbors(const GridLayerType& grid_layer) size_t maxNeighbours = 0; for (auto&& entity : elements(grid_layer)) { size_t neighbours = 0; - for (auto&& intersection : intersections(grid_layer, entity)) { - (void)intersection; // silence unused variable warning + for ([[maybe_unused]] auto&& intersection : intersections(grid_layer, entity)) ++neighbours; - } maxNeighbours = std::max(maxNeighbours, neighbours); } return maxNeighbours; diff --git a/dune/xt/grid/output/entity_visualization.hh b/dune/xt/grid/output/entity_visualization.hh index 8b5e9c19ac62ab7d68125c0397c42a78d19d7eed..bbfb178871b3e592c0b3ff101503cfb1069011af 100644 --- a/dune/xt/grid/output/entity_visualization.hh +++ b/dune/xt/grid/output/entity_visualization.hh @@ -23,7 +23,9 @@ #include <dune/xt/common/filesystem.hh> #include <dune/xt/common/logging.hh> #include <dune/xt/common/ranges.hh> +#include <dune/xt/common/string.hh> #include <dune/xt/common/type_traits.hh> + #include <dune/xt/grid/boundaryinfo/types.hh> #include <dune/xt/grid/capabilities.hh> #include <dune/xt/grid/type_traits.hh> diff --git a/dune/xt/grid/structuredgridfactory.hh b/dune/xt/grid/structuredgridfactory.hh index 6506285dbf85cadcaa36f085a439fff42617d370..161263db7fdf2117df0c081cdcf032b076bc117c 100644 --- a/dune/xt/grid/structuredgridfactory.hh +++ b/dune/xt/grid/structuredgridfactory.hh @@ -169,7 +169,7 @@ public: const Dune::FieldVector<ctype, GridType::dimension>& upperRight, const std::array<unsigned int, GridType::dimension>& elements, std::array<unsigned int, GridType::dimension> = default_overlap<GridType>(), - Dune::MPIHelper::MPICommunicator DXTC_MPI_ONLY(mpi_comm) = Dune::MPIHelper::getCommunicator()) + DXTC_MPI_ONLY Dune::MPIHelper::MPICommunicator mpi_comm = Dune::MPIHelper::getCommunicator()) { if (Dune::MPIHelper::isFake) return Dune::StructuredGridFactory<GridType>::createCubeGrid(lowerLeft, upperRight, elements); @@ -184,7 +184,7 @@ public: createSimplexGrid(const Dune::FieldVector<ctype, dim>& lowerLeft, const Dune::FieldVector<ctype, dim>& upperRight, const std::array<unsigned int, dim>& elements, - Dune::MPIHelper::MPICommunicator DXTC_MPI_ONLY(mpi_comm) = Dune::MPIHelper::getCommunicator()) + DXTC_MPI_ONLY Dune::MPIHelper::MPICommunicator mpi_comm = Dune::MPIHelper::getCommunicator()) { if (Dune::MPIHelper::isFake) return Dune::StructuredGridFactory<GridType>::createSimplexGrid(lowerLeft, upperRight, elements); @@ -210,7 +210,7 @@ public: const Dune::FieldVector<ctype, GridType::dimension>& upperRight, const std::array<unsigned int, GridType::dimension>& elements, std::array<unsigned int, GridType::dimension> overlap = default_overlap<GridType>(), - Dune::MPIHelper::MPICommunicator DXTC_MPI_ONLY(mpi_comm) = Dune::MPIHelper::getCommunicator()) + DXTC_MPI_ONLY Dune::MPIHelper::MPICommunicator mpi_comm = Dune::MPIHelper::getCommunicator()) { bool warn = false; unsigned int sum = 0; @@ -233,7 +233,7 @@ public: createSimplexGrid(const Dune::FieldVector<ctype, dim>& lowerLeft, const Dune::FieldVector<ctype, dim>& upperRight, const std::array<unsigned int, dim>& elements, - Dune::MPIHelper::MPICommunicator DXTC_MPI_ONLY(mpi_comm) = Dune::MPIHelper::getCommunicator()) + DXTC_MPI_ONLY Dune::MPIHelper::MPICommunicator mpi_comm = Dune::MPIHelper::getCommunicator()) { if (Dune::MPIHelper::isFake) return Dune::StructuredGridFactory<GridType>::createSimplexGrid(lowerLeft, upperRight, elements); @@ -261,7 +261,7 @@ public: const Dune::FieldVector<ctype, GridType::dimension>& upperRight, const std::array<unsigned int, GridType::dimension>& elements, std::array<unsigned int, GridType::dimension> = default_overlap<GridType>(), - Dune::MPIHelper::MPICommunicator DXTC_MPI_ONLY(mpi_comm) = Dune::MPIHelper::getCommunicator()) + DXTC_MPI_ONLY Dune::MPIHelper::MPICommunicator mpi_comm = Dune::MPIHelper::getCommunicator()) { if (Dune::MPIHelper::isFake) return Dune::StructuredGridFactory<GridType>::createCubeGrid(lowerLeft, upperRight, elements); diff --git a/dune/xt/grid/walker.hh b/dune/xt/grid/walker.hh index de54696d5761085d6318fe2c1d532fa96ce70b39..b79bf5b2a423441205b25c88a580570f5bbc24cb 100644 --- a/dune/xt/grid/walker.hh +++ b/dune/xt/grid/walker.hh @@ -22,7 +22,6 @@ # include <tbb/parallel_reduce.h> #endif -#include <dune/common/unused.hh> #include <dune/common/version.hh> #include <dune/grid/common/rangegenerators.hh> @@ -34,7 +33,6 @@ #include <dune/xt/common/parallel/threadmanager.hh> #include <dune/xt/common/parallel/threadstorage.hh> #include <dune/xt/common/ranges.hh> -#include <dune/xt/common/unused.hh> #include <dune/xt/common/timedlogging.hh> #include <dune/xt/grid/filters.hh> #include <dune/xt/grid/functors/interfaces.hh> @@ -582,7 +580,7 @@ public: * \} */ - void walk(const bool use_tbb = false, const bool clear_functors = true) + void walk([[maybe_unused]] const bool use_tbb = false, const bool clear_functors = true) { #if HAVE_TBB if (use_tbb) { @@ -592,8 +590,6 @@ public: this->walk(partitioning, clear_functors); return; } -#else - DUNE_UNUSED_PARAMETER(use_tbb); #endif // prepare functors prepare(); diff --git a/dune/xt/la/container/common/matrix/dense.hh b/dune/xt/la/container/common/matrix/dense.hh index 9f060bc555fea69edb4b34bf10f53bc875143465..188d8bd52d26d1e3ddc13f778e201c1c6fa8b09b 100644 --- a/dune/xt/la/container/common/matrix/dense.hh +++ b/dune/xt/la/container/common/matrix/dense.hh @@ -21,7 +21,6 @@ #include <boost/align/aligned_allocator.hpp> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/exceptions.hh> #include <dune/xt/common/float_cmp.hh> @@ -319,7 +318,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); for (auto& entry : backend_->entries_) entry *= alpha; } @@ -332,7 +331,7 @@ public: DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The shape of xx (" << xx.rows() << "x" << xx.cols() << ") does not match the shape of this (" << rows() << "x" << cols() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); if constexpr (std::is_same<ThisType, OtherMatrixType>::value) { for (size_t ii = 0; ii < backend_->entries_.size(); ++ii) backend_->entries_[ii] += alpha * xx.backend_->entries_[ii]; @@ -427,7 +426,7 @@ public: assert(ii < rows()); assert(jj < cols()); if (mutexes_->size()) { - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, rows()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, rows()); backend_->get_entry_ref(ii, jj) += value; } else { backend_->get_entry_ref(ii, jj) += value; diff --git a/dune/xt/la/container/common/matrix/sparse.hh b/dune/xt/la/container/common/matrix/sparse.hh index c9dbcb13bf1ccf117c1876708fb8b839a27dcccc..13303da43337e7fe47ffd507662381b52036b696 100644 --- a/dune/xt/la/container/common/matrix/sparse.hh +++ b/dune/xt/la/container/common/matrix/sparse.hh @@ -275,7 +275,7 @@ public: inline void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); std::transform( entries_->begin(), entries_->end(), entries_->begin(), std::bind1st(std::multiplies<ScalarType>(), alpha)); } @@ -283,7 +283,7 @@ public: inline void axpy(const ScalarType& alpha, const ThisType& xx) { assert(has_equal_shape(xx)); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); const auto& xx_entries = *xx.entries_; for (size_t ii = 0; ii < entries_->size(); ++ii) entries_->operator[](ii) += alpha * xx_entries[ii]; @@ -345,7 +345,7 @@ public: inline void add_to_entry(const size_t rr, const size_t cc, const ScalarType& value) { - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, rr, rows()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, rr, rows()); entries_->operator[](get_entry_index(rr, cc)) += value; } @@ -752,14 +752,14 @@ public: inline void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); std::transform( entries_->begin(), entries_->end(), entries_->begin(), std::bind1st(std::multiplies<ScalarType>(), alpha)); } inline void axpy(const ScalarType& alpha, const ThisType& xx) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); assert(has_equal_shape(xx)); const auto& xx_entries = *xx.entries_; for (size_t ii = 0; ii < entries_->size(); ++ii) @@ -865,7 +865,7 @@ public: inline void add_to_entry(const size_t rr, const size_t cc, const ScalarType& value) { - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, rr, rows()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, rr, rows()); entries_->operator[](get_entry_index(rr, cc)) += value; } diff --git a/dune/xt/la/container/common/vector/dense.hh b/dune/xt/la/container/common/vector/dense.hh index 729c682116e86596750bbed05689f2dfeb85c06d..cdabae468eed19728e12d42679596fba0aaa7b98 100644 --- a/dune/xt/la/container/common/vector/dense.hh +++ b/dune/xt/la/container/common/vector/dense.hh @@ -23,7 +23,6 @@ #include <dune/common/dynvector.hh> #include <dune/common/float_cmp.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/exceptions.hh> @@ -196,7 +195,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -205,7 +204,7 @@ public: if (xx.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of x (" << xx.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); for (size_t ii = 0; ii < backend().size(); ++ii) backend()[ii] += alpha * xx.backend()[ii]; } // ... axpy(...) @@ -232,7 +231,7 @@ public: void add_to_entry(const size_t ii, const ScalarType& value) { assert(ii < size()); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, size()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, size()); backend()[ii] += value; } @@ -303,7 +302,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() += other.backend(); } // ... iadd(...) @@ -313,7 +312,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() -= other.backend(); } // ... isub(...) diff --git a/dune/xt/la/container/common/vector/sparse.hh b/dune/xt/la/container/common/vector/sparse.hh index 20b598a4ab39a1bab218dfd5ddc01f3d358166ce..a7fd83abade57016e4ef0e407d2b76df097ae413 100644 --- a/dune/xt/la/container/common/vector/sparse.hh +++ b/dune/xt/la/container/common/vector/sparse.hh @@ -24,7 +24,6 @@ #include <dune/common/dynvector.hh> #include <dune/common/float_cmp.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/exceptions.hh> @@ -225,7 +224,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); auto& entries_ref = *entries_; for (size_t ii = 0; ii < entries_ref.size(); ++ii) entries_ref[ii] *= alpha; @@ -275,7 +274,7 @@ public: void add_to_entry(const size_t ii, const ScalarType& value) { - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, size()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, size()); get_unchecked_ref(ii) += value; } diff --git a/dune/xt/la/container/eigen/base.hh b/dune/xt/la/container/eigen/base.hh index bb6e703bef77e4dca53923aa142d0e4ac0b78185..cf4d92d4345dbb14c6e0aa6ec6ba9367fe2e4262 100644 --- a/dune/xt/la/container/eigen/base.hh +++ b/dune/xt/la/container/eigen/base.hh @@ -29,7 +29,6 @@ #include <dune/common/typetraits.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/crtp.hh> #include <dune/xt/common/exceptions.hh> @@ -124,7 +123,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -134,7 +133,7 @@ public: if (xx.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of xx (" << xx.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); if constexpr (XT::Common::is_vector<Vec>::value && !std::is_base_of<EigenBaseVector<typename Vec::Traits, ScalarType>, Vec>::value) { for (size_t ii = 0; ii < size(); ++ii) @@ -163,7 +162,7 @@ public: void add_to_entry(const size_t ii, const ScalarType& value) { assert(ii < size()); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, size()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, size()); backend()(ii) += value; } @@ -258,7 +257,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() += other.backend(); } // ... iadd(...) @@ -273,7 +272,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() -= other.backend(); } // ... isub(...) diff --git a/dune/xt/la/container/eigen/dense.hh b/dune/xt/la/container/eigen/dense.hh index fb79e7890d69a77efbd6ed2cffe4ea2d5f9ca5b8..eda5beec9a6419edac46e3b84409098ebc89245b 100644 --- a/dune/xt/la/container/eigen/dense.hh +++ b/dune/xt/la/container/eigen/dense.hh @@ -31,7 +31,6 @@ #include <dune/common/typetraits.hh> #include <dune/common/densematrix.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/crtp.hh> #include <dune/xt/common/exceptions.hh> @@ -533,7 +532,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -548,7 +547,7 @@ public: DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The shape of xx (" << xx.rows() << "x" << xx.cols() << ") does not match the shape of this (" << rows() << "x" << cols() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() += alpha * xx.backend(); } // ... axpy(...) @@ -609,7 +608,7 @@ public: { assert(ii < rows()); assert(jj < cols()); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, jj, cols()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, jj, cols()); backend()(ii, jj) += value; } // ... add_to_entry(...) diff --git a/dune/xt/la/container/eigen/sparse.hh b/dune/xt/la/container/eigen/sparse.hh index 2fefea014a635eb8c3c1f84842f352ede340f4d1..2d45a3afc101eefc34501e60d0185c262d9d1a2d 100644 --- a/dune/xt/la/container/eigen/sparse.hh +++ b/dune/xt/la/container/eigen/sparse.hh @@ -29,7 +29,6 @@ #include <dune/common/typetraits.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/crtp.hh> #include <dune/xt/common/exceptions.hh> @@ -248,7 +247,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -263,7 +262,7 @@ public: DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The shape of xx (" << xx.rows() << "x" << xx.cols() << ") does not match the shape of this (" << rows() << "x" << cols() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() += alpha * xx.backend(); } // ... axpy(...) @@ -329,7 +328,7 @@ public: void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) { assert(these_are_valid_indices(ii, jj)); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, rows()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, rows()); backend().coeffRef(static_cast<EIGEN_size_t>(ii), static_cast<EIGEN_size_t>(jj)) += value; } diff --git a/dune/xt/la/container/istl.hh b/dune/xt/la/container/istl.hh index 5ca7f2b622c64ddaece91829bc408babf2a9b8f4..a6bf715dc33fb2c9f84ab085cfc10765df128191 100644 --- a/dune/xt/la/container/istl.hh +++ b/dune/xt/la/container/istl.hh @@ -23,7 +23,6 @@ #include <dune/common/fvector.hh> #include <dune/common/typetraits.hh> #include <dune/common/ftraits.hh> -#include <dune/common/unused.hh> #include <dune/istl/bvector.hh> #include <dune/istl/bcrsmatrix.hh> @@ -223,7 +222,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -232,7 +231,7 @@ public: if (xx.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of x (" << xx.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend().axpy(alpha, xx.backend()); } @@ -261,7 +260,7 @@ public: void add_to_entry(const size_t ii, const ScalarType& value) { assert(ii < size()); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, size()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, size()); backend()[ii][0] += value; } @@ -331,7 +330,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() += other.backend(); } // ... iadd(...) @@ -340,7 +339,7 @@ public: if (other.size() != size()) DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The size of other (" << other.size() << ") does not match the size of this (" << size() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() -= other.backend(); } // ... isub(...) @@ -513,7 +512,7 @@ public: void scal(const ScalarType& alpha) { - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend() *= alpha; } @@ -523,7 +522,7 @@ public: DUNE_THROW(Common::Exceptions::shapes_do_not_match, "The shape of xx (" << xx.rows() << "x" << xx.cols() << ") does not match the shape of this (" << rows() << "x" << cols() << ")!"); - const internal::VectorLockGuard DUNE_UNUSED(guard)(*mutexes_); + [[maybe_unused]] const internal::VectorLockGuard guard(*mutexes_); backend().axpy(alpha, xx.backend()); } // ... axpy(...) @@ -588,7 +587,7 @@ public: void add_to_entry(const size_t ii, const size_t jj, const ScalarType& value) { assert(these_are_valid_indices(ii, jj)); - internal::LockGuard DUNE_UNUSED(lock)(*mutexes_, ii, rows()); + [[maybe_unused]] const internal::LockGuard lock(*mutexes_, ii, rows()); backend()[ii][jj][0][0] += value; } diff --git a/dune/xt/la/container/matrix-interface.hh b/dune/xt/la/container/matrix-interface.hh index 1cccb033fec0a2ccd58b4f49de62a56e25094f91..61a79329ada006b7be85c03216c9437bb7487edc 100644 --- a/dune/xt/la/container/matrix-interface.hh +++ b/dune/xt/la/container/matrix-interface.hh @@ -615,7 +615,7 @@ struct MatrixAbstractionBase private: template <class SparsityPatternType> static SparsityPatternDefault - get_actual_pattern(SparsityPatternType&& pattern, size_t DXTC_DEBUG_ONLY(rows), size_t /*cols*/) + get_actual_pattern(SparsityPatternType&& pattern, DXTC_DEBUG_ONLY const size_t rows, const size_t /*cols*/) { assert(rows == pattern.size()); return std::forward<SparsityPatternType>(pattern); diff --git a/dune/xt/la/container/vector-interface.hh b/dune/xt/la/container/vector-interface.hh index 95ffeaf877502698f50009b6fb6cac8806afa84f..fc4cf0e20fddc972e85130b0dee40e24eed1bd80 100644 --- a/dune/xt/la/container/vector-interface.hh +++ b/dune/xt/la/container/vector-interface.hh @@ -20,7 +20,6 @@ #include <complex> #include <dune/common/bigunsignedint.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/crtp.hh> #include <dune/xt/common/exceptions.hh> diff --git a/dune/xt/test/common/algorithm.cc b/dune/xt/test/common/algorithm.cc index 02f0e945da1c14e33b62a5ee5606f3054dbf8364..0a69cbe4c09b305544fdb5439b2e3f350e8ef42b 100644 --- a/dune/xt/test/common/algorithm.cc +++ b/dune/xt/test/common/algorithm.cc @@ -10,7 +10,9 @@ // Tobias Leibner (2016, 2020) #include <dune/xt/test/main.hxx> + #include <vector> + #include <dune/xt/common/algorithm.hh> using namespace Dune::XT::Common; diff --git a/dune/xt/test/common/configuration.cc b/dune/xt/test/common/configuration.cc index a6c949bbe3a46f2d33b3b1f16a51af0c34e3080a..d557bb57344fc8c947aa80beec33616d73f1b386 100644 --- a/dune/xt/test/common/configuration.cc +++ b/dune/xt/test/common/configuration.cc @@ -424,7 +424,7 @@ struct ConfigurationTest : public ::testing::Test config.report(test_out); config.report(test_out, "'prefix '"); test_out << config << std::endl; - std::string report_str DUNE_UNUSED = config.report_string(); + [[maybe_unused]] std::string report_str = config.report_string(); std::string str = config.get("string", std::string("foo")); EXPECT_EQ(str, "string"); str = config.get("foo", std::string("string")); diff --git a/dune/xt/test/common/float_cmp.cc b/dune/xt/test/common/float_cmp.cc index 30289cc7fc77a05d93601902b3b341d6329c440e..38cbd6536947b7d3927ce8b72e587f2e0ac899ca 100644 --- a/dune/xt/test/common/float_cmp.cc +++ b/dune/xt/test/common/float_cmp.cc @@ -103,9 +103,8 @@ template <class T, bool is_vector = XT::Common::is_vector<T>::value> struct suitable_entry { - static T change_an_entry(const T& input, const int value) + static T change_an_entry(const T& input, [[maybe_unused]] const int value) { - DUNE_UNUSED_PARAMETER(value); return input; } }; diff --git a/dune/xt/test/common/parallel/mpi_comm_wrapper.cc b/dune/xt/test/common/parallel/mpi_comm_wrapper.cc index 2b375cdf68d0c0330b57688e863235b417811a3f..b50814b3a5b8964b4027ff4185805a6f2b298cee 100644 --- a/dune/xt/test/common/parallel/mpi_comm_wrapper.cc +++ b/dune/xt/test/common/parallel/mpi_comm_wrapper.cc @@ -10,8 +10,6 @@ #include <dune/xt/test/main.hxx> -#include <dune/common/unused.hh> - #include <dune/xt/common/parallel/mpi_comm_wrapper.hh> using namespace Dune; diff --git a/dune/xt/test/common/random.cc b/dune/xt/test/common/random.cc index 8a23f7d8c864f84c0044d004024e6e5d07bd8827..1f3c8b8b3f8953b71545777eb40527a6c5134395 100644 --- a/dune/xt/test/common/random.cc +++ b/dune/xt/test/common/random.cc @@ -15,7 +15,6 @@ #include <dune/common/dynvector.hh> #include <dune/common/densevector.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/random.hh> #include <dune/xt/common/float_cmp.hh> @@ -49,10 +48,8 @@ GTEST_TEST(Init, Random) RNG rng_a(lower_bound, upper_bound, seed); RNG rng_b(lower_bound, upper_bound, seed); // same seed -> same values - for (auto i : value_range(1000)) { + for ([[maybe_unused]] auto i : value_range(1000)) EXPECT_EQ(rng_a(), rng_b()); - DUNE_UNUSED_PARAMETER(i); - } } DefaultRNG<std::string> str_rng(2); std::string rstr = str_rng(); diff --git a/dune/xt/test/common/timings.cc b/dune/xt/test/common/timings.cc index 5485e9965060ffe33d9352702b9343eea9704d69..9ecd09941a99c5602879d55a12f0247bca6dc0a0 100644 --- a/dune/xt/test/common/timings.cc +++ b/dune/xt/test/common/timings.cc @@ -21,7 +21,7 @@ const size_t wait_ms = 142; void scoped_busywait(const std::string& name, size_t ms) { - DUNE_UNUSED ScopedTiming scopedTiming(name); + [[maybe_unused]] ScopedTiming scopedTiming(name); busywait(ms); } @@ -45,9 +45,8 @@ GTEST_TEST(ProfilerTest, Timing) GTEST_TEST(ProfilerTest, ScopedTiming) { const auto dvalue_range = value_range(1, 4); - for (auto i DUNE_UNUSED : dvalue_range) { + for ([[maybe_unused]] auto i : dvalue_range) scoped_busywait("ProfilerTest.ScopedTiming", wait_ms); - } EXPECT_GE(DXTC_TIMINGS.walltime("ProfilerTest.ScopedTiming"), long(dvalue_range.size() * wait_ms)); } diff --git a/dune/xt/test/common/tuple.cc b/dune/xt/test/common/tuple.cc index 810ff317bc8e3c93a22e2553a13505bac275a72e..0992996a66b4b390b4dfdc9cf61c1b1461415e8a 100644 --- a/dune/xt/test/common/tuple.cc +++ b/dune/xt/test/common/tuple.cc @@ -15,7 +15,6 @@ #include <dune/common/dynmatrix.hh> #include <dune/common/tupleutility.hh> -#include <dune/common/unused.hh> #include <dune/xt/common/math.hh> #include <dune/xt/common/ranges.hh> @@ -52,7 +51,7 @@ struct print_value GTEST_TEST(TypeTransform, All) { - typedef TUPLE_TYPEDEFS_2_TUPLE(MyTuple, MyFancyType) MySubTupleType DUNE_UNUSED; + [[maybe_unused]] typedef TUPLE_TYPEDEFS_2_TUPLE(MyTuple, MyFancyType) MySubTupleType; } GTEST_TEST(Product, All) diff --git a/dune/xt/test/common/vector.tpl b/dune/xt/test/common/vector.tpl index 0b2994505933b6b2c28f76bb0ad165ebc3fe1996..10932761cd4dadc333d3389deb0cc7e55d06efef 100644 --- a/dune/xt/test/common/vector.tpl +++ b/dune/xt/test/common/vector.tpl @@ -46,9 +46,9 @@ struct VectorTest_{{T_NAME}} : public ::testing::Test EXPECT_TRUE(XT::Common::FloatCmp::eq(ones, XT::Common::FieldVector<ScalarType, dim>(1))); // test data - DUNE_UNUSED ScalarType* data_ptr = XT::Common::data(vec); + [[maybe_unused]] ScalarType* data_ptr = XT::Common::data(vec); const VectorImp const_vec = vec; - DUNE_UNUSED const ScalarType* const_data_ptr = XT::Common::data(const_vec); + [[maybe_unused]] const ScalarType* const_data_ptr = XT::Common::data(const_vec); } // void test_free_functions() const }; // struct VectorTest diff --git a/dune/xt/test/functions/difference.tpl b/dune/xt/test/functions/difference.tpl index dc7a165a9506b6b613bba22325ac4bcea086a963..41815700779b7048733af9534bf75e609d340421 100644 --- a/dune/xt/test/functions/difference.tpl +++ b/dune/xt/test/functions/difference.tpl @@ -92,7 +92,7 @@ TEST_F(DifferenceFunction_from_{{GRIDNAME}}_to_{{r}}_times_{{rC}}, operator_work IndicatorFunctionType f({{'{{domains_1, first_value}}'}}); IndicatorFunctionType g({{'{{domains_2, second_value}}'}}); - const auto& difference DUNE_UNUSED = f - g; + [[maybe_unused]] const auto& difference = f - g; } diff --git a/dune/xt/test/functions/grid_function.cc b/dune/xt/test/functions/grid_function.cc index 839f8df3e9d70de1883660e911b72b8ae48211ba..e14cb5145093e03a038e262b1f575741824ce2f3 100644 --- a/dune/xt/test/functions/grid_function.cc +++ b/dune/xt/test/functions/grid_function.cc @@ -11,7 +11,6 @@ #include <dune/xt/test/main.hxx> // <- Has to come first, includes the config.h! -#include <dune/xt/common/unused.hh> #include <dune/xt/grid/type_traits.hh> #include <dune/xt/grid/grids.hh> #include <dune/xt/grid/gridprovider/cube.hh> @@ -56,7 +55,7 @@ std::string accepts_matrix_grid_function(GridFunction<E, r, rC> func) GTEST_TEST(ScalarGridFunction, constructible_from_double) { - GridFunction<E> DXTC_UNUSED(func){1.}; + [[maybe_unused]] GridFunction<E> func{1.}; } GTEST_TEST(ScalarGridFunction, convertible_from_double) { @@ -64,7 +63,7 @@ GTEST_TEST(ScalarGridFunction, convertible_from_double) } GTEST_TEST(ScalarGridFunction, constructible_from_FieldVector) { - GridFunction<E> DXTC_UNUSED(func){FieldVector<double, 1>()}; + [[maybe_unused]] GridFunction<E> func{FieldVector<double, 1>()}; } GTEST_TEST(ScalarGridFunction, convertible_from_FieldVector) { @@ -72,7 +71,7 @@ GTEST_TEST(ScalarGridFunction, convertible_from_FieldVector) } GTEST_TEST(ScalarGridFunction, constructible_from_XT_Common_FieldVector) { - GridFunction<E> DXTC_UNUSED(func){XT::Common::FieldVector<double, 1>()}; + [[maybe_unused]] GridFunction<E> func{XT::Common::FieldVector<double, 1>()}; } GTEST_TEST(ScalarGridFunction, convertible_from_XT_Common_FieldVector) { @@ -127,7 +126,7 @@ GTEST_TEST(ScalarGridFunction, convertible_from_grid_function_lvalueptr) GTEST_TEST(VectorGridFunction, constructible_from_FieldVector) { - GridFunction<E, r> DXTC_UNUSED(func){FieldVector<double, r>()}; + [[maybe_unused]] GridFunction<E, r> func{FieldVector<double, r>()}; } GTEST_TEST(VectorGridFunction, convertible_from_FieldVector) { @@ -135,7 +134,7 @@ GTEST_TEST(VectorGridFunction, convertible_from_FieldVector) } GTEST_TEST(VectorGridFunction, constructible_from_XT_Common_FieldVector) { - GridFunction<E, r> DXTC_UNUSED(func){XT::Common::FieldVector<double, r>()}; + [[maybe_unused]] GridFunction<E, r> func{XT::Common::FieldVector<double, r>()}; } GTEST_TEST(VectorGridFunction, convertible_from_XT_Common_FieldVector) { @@ -191,7 +190,7 @@ GTEST_TEST(VectorGridFunction, convertible_from_grid_function_lvalueptr) GTEST_TEST(SquareMatrixGridFunction, constructible_from_double) { - GridFunction<E, r, r> DXTC_UNUSED(func){1.}; + [[maybe_unused]] GridFunction<E, r, r> func{1.}; } GTEST_TEST(SquareMatrixGridFunction, convertible_from_double) { @@ -199,7 +198,7 @@ GTEST_TEST(SquareMatrixGridFunction, convertible_from_double) } GTEST_TEST(SquareMatrixGridFunction, constructible_from_FieldMatrix) { - GridFunction<E, r, r> DXTC_UNUSED(func){FieldMatrix<double, r, r>()}; + [[maybe_unused]] GridFunction<E, r, r> func{FieldMatrix<double, r, r>()}; } GTEST_TEST(SquareMatrixGridFunction, convertible_from_FieldMatrix) { @@ -207,7 +206,7 @@ GTEST_TEST(SquareMatrixGridFunction, convertible_from_FieldMatrix) } GTEST_TEST(SquareMatrixGridFunction, constructible_from_XT_Common_FieldMatrix) { - GridFunction<E, r, r> DXTC_UNUSED(func){XT::Common::FieldMatrix<double, r, r>()}; + [[maybe_unused]] GridFunction<E, r, r> func{XT::Common::FieldMatrix<double, r, r>()}; } GTEST_TEST(SquareMatrixGridFunction, convertible_from_XT_Common_FieldMatrix) { @@ -263,7 +262,7 @@ GTEST_TEST(SquareMatrixGridFunction, convertible_from_grid_function_lvalueptr) GTEST_TEST(MatrixGridFunction, constructible_from_FieldMatrix) { - GridFunction<E, r, rC> DXTC_UNUSED(func){FieldMatrix<double, r, rC>()}; + [[maybe_unused]] GridFunction<E, r, rC> func{FieldMatrix<double, r, rC>()}; } GTEST_TEST(MatrixGridFunction, convertible_from_FieldMatrix) { @@ -271,7 +270,7 @@ GTEST_TEST(MatrixGridFunction, convertible_from_FieldMatrix) } GTEST_TEST(MatrixGridFunction, constructible_from_XT_Common_FieldMatrix) { - GridFunction<E, r, rC> DXTC_UNUSED(func){XT::Common::FieldMatrix<double, r, rC>()}; + [[maybe_unused]] GridFunction<E, r, rC> func{XT::Common::FieldMatrix<double, r, rC>()}; } GTEST_TEST(MatrixGridFunction, convertible_from_XT_Common_FieldMatrix) { diff --git a/dune/xt/test/functions/product.tpl b/dune/xt/test/functions/product.tpl index ebf4aa671a8deef5dd5fcaa75442b693f9ea7f15..0b889008805cb2f602277879c3a8445c60c1e3c2 100644 --- a/dune/xt/test/functions/product.tpl +++ b/dune/xt/test/functions/product.tpl @@ -96,7 +96,7 @@ TEST_F(ProductFunction_from_{{GRIDNAME}}_to_{{r}}_times_{{rC}}, operator_works) ScalarIndicatorFunctionType f({{'{{domains_1, first_value}}'}}); IndicatorFunctionType g({{'{{domains_2, second_value}}'}}); - const auto& product DUNE_UNUSED = f * g; + [[maybe_unused]] const auto& product = f * g; } diff --git a/dune/xt/test/functions/spe10_model2.tpl b/dune/xt/test/functions/spe10_model2.tpl index 021d417ee6a3f7362c4e1fd26757b0e44e7240f5..ef4d95c91166854f010aaace3800ba31850e0ed2 100644 --- a/dune/xt/test/functions/spe10_model2.tpl +++ b/dune/xt/test/functions/spe10_model2.tpl @@ -155,7 +155,7 @@ TEST_F(Spe10Model2Function_from_{{GRIDNAME}}_to_{{r}}_times_{{rC}}, local_evalua local_f->bind(element); for (const auto& quadrature_point : Dune::QuadratureRules<double, d>::rule(element.type(), 3)) { const auto local_x = quadrature_point.position(); - const auto actual_value DUNE_UNUSED = local_f->evaluate(local_x); + [[maybe_unused]] const auto actual_value = local_f->evaluate(local_x); } } #else diff --git a/dune/xt/test/functions/sum_for_grid_functions.tpl b/dune/xt/test/functions/sum_for_grid_functions.tpl index af86e9b76d9fd53209b081dc3fe751563b5cd47b..76eacbad428f89f442569803379d1d72d5117408 100644 --- a/dune/xt/test/functions/sum_for_grid_functions.tpl +++ b/dune/xt/test/functions/sum_for_grid_functions.tpl @@ -90,7 +90,7 @@ TEST_F(SumFunction_from_{{GRIDNAME}}_to_{{r}}_times_{{rC}}, operator_works) IndicatorFunctionType f({{'{{domains_1, first_value}}'}}); IndicatorFunctionType g({{'{{domains_2, second_value}}'}}); - const auto& sum DUNE_UNUSED = f + g; + [[maybe_unused]] const auto& sum = f + g; } diff --git a/dune/xt/test/grid/boundaryinfo_factory.cc b/dune/xt/test/grid/boundaryinfo_factory.cc index 71ad539775520bf6c27d96a69b2f0c1e0d9e510c..802fc2579b4b115778606b8f4d96972ea427390a 100644 --- a/dune/xt/test/grid/boundaryinfo_factory.cc +++ b/dune/xt/test/grid/boundaryinfo_factory.cc @@ -17,8 +17,6 @@ #include <dune/xt/test/main.hxx> -#include <dune/common/unused.hh> - #include <dune/xt/grid/grids.hh> #include <dune/xt/grid/boundaryinfo.hh> @@ -29,8 +27,8 @@ GTEST_TEST(BoundaryInfoFactory, all) for (auto type : Factory::available()) { auto opts = Factory::default_config(type); - auto aa DUNE_UNUSED = Factory::create(); - auto bb DUNE_UNUSED = Factory::create(type); - auto cc DUNE_UNUSED = Factory::create(opts); + [[maybe_unused]] auto aa = Factory::create(); + [[maybe_unused]] auto bb = Factory::create(type); + [[maybe_unused]] auto cc = Factory::create(opts); } } diff --git a/dune/xt/test/grid/eoc_gridprovider.tpl b/dune/xt/test/grid/eoc_gridprovider.tpl index e2e94e914166ccb0c5647f512169b6e883af4a2d..b0b0bb776fb471fb34a81d1dbe1609388b1f82ff 100644 --- a/dune/xt/test/grid/eoc_gridprovider.tpl +++ b/dune/xt/test/grid/eoc_gridprovider.tpl @@ -19,8 +19,8 @@ GTEST_TEST(EocProvider_{{name}}, layers) { - using Level DUNE_UNUSED = Dune::XT::Grid::LevelBasedEOCGridProvider<{{type}}>; - using Leaf DUNE_UNUSED = Dune::XT::Grid::LeafBasedEOCGridProvider<{{type}}>; + using Level [[maybe_unused]] = Dune::XT::Grid::LevelBasedEOCGridProvider<{{type}}>; + using Leaf [[maybe_unused]] = Dune::XT::Grid::LeafBasedEOCGridProvider<{{type}}>; } {% endfor %} diff --git a/dune/xt/test/grid/output.tpl b/dune/xt/test/grid/output.tpl index 5aa8ba7d7dd66ff4e6623502378b9b665826f783..5945674428692dd66dcafa199c80eea31723964b 100644 --- a/dune/xt/test/grid/output.tpl +++ b/dune/xt/test/grid/output.tpl @@ -27,7 +27,7 @@ GTEST_TEST(GridProvider_{{name}}, layers) auto global_provider = ProviderFactory::create(config, Dune::MPIHelper::getCommunicator()); auto& global_grid = global_provider.grid(); - Dune::XT::Grid::ElementVisualization::all(global_grid, boost::filesystem::temp_directory_path().string()); + Dune::XT::Grid::ElementVisualization::all(global_grid, std::filesystem::temp_directory_path().string()); } diff --git a/dune/xt/test/grid/periodic_gridview.cc b/dune/xt/test/grid/periodic_gridview.cc index b3ecfa33701cbd70091b3f055720ff2e4d28a56a..8ec0502efc80d6fe53cdc2c2ebb2aa4ab2e0b302 100644 --- a/dune/xt/test/grid/periodic_gridview.cc +++ b/dune/xt/test/grid/periodic_gridview.cc @@ -80,8 +80,7 @@ struct PeriodicViewTest : public testing::Test const PeriodicGridViewType periodic_grid_view(grid_view, periodic_directions); // check interface - const GridType& test_grid = periodic_grid_view.grid(); - (void)test_grid; + [[maybe_unused]] const GridType& test_grid = periodic_grid_view.grid(); const IndexSet& index_set = periodic_grid_view.indexSet(); const int codim0_size = periodic_grid_view.size(0); EXPECT_EQ(grid_view.size(0), codim0_size); @@ -95,8 +94,7 @@ struct PeriodicViewTest : public testing::Test EXPECT_EQ(grid_view.overlapSize(1), periodic_grid_view.overlapSize(1)); EXPECT_EQ(grid_view.ghostSize(0), periodic_grid_view.ghostSize(0)); EXPECT_EQ(grid_view.ghostSize(1), periodic_grid_view.ghostSize(1)); - const CollectiveCommunication& test_comm = periodic_grid_view.comm(); - (void)test_comm; + [[maybe_unused]] const CollectiveCommunication& test_comm = periodic_grid_view.comm(); size_t neighbor_count = 0; @@ -106,8 +104,7 @@ struct PeriodicViewTest : public testing::Test for (auto&& element : elements(periodic_grid_view)) { EXPECT_TRUE(periodic_grid_view.contains(element)); EXPECT_TRUE(index_set.contains(element)); - const auto sub_index = index_set.subIndex(element, 0, 1); - (void)sub_index; + [[maybe_unused]] const auto sub_index = index_set.subIndex(element, 0, 1); // iterate over all intersections on current element for (auto&& intersection : intersections(periodic_grid_view, element)) { if (intersection.neighbor()) { @@ -214,8 +211,8 @@ struct PeriodicViewTest : public testing::Test size_t codim_iterator_size = 0; const auto codim_it_end = periodic_grid_view.template end<dimDomain>(); for (auto codim_it = periodic_grid_view.template begin<dimDomain>(); codim_it != codim_it_end; ++codim_it) { - const auto codim_it_copy DUNE_UNUSED = codim_it; - const auto& entity DUNE_UNUSED = *codim_it; + [[maybe_unused]] const auto codim_it_copy = codim_it; + [[maybe_unused]] const auto& entity = *codim_it; ++codim_iterator_size; } EXPECT_EQ(num_vertices, codim_iterator_size); diff --git a/dune/xt/test/grid/provider.hh b/dune/xt/test/grid/provider.hh index 8c7f06b7825ecfa4db5cb1108ecb8689c6b9811d..629d623f3516016e674ad97255428be8c37d706a 100644 --- a/dune/xt/test/grid/provider.hh +++ b/dune/xt/test/grid/provider.hh @@ -28,12 +28,12 @@ struct GridProviderBase : public testing::Test static void check_layers(const GridProviderType& grid_provider) { using namespace Dune::XT::Grid; - const std::shared_ptr<GridType>& grid_ptr DUNE_UNUSED = grid_provider.grid_ptr(); - auto leaf_grid_view_1 DUNE_UNUSED = grid_provider.leaf_view(); - auto leaf_grid_view_2 DUNE_UNUSED = grid_provider.template layer<Layers::leaf, Backends::view>(); + [[maybe_unused]] const std::shared_ptr<GridType>& grid_ptr = grid_provider.grid_ptr(); + [[maybe_unused]] auto leaf_grid_view_1 = grid_provider.leaf_view(); + [[maybe_unused]] auto leaf_grid_view_2 = grid_provider.template layer<Layers::leaf, Backends::view>(); for (int level = 0; level <= grid_provider.max_level(); ++level) { - auto level_grid_view_1 DUNE_UNUSED = grid_provider.level_view(level); - auto level_grid_view_2 DUNE_UNUSED = grid_provider.template layer<Layers::leaf, Backends::view>(level); + [[maybe_unused]] auto level_grid_view_1 = grid_provider.level_view(level); + [[maybe_unused]] auto level_grid_view_2 = grid_provider.template layer<Layers::leaf, Backends::view>(level); } } // ... check_layers() diff --git a/dune/xt/test/gtest/gtest.h b/dune/xt/test/gtest/gtest.h index 1db61f6bae76b7ff51a8aa5377d94bcd22ad4fb8..1a04a383a2ca2c21d25f676ebefcb98d76defaea 100644 --- a/dune/xt/test/gtest/gtest.h +++ b/dune/xt/test/gtest/gtest.h @@ -19620,8 +19620,8 @@ struct IsRecursiveContainerImpl<C, true> // evaluates whether C is a recursive container type. A recursive container // type is a container type whose value_type is equal to the container type // itself. An example for a recursive container type is -// boost::filesystem::path, whose iterator has a value_type that is equal to -// boost::filesystem::path. +// std::filesystem::path, whose iterator has a value_type that is equal to +// std::filesystem::path. template <typename C> struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {}; diff --git a/dune/xt/test/la/container.tpl b/dune/xt/test/la/container.tpl index 9e9a5c4191620200a11fdaa2f4463e04f81af323..b379a1fd50f6559479be0f95757beed113751115 100644 --- a/dune/xt/test/la/container.tpl +++ b/dune/xt/test/la/container.tpl @@ -43,10 +43,10 @@ struct ContainerTest{{NAME}} : public ::testing::Test // dynamic tests // * of the container as itself (aka the derived type) - ContainerImp d_empty DUNE_UNUSED; + [[maybe_unused]] ContainerImp d_empty; ContainerImp d_by_size = ContainerFactory<ContainerImp>::create(dim); ContainerImp d_copy_constructor(d_by_size); - ContainerImp d_copy_assignment DUNE_UNUSED = d_by_size; + [[maybe_unused]] ContainerImp d_copy_assignment = d_by_size; ContainerImp d_deep_copy = d_by_size.copy(); d_by_size.scal(D_ScalarType(1)); d_by_size.axpy(D_ScalarType(1), d_deep_copy); diff --git a/dune/xt/test/la/eigensolver.hh b/dune/xt/test/la/eigensolver.hh index 1f75675dceb9d062ea8352b9f37333278e4ef899..28a7706e82b650b1e8e40854783be6679425673f 100644 --- a/dune/xt/test/la/eigensolver.hh +++ b/dune/xt/test/la/eigensolver.hh @@ -14,7 +14,6 @@ #define DUNE_XT_LA_TEST_EIGENSOLVER_HH #include <dune/xt/common/exceptions.hh> -#include <dune/xt/common/unused.hh> #include <dune/xt/common/logging.hh> #include <dune/xt/test/gtest/gtest.h> @@ -85,7 +84,7 @@ struct EigenSolverTest : public ::testing::Test void throws_on_broken_matrix_construction() const { try { - EigenSolverType DXTC_UNUSED(default_solver){broken_matrix_}; + [[maybe_unused]] EigenSolverType default_solver{broken_matrix_}; FAIL() << "Expected LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { @@ -93,14 +92,14 @@ struct EigenSolverTest : public ::testing::Test } for (const auto& tp : EigenSolverOpts::types()) { try { - EigenSolverType DXTC_UNUSED(default_opts_solver)(broken_matrix_, tp); + [[maybe_unused]] EigenSolverType default_opts_solver(broken_matrix_, tp); FAIL() << "Expected LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { FAIL() << "Expected LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } try { - EigenSolverType DXTC_UNUSED(solver)(broken_matrix_, EigenSolverOpts::options(tp)); + [[maybe_unused]] EigenSolverType solver(broken_matrix_, EigenSolverOpts::options(tp)); FAIL() << "Expected LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { @@ -114,7 +113,7 @@ struct EigenSolverTest : public ::testing::Test for (const auto& tp : EigenSolverOpts::types()) { Common::Configuration opts_with_disabled_check = EigenSolverOpts::options(tp); opts_with_disabled_check["check_for_inf_nan"] = "false"; - EigenSolverType DXTC_UNUSED(solver)(broken_matrix_, opts_with_disabled_check); + [[maybe_unused]] EigenSolverType solver(broken_matrix_, opts_with_disabled_check); } } @@ -125,7 +124,7 @@ struct EigenSolverTest : public ::testing::Test inconsistent_opts["assert_positive_eigenvalues"] = "1e-15"; inconsistent_opts["assert_negative_eigenvalues"] = "1e-15"; try { - EigenSolverType DXTC_UNUSED(solver)(unit_matrix_, inconsistent_opts); + [[maybe_unused]] EigenSolverType solver(unit_matrix_, inconsistent_opts); FAIL() << "Expected LA::Exceptions::eigen_solver_failed_bc_it_was_not_set_up_correctly"; } catch (const LA::Exceptions::eigen_solver_failed_bc_it_was_not_set_up_correctly& /*ee*/) { } catch (...) { @@ -137,10 +136,10 @@ struct EigenSolverTest : public ::testing::Test void is_constructible() const { ASSERT_TRUE(all_matrices_and_expected_eigenvalues_and_vectors_are_computed_); - EigenSolverType DXTC_UNUSED(default_solver){matrix_}; + [[maybe_unused]] EigenSolverType default_solver{matrix_}; for (const auto& tp : EigenSolverOpts::types()) { - EigenSolverType DXTC_UNUSED(default_opts_solver)(matrix_, tp); - EigenSolverType DXTC_UNUSED(solver)(matrix_, EigenSolverOpts::options(tp)); + [[maybe_unused]] EigenSolverType default_opts_solver(matrix_, tp); + [[maybe_unused]] EigenSolverType solver(matrix_, EigenSolverOpts::options(tp)); } } // ... is_constructible(...) diff --git a/dune/xt/test/la/generalized-eigensolver.hh b/dune/xt/test/la/generalized-eigensolver.hh index 8044d2dab3629ac71ac666c4d993cf189b33ae3f..c803e600c46da5a48655b7acb16ba4156a9db23a 100644 --- a/dune/xt/test/la/generalized-eigensolver.hh +++ b/dune/xt/test/la/generalized-eigensolver.hh @@ -14,7 +14,6 @@ #define DUNE_XT_LA_TEST_GENERALIZED_EIGENSOLVER_HH #include <dune/xt/common/exceptions.hh> -#include <dune/xt/common/unused.hh> #include <dune/xt/common/logging.hh> #include <dune/xt/test/gtest/gtest.h> @@ -90,7 +89,7 @@ struct GeneralizedEigenSolverTest : public ::testing::Test void throws_on_broken_matrix_construction() { try { - GeneralizedEigenSolverType DXTC_UNUSED(default_solver){broken_matrix_, unit_matrix_}; + [[maybe_unused]] GeneralizedEigenSolverType default_solver{broken_matrix_, unit_matrix_}; FAIL() << "Expected LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { @@ -98,14 +97,14 @@ struct GeneralizedEigenSolverTest : public ::testing::Test } for (const auto& tp : GeneralizedEigenSolverOpts::types()) { try { - GeneralizedEigenSolverType DXTC_UNUSED(default_opts_solver)(broken_matrix_, unit_matrix_, tp); + [[maybe_unused]] GeneralizedEigenSolverType default_opts_solver(broken_matrix_, unit_matrix_, tp); FAIL() << "Expected LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { FAIL() << "Expected LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } try { - GeneralizedEigenSolverType DXTC_UNUSED(solver)( + [[maybe_unused]] GeneralizedEigenSolverType solver( broken_matrix_, unit_matrix_, GeneralizedEigenSolverOpts::options(tp)); FAIL() << "Expected LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::generalized_eigen_solver_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { @@ -120,7 +119,7 @@ struct GeneralizedEigenSolverTest : public ::testing::Test for (const auto& tp : GeneralizedEigenSolverOpts::types()) { Common::Configuration opts_with_disabled_check = GeneralizedEigenSolverOpts::options(tp); opts_with_disabled_check["check_for_inf_nan"] = "false"; - GeneralizedEigenSolverType DXTC_UNUSED(solver)(broken_matrix_, unit_matrix_, opts_with_disabled_check); + [[maybe_unused]] GeneralizedEigenSolverType solver(broken_matrix_, unit_matrix_, opts_with_disabled_check); } } @@ -131,7 +130,7 @@ struct GeneralizedEigenSolverTest : public ::testing::Test inconsistent_opts["assert_positive_eigenvalues"] = "1e-15"; inconsistent_opts["assert_negative_eigenvalues"] = "1e-15"; try { - GeneralizedEigenSolverType DXTC_UNUSED(solver)(unit_matrix_, unit_matrix_, inconsistent_opts); + [[maybe_unused]] GeneralizedEigenSolverType solver(unit_matrix_, unit_matrix_, inconsistent_opts); FAIL() << "Expected LA::Exceptions::generalized_eigen_solver_failed_bc_it_was_not_set_up_correctly"; } catch (const LA::Exceptions::generalized_eigen_solver_failed_bc_it_was_not_set_up_correctly& /*ee*/) { } catch (...) { @@ -144,10 +143,11 @@ struct GeneralizedEigenSolverTest : public ::testing::Test { ASSERT_TRUE(all_matrices_and_expected_eigenvalues_and_vectors_are_computed_); this->make_unit_matrix(); - GeneralizedEigenSolverType DXTC_UNUSED(default_solver){matrix_, unit_matrix_}; + [[maybe_unused]] GeneralizedEigenSolverType default_solver{matrix_, unit_matrix_}; for (const auto& tp : GeneralizedEigenSolverOpts::types()) { - GeneralizedEigenSolverType DXTC_UNUSED(default_opts_solver)(matrix_, unit_matrix_, tp); - GeneralizedEigenSolverType DXTC_UNUSED(solver)(matrix_, unit_matrix_, GeneralizedEigenSolverOpts::options(tp)); + [[maybe_unused]] GeneralizedEigenSolverType default_opts_solver(matrix_, unit_matrix_, tp); + [[maybe_unused]] GeneralizedEigenSolverType solver( + matrix_, unit_matrix_, GeneralizedEigenSolverOpts::options(tp)); } } // ... is_constructible(...) diff --git a/dune/xt/test/la/matrixinverter.hh b/dune/xt/test/la/matrixinverter.hh index 69ff3a682f39ed237ef34ab6ec5e2e854cc29579..91c2948c2896f35c73e616ae07f822d073b1165c 100644 --- a/dune/xt/test/la/matrixinverter.hh +++ b/dune/xt/test/la/matrixinverter.hh @@ -14,7 +14,6 @@ #include <dune/xt/common/exceptions.hh> #include <dune/xt/common/logging.hh> #include <dune/xt/test/gtest/gtest.h> -#include <dune/xt/common/unused.hh> #include <dune/xt/la/container/conversion.hh> #include <dune/xt/la/container/eye-matrix.hh> @@ -67,7 +66,7 @@ struct MatrixInverterTest : public ::testing::Test void throws_on_broken_matrix_construction() const { try { - MatrixInverterType DXTC_UNUSED(default_inverter)(broken_matrix_); + [[maybe_unused]] MatrixInverterType default_inverter(broken_matrix_); FAIL() << "Expected LA::Exceptions::eigen_inverter_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::matrix_invert_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { @@ -75,14 +74,14 @@ struct MatrixInverterTest : public ::testing::Test } for (const auto& tp : MatrixInverterOpts::types()) { try { - MatrixInverterType DXTC_UNUSED(default_opts_inverter)(broken_matrix_, tp); + [[maybe_unused]] MatrixInverterType default_opts_inverter(broken_matrix_, tp); FAIL() << "Expected LA::Exceptions::eigen_inverter_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::matrix_invert_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { FAIL() << "Expected LA::Exceptions::eigen_inverter_failed_bc_data_did_not_fulfill_requirements"; } try { - MatrixInverterType DXTC_UNUSED(inverter)(broken_matrix_, MatrixInverterOpts::options(tp)); + [[maybe_unused]] MatrixInverterType inverter(broken_matrix_, MatrixInverterOpts::options(tp)); FAIL() << "Expected LA::Exceptions::eigen_inverter_failed_bc_data_did_not_fulfill_requirements"; } catch (const LA::Exceptions::matrix_invert_failed_bc_data_did_not_fulfill_requirements& /*ee*/) { } catch (...) { @@ -94,10 +93,10 @@ struct MatrixInverterTest : public ::testing::Test void is_constructible() const { ASSERT_TRUE(all_matrices_and_inverse_matrices_are_computed_); - MatrixInverterType DXTC_UNUSED(default_inverter)(matrix_); + [[maybe_unused]] MatrixInverterType default_inverter(matrix_); for (const auto& tp : MatrixInverterOpts::types()) { - MatrixInverterType DXTC_UNUSED(default_opts_inverter)(matrix_, tp); - MatrixInverterType DXTC_UNUSED(inverter)(matrix_, MatrixInverterOpts::options(tp)); + [[maybe_unused]] MatrixInverterType default_opts_inverter(matrix_, tp); + [[maybe_unused]] MatrixInverterType inverter(matrix_, MatrixInverterOpts::options(tp)); } } // ... is_constructible(...) diff --git a/python/dune/xt/common/timedlogging.hh b/python/dune/xt/common/timedlogging.hh index de9b222826665496de646102cfcc4a783a0fcef1..4f1eadf1f3779ad780d08e27440045f7064951c6 100644 --- a/python/dune/xt/common/timedlogging.hh +++ b/python/dune/xt/common/timedlogging.hh @@ -12,6 +12,7 @@ #include <dune/pybindxi/pybind11.h> +#include <dune/xt/common/string.hh> #include <dune/xt/common/timedlogging.hh> namespace Dune {