From 3c0dc0056cc848686fb9130d8b3e1f803ceb7f3a Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 7 Dec 2022 16:30:20 -0500 Subject: [PATCH] Address Wundefined-var-template --- cmake/setup_compiler_flags_gnu.cmake | 6 ------ include/deal.II/fe/mapping_q1.h | 3 +++ include/deal.II/hp/mapping_collection.h | 8 +++++++ source/fe/mapping_q1.cc | 9 -------- source/hp/mapping_collection.cc | 28 ------------------------- 5 files changed, 11 insertions(+), 43 deletions(-) diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index 08e141fa1e..9c73ffdc9e 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -126,12 +126,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unsupported-friend") - # - # Disable a diagnostic that warns about potentially uninstantiated static - # members. This leads to a ton of false positives. - # - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-undefined-var-template") - # # Clang versions prior to 3.6 emit a lot of false positives wrt # "-Wunused-function". Also suppress warnings for Xcode older than 6.3 diff --git a/include/deal.II/fe/mapping_q1.h b/include/deal.II/fe/mapping_q1.h index b9b86451b0..4d75d7404e 100644 --- a/include/deal.II/fe/mapping_q1.h +++ b/include/deal.II/fe/mapping_q1.h @@ -101,6 +101,9 @@ struct StaticMappingQ1 /** @} */ +template +MappingQ StaticMappingQ1::mapping = + MappingQ1{}; DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/hp/mapping_collection.h b/include/deal.II/hp/mapping_collection.h index b562df4405..650a54d296 100644 --- a/include/deal.II/hp/mapping_collection.h +++ b/include/deal.II/hp/mapping_collection.h @@ -22,6 +22,7 @@ #include #include +#include #include @@ -172,6 +173,13 @@ namespace hp push_back(*p); } + + + template + MappingCollection + StaticMappingQ1::mapping_collection = + MappingCollection(MappingQ1{}); + } // namespace hp diff --git a/source/fe/mapping_q1.cc b/source/fe/mapping_q1.cc index 1f8aec3bdf..4dfa0c185b 100644 --- a/source/fe/mapping_q1.cc +++ b/source/fe/mapping_q1.cc @@ -35,15 +35,6 @@ MappingQ1::clone() const return std::make_unique>(*this); } -//--------------------------------------------------------------------------- - - -template -MappingQ - StaticMappingQ1::mapping = MappingQ(1); - - - //--------------------------- Explicit instantiations ----------------------- #include "mapping_q1.inst" diff --git a/source/hp/mapping_collection.cc b/source/hp/mapping_collection.cc index 2d4c5b5de9..2809aa903d 100644 --- a/source/hp/mapping_collection.cc +++ b/source/hp/mapping_collection.cc @@ -53,34 +53,6 @@ namespace hp std::shared_ptr>(new_mapping.clone())); } - //--------------------------------------------------------------------------- - - - namespace - { - /** - * Create and return a reference to a static MappingQ1 object. We can't - * use the one in ::StaticMappingQ1 to initialize the static object below - * since we can't make sure that the constructor for that object is run - * before we want to use the object (when constructing mapping_collection - * below). Therefore we create a helper function which returns a - * reference to a static object that will be constructed the first time - * this function is called. - */ - template - MappingQ & - get_static_mapping_q1() - { - static MappingQ1 mapping; - return mapping; - } - } // namespace - - template - MappingCollection - StaticMappingQ1::mapping_collection = - MappingCollection(get_static_mapping_q1()); - } // namespace hp -- 2.39.5