Backed out 4 changesets (bug 1538081) for causing BaseElf.cpp bustages CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Sat, 30 Mar 2019 03:02:15 +0200
changeset 528788 4e1afd84043705a5e072873af3d4d7957e639ba3
parent 528787 81735d15243c00721dc107e39c956c9681e89f23
child 528789 12fa4d0520ad825314a552cdffb87297e8d83748
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1538081
milestone68.0a1
backs outced61a86c74c6ce2a966b2ac7880cfe3e7a8e0d8
d6d331abbf0ebf89f4c7a3f391e4ac4b943c37cb
26df801e44db03a402a6a9d3aa6143aa49f78cab
113ac188a69e7d00c828e4400e81eb3dd25fbf46
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
Backed out 4 changesets (bug 1538081) for causing BaseElf.cpp bustages CLOSED TREE Backed out changeset ced61a86c74c (bug 1538081) Backed out changeset d6d331abbf0e (bug 1538081) Backed out changeset 26df801e44db (bug 1538081) Backed out changeset 113ac188a69e (bug 1538081)
mfbt/Array.h
mfbt/DbgMacro.h
mfbt/RefPtr.h
mfbt/moz.build
mfbt/tests/gtest/TestMozDbg.cpp
mfbt/tests/gtest/moz.build
xpcom/base/nsCOMPtr.h
xpcom/base/nsDebug.h
xpcom/ds/nsTArray.h
xpcom/string/nsString.h
--- a/mfbt/Array.h
+++ b/mfbt/Array.h
@@ -9,17 +9,16 @@
 #ifndef mozilla_Array_h
 #define mozilla_Array_h
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Move.h"
 #include "mozilla/ReverseIterator.h"
 
-#include <ostream>
 #include <stddef.h>
 
 namespace mozilla {
 
 template <typename T, size_t Length>
 class Array {
   T mArr[Length];
 
@@ -84,18 +83,11 @@ class Array<T, 0> {
  public:
   T& operator[](size_t aIndex) { MOZ_CRASH("indexing into zero-length array"); }
 
   const T& operator[](size_t aIndex) const {
     MOZ_CRASH("indexing into zero-length array");
   }
 };
 
-// MOZ_DBG support
-
-template <typename T, size_t Length>
-std::ostream& operator<<(std::ostream& aOut, const Array<T, Length>& aArray) {
-  return aOut << MakeSpan(aArray);
-}
-
 } /* namespace mozilla */
 
 #endif /* mozilla_Array_h */
deleted file mode 100644
--- a/mfbt/DbgMacro.h
+++ /dev/null
@@ -1,177 +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/. */
-
-#ifndef mozilla_DbgMacro_h
-#define mozilla_DbgMacro_h
-
-/* a MOZ_DBG macro that outputs a wrapped value to stderr then returns it */
-
-#include "mozilla/MacroForEach.h"
-#include "mozilla/Span.h"
-
-#include <stdio.h>
-#include <sstream>
-
-namespace mozilla {
-
-namespace detail {
-
-// Predicate to check whether T can be dereferenced and then inserted into an
-// ostream.
-template <typename T, typename = decltype(std::declval<std::ostream&>()
-                                          << *std::declval<T>())>
-std::true_type supports_os_deref_test(const T&);
-std::false_type supports_os_deref_test(...);
-
-template <typename T>
-using supports_os_deref = decltype(supports_os_deref_test(std::declval<T>()));
-
-}  // namespace detail
-
-// Helper function to write a value to an ostream.
-//
-// This handles pointer values where the type being pointed to supports
-// operator<<, and we write out the value being pointed to in addition to the
-// pointer value.
-template <typename T>
-auto DebugValue(std::ostream& aOut, T&& aValue) -> std::enable_if_t<
-    std::is_pointer<typename std::remove_reference<T>::type>::value &&
-        mozilla::detail::supports_os_deref<T>::value,
-    std::ostream&> {
-  if (aValue) {
-    aOut << *aValue << " @ " << aValue;
-  } else {
-    aOut << "null";
-  }
-  return aOut;
-}
-
-// Helper function to write a value to an ostream.
-//
-// This handles all other types by calling into operator<<.
-template <typename T>
-auto DebugValue(std::ostream& aOut, T&& aValue) -> std::enable_if_t<
-    !(std::is_pointer<typename std::remove_reference<T>::type>::value &&
-      mozilla::detail::supports_os_deref<T>::value),
-    std::ostream&> {
-  return aOut << aValue;
-}
-
-namespace detail {
-
-// Helper function template for MOZ_DBG.
-template <typename T>
-auto&& MozDbg(const char* aFile, int aLine, const char* aExpression,
-              T&& aValue) {
-  std::ostringstream s;
-  s << '[' << aFile << ':' << aLine << "] " << aExpression << " = ";
-  mozilla::DebugValue(s, std::forward<T>(aValue));
-  s << '\n';
-  fputs(s.str().c_str(), stderr);
-  return std::forward<T>(aValue);
-}
-
-}  // namespace detail
-
-}  // namespace mozilla
-
-template <class ElementType, size_t Extent>
-std::ostream& operator<<(std::ostream& aOut,
-                         const mozilla::Span<ElementType, Extent>& aSpan) {
-  aOut << '[';
-  if (!aSpan.IsEmpty()) {
-    aOut << aSpan[0];
-    for (size_t i = 1; i < aSpan.Length(); ++i) {
-      aOut << ", " << aSpan[i];
-    }
-  }
-  return aOut << ']';
-}
-
-// Don't define this for char[], since operator<<(ostream&, char*) is already
-// defined.
-template <typename T, size_t N,
-          typename = std::enable_if_t<!std::is_same<T, char>::value>>
-std::ostream& operator<<(std::ostream& aOut, const T (&aArray)[N]) {
-  return aOut << mozilla::MakeSpan(aArray);
-  // return aOut << mozilla::Span(aArray);
-}
-
-// MOZ_DBG is a macro like the Rust dbg!() macro -- it will print out the
-// expression passed to it to stderr and then return the value.  It is available
-// only in MOZILLA_OFFICIAL builds, so you shouldn't land any uses of it in the
-// tree.
-//
-// It should work for any type T that has an operator<<(std::ostream&, const T&)
-// defined for it.
-//
-// Note 1: Using MOZ_DBG may cause copies to be made of temporary values:
-//
-//   struct A {
-//     A(int);
-//     A(const A&);
-//
-//     int x;
-//   };
-//
-//   void f(A);
-//
-//   f(A{1});  // may (and, in C++17, will) elide the creation of a temporary
-//             // for A{1} and instead initialize the function argument
-//             // directly using the A(int) constructor
-//
-//   f(MOZ_DBG(A{1}));  // will create and return a temporary for A{1}, which
-//                      // then will be passed to the A(const A&) copy
-//                      // constructor to initialize f's argument
-//
-// Note 2: MOZ_DBG cannot be used to wrap a prvalue that is being used to
-// initialize an object if its type has no move constructor:
-//
-//   struct B {
-//     B() = default;
-//     B(B&&) = delete;
-//   };
-//
-//   B b1 = B();  // fine, initializes b1 directly
-//
-//   B b2 = MOZ_DBG(B());  // compile error: MOZ_DBG needs to materialize a
-//                         // temporary for B() so it can be passed to
-//                         // operator<<, but that temporary is returned from
-//                         // MOZ_DBG as an rvalue reference and so wants to
-//                         // invoke B's move constructor to initialize b2
-#ifndef MOZILLA_OFFICIAL
-#  define MOZ_DBG(expression_...) \
-    mozilla::detail::MozDbg(__FILE__, __LINE__, #expression_, expression_)
-#endif
-
-// Helper macro for MOZ_DEFINE_DBG.
-#define MOZ_DBG_FIELD(name_) << #name_ << " = " << aValue.name_
-
-// Macro to define an operator<<(ostream&) for a struct or class that displays
-// the type name and the values of the specified member variables.  Must be
-// called inside the struct or class.
-//
-// For example:
-//
-//   struct Point {
-//     float x;
-//     float y;
-//
-//     MOZ_DEFINE_DBG(Point, x, y)
-//   };
-//
-// generates an operator<< that outputs strings like
-// "Point { x = 1.0, y = 2.0 }".
-#define MOZ_DEFINE_DBG(type_, members_...)                                   \
-  friend std::ostream& operator<<(std::ostream& aOut, const type_& aValue) { \
-    return aOut << #type_                                                    \
-                << (MOZ_ARG_COUNT(members_) == 0 ? "{ " : "")                \
-                       MOZ_FOR_EACH_SEPARATED(MOZ_DBG_FIELD, (<< ", "), (),  \
-                                              (members_))                    \
-                << (MOZ_ARG_COUNT(members_) == 0 ? " }" : "");               \
-  }
-
-#endif  // mozilla_DbgMacro_h
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_RefPtr_h
 #define mozilla_RefPtr_h
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/DbgMacro.h"
 
 /*****************************************************************************/
 
 // template <class T> class RefPtrGetterAddRefs;
 
 class nsQueryReferent;
 class nsCOMPtr_helper;
 class nsISupports;
@@ -519,23 +518,16 @@ inline bool operator!=(const RefPtr<T>& 
   return aLhs.get() != nullptr;
 }
 
 template <class T>
 inline bool operator!=(decltype(nullptr), const RefPtr<T>& aRhs) {
   return nullptr != aRhs.get();
 }
 
-// MOZ_DBG support
-
-template <class T>
-std::ostream& operator<<(std::ostream& aOut, const RefPtr<T>& aObj) {
-  return mozilla::DebugValue(aOut, aObj.get());
-}
-
 /*****************************************************************************/
 
 template <class T>
 inline already_AddRefed<T> do_AddRef(T* aObj) {
   RefPtr<T> ref(aObj);
   return ref.forget();
 }
 
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -24,17 +24,16 @@ EXPORTS.mozilla = [
     'Buffer.h',
     'BufferList.h',
     'Casting.h',
     'ChaosMode.h',
     'Char16.h',
     'CheckedInt.h',
     'Compiler.h',
     'Compression.h',
-    'DbgMacro.h',
     'DebugOnly.h',
     'decimal/Decimal.h',
     'DefineEnum.h',
     'DoublyLinkedList.h',
     'EndianUtils.h',
     'EnumeratedArray.h',
     'EnumeratedRange.h',
     'EnumSet.h',
deleted file mode 100644
--- a/mfbt/tests/gtest/TestMozDbg.cpp
+++ /dev/null
@@ -1,174 +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 <iostream>
-
-#include "gtest/gtest.h"
-#include "mozilla/DbgMacro.h"
-#include "mozilla/Unused.h"
-
-using namespace mozilla;
-
-#define TEST_MOZ_DBG_TYPE_IS(type_, expression_...)                   \
-  static_assert(IsSame<type_, decltype(MOZ_DBG(expression_))>::value, \
-                "MOZ_DBG should return the indicated type")
-
-#define TEST_MOZ_DBG_TYPE_SAME(expression_...)                                \
-  static_assert(                                                              \
-      IsSame<decltype((expression_)), decltype(MOZ_DBG(expression_))>::value, \
-      "MOZ_DBG should return the same type")
-
-struct Number {
-  explicit Number(int aValue) : mValue(aValue) {}
-
-  Number(const Number& aOther) : mValue(aOther.mValue) {}
-
-  Number(Number&& aOther) : mValue(aOther.mValue) { aOther.mValue = 0; }
-
-  Number& operator=(const Number& aOther) {
-    mValue = aOther.mValue;
-    return *this;
-  }
-
-  Number& operator=(Number&& aOther) {
-    mValue = aOther.mValue;
-    aOther.mValue = 0;
-    return *this;
-  }
-
-  ~Number() { mValue = -999; }
-
-  int mValue;
-
-  MOZ_DEFINE_DBG(Number, mValue)
-};
-
-struct MoveOnly {
-  explicit MoveOnly(int aValue) : mValue(aValue) {}
-
-  MoveOnly(const MoveOnly& aOther) = delete;
-
-  MoveOnly(MoveOnly&& aOther) : mValue(aOther.mValue) { aOther.mValue = 0; }
-
-  MoveOnly& operator=(MoveOnly& aOther) {
-    mValue = aOther.mValue;
-    return *this;
-  }
-
-  MoveOnly& operator=(MoveOnly&& aOther) {
-    mValue = aOther.mValue;
-    aOther.mValue = 0;
-    return *this;
-  }
-
-  int mValue;
-
-  MOZ_DEFINE_DBG(MoveOnly)
-};
-
-void StaticAssertions() {
-  int x = 123;
-  Number y(123);
-  Number z(234);
-  MoveOnly w(456);
-
-  // Static assertions.
-
-  // lvalues
-  TEST_MOZ_DBG_TYPE_SAME(x);        // int&
-  TEST_MOZ_DBG_TYPE_SAME(y);        // Number&
-  TEST_MOZ_DBG_TYPE_SAME(x = 234);  // int&
-  TEST_MOZ_DBG_TYPE_SAME(y = z);    // Number&
-  TEST_MOZ_DBG_TYPE_SAME(w);        // MoveOnly&
-
-  // prvalues (which MOZ_DBG turns into xvalues by creating objects for them)
-  TEST_MOZ_DBG_TYPE_IS(int&&, 123);
-  TEST_MOZ_DBG_TYPE_IS(int&&, 1 + 2);
-  TEST_MOZ_DBG_TYPE_IS(int*&&, &x);
-  TEST_MOZ_DBG_TYPE_IS(int&&, x++);
-  TEST_MOZ_DBG_TYPE_IS(Number&&, Number(123));
-  TEST_MOZ_DBG_TYPE_IS(MoveOnly&&, MoveOnly(123));
-
-  // xvalues
-  TEST_MOZ_DBG_TYPE_SAME(std::move(y));  // int&&
-  TEST_MOZ_DBG_TYPE_SAME(std::move(y));  // Number&&
-  TEST_MOZ_DBG_TYPE_SAME(std::move(w));  // MoveOnly&
-
-  Unused << x;
-  Unused << y;
-  Unused << z;
-}
-
-TEST(MozDbg, ObjectValues) {
-  // Test that moves and assignments all operate correctly with MOZ_DBG wrapped
-  // around various parts of the expression.
-
-  Number a(1);
-  Number b(4);
-
-  ASSERT_EQ(a.mValue, 1);
-
-  MOZ_DBG(a.mValue);
-  ASSERT_EQ(a.mValue, 1);
-
-  MOZ_DBG(a.mValue + 1);
-  ASSERT_EQ(a.mValue, 1);
-
-  MOZ_DBG(a.mValue = 2);
-  ASSERT_EQ(a.mValue, 2);
-
-  MOZ_DBG(a).mValue = 3;
-  ASSERT_EQ(a.mValue, 3);
-
-  MOZ_DBG(a = b);
-  ASSERT_EQ(a.mValue, 4);
-  ASSERT_EQ(b.mValue, 4);
-
-  b.mValue = 5;
-  MOZ_DBG(a) = b;
-  ASSERT_EQ(a.mValue, 5);
-  ASSERT_EQ(b.mValue, 5);
-
-  b.mValue = 6;
-  MOZ_DBG(a = std::move(b));
-  ASSERT_EQ(a.mValue, 6);
-  ASSERT_EQ(b.mValue, 0);
-
-  b.mValue = 7;
-  MOZ_DBG(a) = std::move(b);
-  ASSERT_EQ(a.mValue, 7);
-  ASSERT_EQ(b.mValue, 0);
-
-  b.mValue = 8;
-  a = std::move(MOZ_DBG(b));
-  ASSERT_EQ(a.mValue, 8);
-  ASSERT_EQ(b.mValue, 0);
-
-  a = MOZ_DBG(Number(9));
-  ASSERT_EQ(a.mValue, 9);
-
-  MoveOnly c(1);
-  MoveOnly d(2);
-
-  c = std::move(MOZ_DBG(d));
-  ASSERT_EQ(c.mValue, 2);
-  ASSERT_EQ(d.mValue, 0);
-
-  c.mValue = 3;
-  d.mValue = 4;
-  c = MOZ_DBG(std::move(d));
-  ASSERT_EQ(c.mValue, 4);
-  ASSERT_EQ(d.mValue, 0);
-
-  c.mValue = 5;
-  d.mValue = 6;
-  MOZ_DBG(c = std::move(d));
-  ASSERT_EQ(c.mValue, 6);
-  ASSERT_EQ(d.mValue, 0);
-
-  c = MOZ_DBG(MoveOnly(7));
-  ASSERT_EQ(c.mValue, 7);
-}
--- a/mfbt/tests/gtest/moz.build
+++ b/mfbt/tests/gtest/moz.build
@@ -5,19 +5,13 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES += [
     'TestBuffer.cpp',
     'TestLinkedList.cpp',
     'TestSpan.cpp',
 ]
 
-if not CONFIG['MOZILLA_OFFICIAL']:
-    UNIFIED_SOURCES += [
-        # MOZ_DBG is not defined in MOZILLA_OFFICIAL builds.
-        'TestMozDbg.cpp',
-    ]
-
 #LOCAL_INCLUDES += [
 #    '../../base',
 #]
 
 FINAL_LIBRARY = 'xul-gtest'
--- a/xpcom/base/nsCOMPtr.h
+++ b/xpcom/base/nsCOMPtr.h
@@ -1471,16 +1471,9 @@ RefPtr<T>& RefPtr<T>::operator=(const ns
 }
 
 template <class T>
 inline already_AddRefed<T> do_AddRef(const nsCOMPtr<T>& aObj) {
   nsCOMPtr<T> ref(aObj);
   return ref.forget();
 }
 
-// MOZ_DBG support
-
-template <class T>
-std::ostream& operator<<(std::ostream& aOut, const nsCOMPtr<T>& aObj) {
-  return aOut << aObj.get();
-}
-
 #endif  // !defined(nsCOMPtr_h___)
--- a/xpcom/base/nsDebug.h
+++ b/xpcom/base/nsDebug.h
@@ -7,17 +7,16 @@
 #ifndef nsDebug_h___
 #define nsDebug_h___
 
 #include "nscore.h"
 #include "nsError.h"
 
 #include "nsXPCOM.h"
 #include "mozilla/Assertions.h"
-#include "mozilla/DbgMacro.h"
 #include "mozilla/Likely.h"
 #include <stdarg.h>
 
 #ifdef DEBUG
 #  include "mozilla/IntegerPrintfMacros.h"
 #  include "mozilla/Printf.h"
 #endif
 
--- a/xpcom/ds/nsTArray.h
+++ b/xpcom/ds/nsTArray.h
@@ -9,17 +9,16 @@
 
 #include "nsTArrayForwardDeclare.h"
 #include "mozilla/Alignment.h"
 #include "mozilla/ArrayIterator.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BinarySearch.h"
 #include "mozilla/CheckedInt.h"
-#include "mozilla/DbgMacro.h"
 #include "mozilla/fallible.h"
 #include "mozilla/FunctionTypeTraits.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "mozilla/mozalloc.h"
 #include "mozilla/ReverseIterator.h"
 #include "mozilla/TypeTraits.h"
@@ -32,17 +31,16 @@
 #include "nscore.h"
 #include "nsQuickSort.h"
 #include "nsDebug.h"
 #include "nsISupportsImpl.h"
 #include "nsRegionFwd.h"
 #include <functional>
 #include <initializer_list>
 #include <new>
-#include <ostream>
 
 namespace JS {
 template <class T>
 class Heap;
 } /* namespace JS */
 
 class nsRegion;
 namespace mozilla {
@@ -2644,24 +2642,16 @@ Span<ElementType> MakeSpan(nsTArray_Impl
 template <class ElementType, class TArrayAlloc>
 Span<const ElementType> MakeSpan(
     const nsTArray_Impl<ElementType, TArrayAlloc>& aTArray) {
   return aTArray;
 }
 
 }  // namespace mozilla
 
-// MOZ_DBG support
-
-template <class E, class Alloc>
-std::ostream& operator<<(std::ostream& aOut,
-                         const nsTArray_Impl<E, Alloc>& aTArray) {
-  return aOut << mozilla::MakeSpan(aTArray);
-}
-
 // Assert that AutoTArray doesn't have any extra padding inside.
 //
 // It's important that the data stored in this auto array takes up a multiple of
 // 8 bytes; e.g. AutoTArray<uint32_t, 1> wouldn't work.  Since AutoTArray
 // contains a pointer, its size must be a multiple of alignof(void*).  (This is
 // because any type may be placed into an array, and there's no padding between
 // elements of an array.)  The compiler pads the end of the structure to
 // enforce this rule.
--- a/xpcom/string/nsString.h
+++ b/xpcom/string/nsString.h
@@ -2,18 +2,16 @@
 /* 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 nsString_h___
 #define nsString_h___
 
-#include <ostream>
-
 #include "mozilla/Attributes.h"
 
 #include "nsStringFwd.h"
 
 #include "nsAString.h"
 #include "nsDependentSubstring.h"
 #include "nsReadableUtils.h"
 
@@ -119,26 +117,14 @@ class NS_ConvertUTF8toUTF16 : public nsA
     AppendUTF8toUTF16(aCString, *this);
   }
 
  private:
   // NOT TO BE IMPLEMENTED
   NS_ConvertUTF8toUTF16(char16_t) = delete;
 };
 
-// MOZ_DBG support
-
-inline std::ostream& operator<<(std::ostream& aOut, const nsACString& aString) {
-  aOut << '"';
-  aOut.write(aString.Data(), aString.Length());
-  return aOut << '"';
-}
-
-inline std::ostream& operator<<(std::ostream& aOut, const nsAString& aString) {
-  return aOut << NS_ConvertUTF16toUTF8(aString);
-}
-
 // the following are included/declared for backwards compatibility
 #include "nsDependentString.h"
 #include "nsLiteralString.h"
 #include "nsPromiseFlatString.h"
 
 #endif  // !defined(nsString_h___)