Bug 1311068 - remove InitializerList.h; r=botond
authorNathan Froyd <froydnj@mozilla.com>
Wed, 19 Oct 2016 00:33:14 -0400
changeset 318541 53252ffba01d8723024e875f3410153e0ffe3b1b
parent 318540 b9a8c11b0609f39b22691e0487a359d025c5d75e
child 318542 4abaf0bda1fec7cf54cb4cb8f6b7cf19e62ae879
push id30843
push usercbook@mozilla.com
push dateWed, 19 Oct 2016 15:02:57 +0000
treeherdermozilla-central@f40960c63bfa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1311068
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1311068 - remove InitializerList.h; r=botond We needed this polyfill for <initializer_list> when some of our C++ standard libraries did not support said header. They all do now, so the polyfill is redundant.
dom/animation/AnimationPerformanceWarning.h
dom/animation/EffectCompositor.cpp
gfx/2d/Polygon.h
mfbt/EnumSet.h
mfbt/InitializerList.h
mfbt/moz.build
mfbt/tests/TestInitializerList.cpp
mfbt/tests/moz.build
testing/cppunittest.ini
xpcom/glue/nsTArray.h
--- a/dom/animation/AnimationPerformanceWarning.h
+++ b/dom/animation/AnimationPerformanceWarning.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_AnimationPerformanceWarning_h
 #define mozilla_dom_AnimationPerformanceWarning_h
 
-#include "mozilla/InitializerList.h"
+#include <initializer_list>
 
 class nsXPIDLString;
 
 namespace mozilla {
 
 // Represents the reason why we can't run the CSS property on the compositor.
 struct AnimationPerformanceWarning
 {
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -9,29 +9,29 @@
 #include "mozilla/dom/Animation.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/KeyframeEffectReadOnly.h"
 #include "mozilla/AnimationComparator.h"
 #include "mozilla/AnimationPerformanceWarning.h"
 #include "mozilla/AnimationTarget.h"
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/EffectSet.h"
-#include "mozilla/InitializerList.h"
 #include "mozilla/LayerAnimationInfo.h"
 #include "mozilla/RestyleManagerHandle.h"
 #include "mozilla/RestyleManagerHandleInlines.h"
 #include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSProps.h"
 #include "nsIPresShell.h"
 #include "nsLayoutUtils.h"
 #include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation
 #include "nsRuleProcessorData.h" // For ElementRuleProcessorData etc.
 #include "nsTArray.h"
 #include <bitset>
+#include <initializer_list>
 
 using mozilla::dom::Animation;
 using mozilla::dom::Element;
 using mozilla::dom::KeyframeEffectReadOnly;
 
 namespace mozilla {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(EffectCompositor)
--- a/gfx/2d/Polygon.h
+++ b/gfx/2d/Polygon.h
@@ -2,22 +2,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_POLYGON_H
 #define MOZILLA_GFX_POLYGON_H
 
 #include "Matrix.h"
-#include "mozilla/InitializerList.h"
 #include "mozilla/Move.h"
 #include "nsTArray.h"
 #include "Point.h"
 #include "Triangle.h"
 
+#include <initializer_list>
+
 namespace mozilla {
 namespace gfx {
 
 // Polygon3DTyped stores the points of a convex planar polygon.
 template<class Units>
 class Polygon3DTyped {
 public:
   Polygon3DTyped() {}
--- a/mfbt/EnumSet.h
+++ b/mfbt/EnumSet.h
@@ -6,17 +6,18 @@
 
 /* A set abstraction for enumeration values. */
 
 #ifndef mozilla_EnumSet_h
 #define mozilla_EnumSet_h
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/InitializerList.h"
+
+#include <initializer_list>
 
 #include <stdint.h>
 
 namespace mozilla {
 
 /**
  * EnumSet<T> is a set of values defined by an enumeration. It is implemented
  * using a 32 bit mask for each value so it will only work for enums with an int
deleted file mode 100644
--- a/mfbt/InitializerList.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- *  * License, v. 2.0. If a copy of the MPL was not distributed with this
- *   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* A polyfill for std::initializer_list if it doesn't exist */
-
-#ifndef mozilla_InitializerList_h
-#define mozilla_InitializerList_h
-
-#include <mozilla/Compiler.h>
-#include <mozilla/Attributes.h>
-#if MOZ_USING_LIBCXX
-#  define MOZ_HAVE_INITIALIZER_LIST
-#elif MOZ_USING_LIBSTDCXX && __GLIBCXX__ >= 20090421 // GCC 4.4.0
-#  define MOZ_HAVE_INITIALIZER_LIST
-#elif _MSC_VER
-#  define MOZ_HAVE_INITIALIZER_LIST
-#elif defined(MOZ_USING_STLPORT)
-#else
-#  error "Unknown standard library situation"
-#endif
-
-#ifdef MOZ_HAVE_INITIALIZER_LIST
-#  include <initializer_list>
-#else
-/* Normally we would put things in mozilla:: however, std::initializer_list is a
- * magic name used by the compiler and so we need to name it that way.
- */
-namespace std
-{
-
-template<class T>
-class initializer_list
-{
-    /* This matches the representation used by GCC and Clang which
-     * are the only compilers we need to polyfill */
-    const T* mBegin;
-    size_t   mSize;
-
-    /* This constructor is called directly by the compiler */
-    initializer_list(const T* aBegin, size_t aSize)
-      : mBegin(aBegin)
-      , mSize(aSize) { }
-public:
-
-    constexpr initializer_list() : mBegin(nullptr), mSize(0) {}
-
-    typedef T value_type;
-    typedef const T& reference;
-    typedef const T& const_reference;
-    typedef size_t size_type;
-    typedef const T* iterator;
-    typedef const T* const_iterator;
-
-    size_t size() const { return mSize; }
-    const T* begin() const { return mBegin; }
-    const T* end() const { return mBegin + mSize; }
-};
-
-}
-#endif /* MOZ_HAS_INITIALIZER_LIST */
-#endif /* mozilla_InitializerList_h */
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -41,17 +41,16 @@ EXPORTS.mozilla = [
     'EnumSet.h',
     'EnumTypeTraits.h',
     'FastBernoulliTrial.h',
     'FloatingPoint.h',
     'Function.h',
     'GuardObjects.h',
     'HashFunctions.h',
     'IndexSequence.h',
-    'InitializerList.h',
     'IntegerPrintfMacros.h',
     'IntegerRange.h',
     'IntegerTypeTraits.h',
     'JSONWriter.h',
     'Likely.h',
     'LinkedList.h',
     'MacroArgs.h',
     'MacroForEach.h',
deleted file mode 100644
--- a/mfbt/tests/TestInitializerList.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/Assertions.h"
-#include "mozilla/InitializerList.h"
-
-int sum(std::initializer_list<int> p)
-{
-  int result = 0;
-  for (auto i : p) {
-    result += i;
-  }
-  return result;
-}
-
-int
-main()
-{
-  MOZ_RELEASE_ASSERT(sum({1, 2, 3, 4, 5, 6}) == 7 * 3);
-  return 0;
-}
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -16,17 +16,16 @@ CppUnitTests([
     'TestCountPopulation',
     'TestCountZeroes',
     'TestEndian',
     'TestEnumSet',
     'TestEnumTypeTraits',
     'TestFastBernoulliTrial',
     'TestFloatingPoint',
     'TestFunction',
-    'TestInitializerList',
     'TestIntegerPrintfMacros',
     'TestIntegerRange',
     'TestJSONWriter',
     'TestLinkedList',
     'TestMacroArgs',
     'TestMacroForEach',
     'TestMathAlgorithms',
     'TestMaybe',
--- a/testing/cppunittest.ini
+++ b/testing/cppunittest.ini
@@ -36,17 +36,16 @@ skip-if = os != 'win'
 [TestEnumTypeTraits]
 [TestFastBernoulliTrial]
 [TestFile]
 [TestFloatingPoint]
 [TestFunction]
 [TestGetURL]
 [TestHashtables]
 [TestID]
-[TestInitializerList]
 [TestIntegerPrintfMacros]
 [TestIntegerRange]
 [TestIsCertBuiltInRoot]
 skip-if = os == 'android' # bug 1228175, bug 929655
 [TestJSONWriter]
 [TestJemalloc]
 [TestLineBreak]
 [TestLinkedList]
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -9,32 +9,32 @@
 
 #include "nsTArrayForwardDeclare.h"
 #include "mozilla/Alignment.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BinarySearch.h"
 #include "mozilla/fallible.h"
 #include "mozilla/Function.h"
-#include "mozilla/InitializerList.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "mozilla/ReverseIterator.h"
 #include "mozilla/TypeTraits.h"
 
 #include <string.h>
 
 #include "nsCycleCollectionNoteChild.h"
 #include "nsAlgorithm.h"
 #include "nscore.h"
 #include "nsQuickSort.h"
 #include "nsDebug.h"
 #include "nsISupportsImpl.h"
 #include "nsRegionFwd.h"
+#include <initializer_list>
 #include <new>
 
 namespace JS {
 template<class T>
 class Heap;
 } /* namespace JS */
 
 class nsRegion;