From ba40259a811af314bf8d81b796173c9f330082f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Sat, 22 Mar 2014 09:48:26 +0100
Subject: [PATCH] [cleanup] Remove check and fallback code for initializer
 list.

---
 cmake/modules/CheckCXX11Features.cmake | 23 ----------------
 config.h.cmake                         |  3 ---
 dune/common/fvector.hh                 | 12 ---------
 m4/CMakeLists.txt                      |  1 -
 m4/Makefile.am                         |  1 -
 m4/cxx11_initializer_list.m4           | 37 --------------------------
 m4/dune_common.m4                      |  1 -
 7 files changed, 78 deletions(-)
 delete mode 100644 m4/cxx11_initializer_list.m4

diff --git a/cmake/modules/CheckCXX11Features.cmake b/cmake/modules/CheckCXX11Features.cmake
index 35dbf6b5d..23b7833d4 100644
--- a/cmake/modules/CheckCXX11Features.cmake
+++ b/cmake/modules/CheckCXX11Features.cmake
@@ -14,7 +14,6 @@
 # HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
 # HAVE_RVALUE_REFERENCES           True if rvalue references are supported
 # HAVE_STD_CONDITIONAL             True if std::conditional is supported
-# HAVE_INITIALIZER_LIST            True if initializer list is supported
 # HAVE_CONSTEXPR                   True if constexpr is supported
 # HAVE_KEYWORD_FINAL               True if final is supported.
 
@@ -293,28 +292,6 @@ check_cxx_source_compiles("
 " HAVE_STD_CONDITIONAL
 )
 
-# initializer list
-check_cxx_source_compiles("
-  #include <initializer_list>
-  #include <vector>
-
-  struct A
-  {
-    A(std::initializer_list<int> il)
-      : vec(il)
-    {}
-
-    std::vector<int> vec;
-  };
-
-  int main(void)
-  {
-    A a{1,3,4,5};
-    return 0;
-  }
-" HAVE_INITIALIZER_LIST
-)
-
 # constexpr
 check_cxx_source_compiles("
   constexpr int foo()
diff --git a/config.h.cmake b/config.h.cmake
index 3b21e5e41..8f00bb7ea 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -154,9 +154,6 @@
 /* Define to 1 if rvalue references are supported */
 #cmakedefine HAVE_RVALUE_REFERENCES 1
 
-/* Define to 1 if initializer list is supported */
-#cmakedefine HAVE_INITIALIZER_LIST 1
-
 /* Define to 1 if C++11 constexpr is supported */
 #cmakedefine HAVE_CONSTEXPR 1
 
diff --git a/dune/common/fvector.hh b/dune/common/fvector.hh
index 710de61fd..0696f0305 100644
--- a/dune/common/fvector.hh
+++ b/dune/common/fvector.hh
@@ -105,20 +105,8 @@ namespace Dune {
 
     //! Constructor making default-initialized vector
     FieldVector()
-    // Use C++11 unified initialization if available - tends to generate
-    // fastest code
-#if HAVE_INITIALIZER_LIST
       : _data{}
     {}
-#else
-    {
-      // fall back to library approach - this gives faster code than array placement
-      // new. Apart from that, placement new may create problems if K is a complex
-      // type. In that case, the default constructor of the _data elements has already
-      // been called and may have allocated memory.
-      std::fill(_data.begin(),_data.end(),K());
-    }
-#endif
 
     //! Constructor making vector with identical coordinates
     explicit FieldVector (const K& t)
diff --git a/m4/CMakeLists.txt b/m4/CMakeLists.txt
index 20f293591..ecc5bf84f 100644
--- a/m4/CMakeLists.txt
+++ b/m4/CMakeLists.txt
@@ -13,7 +13,6 @@ install(PROGRAMS
         cxx0x_variadic.m4
         cxx0x_variadic_constructor_sfinae.m4
         cxx11_constexpr.m4
-        cxx11_initializer_list.m4
         cxx11_conditional.m4
         cxx11_final.m4
         dune.m4
diff --git a/m4/Makefile.am b/m4/Makefile.am
index ce7f3c9b5..0d2a5a4ec 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -15,7 +15,6 @@ ALLM4S = 					\
 	cxx0x_nullptr.m4			\
 	cxx0x_variadic.m4			\
 	cxx0x_variadic_constructor_sfinae.m4    \
-	cxx11_initializer_list.m4		\
 	cxx11_conditional.m4			\
 	cxx11_constexpr.m4			\
 	cxx11_final.m4				\
diff --git a/m4/cxx11_initializer_list.m4 b/m4/cxx11_initializer_list.m4
deleted file mode 100644
index 04fc9ff86..000000000
--- a/m4/cxx11_initializer_list.m4
+++ /dev/null
@@ -1,37 +0,0 @@
-# tests for C++11 initializer list support
-# the associated macro is called HAVE_INITIALIZER_LIST
-
-AC_DEFUN([INITIALIZER_LIST_CHECK],[
-  AC_CACHE_CHECK([whether std::initializer_list is supported], dune_cv_initializer_list_support, [
-    AC_REQUIRE([AC_PROG_CXX])
-    AC_REQUIRE([GXX0X])
-    AC_LANG_PUSH([C++])
-    AC_RUN_IFELSE([
-      AC_LANG_PROGRAM([
-
-        #include <initializer_list>
-        #include <vector>
-
-        struct A
-        {
-
-          A(std::initializer_list<int> il)
-            : vec(il)
-          {}
-
-          std::vector<int> vec;
-        };
-
-        ],
-        [
-          A a{1,3,4,5};
-          return 0;
-        ])],
-      dune_cv_initializer_list_support=yes,
-      dune_cv_initializer_list_support=no)
-    AC_LANG_POP
-  ])
-  if test "x$dune_cv_initializer_list_support" = xyes; then
-    AC_DEFINE(HAVE_INITIALIZER_LIST, 1, [Define to 1 if std::initializer_list is supported])
-  fi
-])
diff --git a/m4/dune_common.m4 b/m4/dune_common.m4
index 792d4fea4..cfee8a81b 100644
--- a/m4/dune_common.m4
+++ b/m4/dune_common.m4
@@ -23,7 +23,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
   AC_REQUIRE([SHARED_PTR])
   AC_REQUIRE([VARIADIC_TEMPLATES_CHECK])
   AC_REQUIRE([RVALUE_REFERENCES_CHECK])
-  AC_REQUIRE([INITIALIZER_LIST_CHECK])
   AC_REQUIRE([CXX11_CONDITIONAL_CHECK])
   AC_REQUIRE([CXX11_CONSTEXPR_CHECK])
   AC_REQUIRE([DUNE_BOOST_BASE])
-- 
GitLab