From: Daniel Arndt Date: Wed, 7 Dec 2022 21:30:20 +0000 (-0500) Subject: Address Wundefined-var-template X-Git-Tag: v9.5.0-rc1~749^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c0dc0056cc848686fb9130d8b3e1f803ceb7f3a;p=dealii.git Address Wundefined-var-template --- 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