| File: | root/firefox-clang/mfbt/tests/TestVector.cpp |
| Warning: | line 52, column 3 Method called on moved-from object 'bv' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public | |||
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, | |||
| 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ | |||
| 4 | ||||
| 5 | #include <utility> | |||
| 6 | ||||
| 7 | #include "mozilla/IntegerRange.h" | |||
| 8 | #include "mozilla/UniquePtr.h" | |||
| 9 | #include "mozilla/Vector.h" | |||
| 10 | ||||
| 11 | using mozilla::IntegerRange; | |||
| 12 | using mozilla::MakeUnique; | |||
| 13 | using mozilla::UniquePtr; | |||
| 14 | using mozilla::Vector; | |||
| 15 | using mozilla::detail::VectorTesting; | |||
| 16 | ||||
| 17 | struct mozilla::detail::VectorTesting { | |||
| 18 | static void testReserved(); | |||
| 19 | static void testConstRange(); | |||
| 20 | static void testEmplaceBack(); | |||
| 21 | static void testReverse(); | |||
| 22 | static void testExtractRawBuffer(); | |||
| 23 | static void testExtractOrCopyRawBuffer(); | |||
| 24 | static void testReplaceRawBuffer(); | |||
| 25 | static void testInsert(); | |||
| 26 | static void testErase(); | |||
| 27 | static void testShrinkStorageToFit(); | |||
| 28 | static void testAppend(); | |||
| 29 | }; | |||
| 30 | ||||
| 31 | void mozilla::detail::VectorTesting::testReserved() { | |||
| 32 | #ifdef DEBUG1 | |||
| 33 | Vector<bool> bv; | |||
| 34 | MOZ_RELEASE_ASSERT(bv.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 34); do { } while (false); do { MOZ_CrashSequence(__null, 34); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| ||||
| 35 | ||||
| 36 | MOZ_RELEASE_ASSERT(bv.append(true))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.append(true))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.append(true)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.append(true)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 36); do { } while (false); do { MOZ_CrashSequence(__null, 36); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 37 | MOZ_RELEASE_ASSERT(bv.reserved() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 37); do { } while (false); do { MOZ_CrashSequence(__null, 37); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 38 | ||||
| 39 | Vector<bool> otherbv; | |||
| 40 | MOZ_RELEASE_ASSERT(otherbv.append(false))do { static_assert( mozilla::detail::AssertionConditionType< decltype(otherbv.append(false))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(otherbv.append(false)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("otherbv.append(false)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 40); do { } while (false); do { MOZ_CrashSequence(__null, 40); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 41 | MOZ_RELEASE_ASSERT(otherbv.append(true))do { static_assert( mozilla::detail::AssertionConditionType< decltype(otherbv.append(true))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(otherbv.append(true)))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("otherbv.append(true)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 41); do { } while (false); do { MOZ_CrashSequence(__null, 41); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 42 | MOZ_RELEASE_ASSERT(bv.appendAll(otherbv))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.appendAll(otherbv))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.appendAll(otherbv)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("bv.appendAll(otherbv)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 42); do { } while (false); do { MOZ_CrashSequence(__null, 42); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 43 | MOZ_RELEASE_ASSERT(bv.reserved() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 43); do { } while (false); do { MOZ_CrashSequence(__null, 43); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 44 | ||||
| 45 | MOZ_RELEASE_ASSERT(bv.reserve(5))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserve(5))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserve(5)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserve(5)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 45); do { } while (false); do { MOZ_CrashSequence(__null, 45); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 46 | MOZ_RELEASE_ASSERT(bv.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 46); do { } while (false); do { MOZ_CrashSequence(__null, 46); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 47 | ||||
| 48 | MOZ_RELEASE_ASSERT(bv.reserve(1))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserve(1))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserve(1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserve(1)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 48); do { } while (false); do { MOZ_CrashSequence(__null, 48); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 49 | MOZ_RELEASE_ASSERT(bv.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 49); do { } while (false); do { MOZ_CrashSequence(__null, 49); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 50 | ||||
| 51 | Vector<bool> bv2(std::move(bv)); | |||
| 52 | MOZ_RELEASE_ASSERT(bv.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 52); do { } while (false); do { MOZ_CrashSequence(__null, 52); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| ||||
| 53 | MOZ_RELEASE_ASSERT(bv2.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv2.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv2.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv2.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 53); do { } while (false); do { MOZ_CrashSequence(__null, 53); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 54 | ||||
| 55 | bv2.clearAndFree(); | |||
| 56 | MOZ_RELEASE_ASSERT(bv2.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv2.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv2.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv2.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 56); do { } while (false); do { MOZ_CrashSequence(__null, 56); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 57 | ||||
| 58 | Vector<int, 42> iv; | |||
| 59 | MOZ_RELEASE_ASSERT(iv.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 59); do { } while (false); do { MOZ_CrashSequence(__null, 59); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 60 | ||||
| 61 | MOZ_RELEASE_ASSERT(iv.append(17))do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.append(17))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.append(17)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.append(17)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 61); do { } while (false); do { MOZ_CrashSequence(__null, 61); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 62 | MOZ_RELEASE_ASSERT(iv.reserved() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 62); do { } while (false); do { MOZ_CrashSequence(__null, 62); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 63 | ||||
| 64 | Vector<int, 42> otheriv; | |||
| 65 | MOZ_RELEASE_ASSERT(otheriv.append(42))do { static_assert( mozilla::detail::AssertionConditionType< decltype(otheriv.append(42))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(otheriv.append(42)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("otheriv.append(42)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 65); do { } while (false); do { MOZ_CrashSequence(__null, 65); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 66 | MOZ_RELEASE_ASSERT(otheriv.append(37))do { static_assert( mozilla::detail::AssertionConditionType< decltype(otheriv.append(37))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(otheriv.append(37)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("otheriv.append(37)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 66); do { } while (false); do { MOZ_CrashSequence(__null, 66); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 67 | MOZ_RELEASE_ASSERT(iv.appendAll(otheriv))do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.appendAll(otheriv))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.appendAll(otheriv)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("iv.appendAll(otheriv)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 67); do { } while (false); do { MOZ_CrashSequence(__null, 67); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 68 | MOZ_RELEASE_ASSERT(iv.reserved() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 68); do { } while (false); do { MOZ_CrashSequence(__null, 68); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 69 | ||||
| 70 | MOZ_RELEASE_ASSERT(iv.reserve(5))do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserve(5))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserve(5)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserve(5)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 70); do { } while (false); do { MOZ_CrashSequence(__null, 70); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 71 | MOZ_RELEASE_ASSERT(iv.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 71); do { } while (false); do { MOZ_CrashSequence(__null, 71); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 72 | ||||
| 73 | MOZ_RELEASE_ASSERT(iv.reserve(1))do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserve(1))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserve(1)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserve(1)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 73); do { } while (false); do { MOZ_CrashSequence(__null, 73); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 74 | MOZ_RELEASE_ASSERT(iv.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 74); do { } while (false); do { MOZ_CrashSequence(__null, 74); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 75 | ||||
| 76 | MOZ_RELEASE_ASSERT(iv.reserve(55))do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserve(55))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserve(55)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserve(55)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 76); do { } while (false); do { MOZ_CrashSequence(__null, 76); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 77 | MOZ_RELEASE_ASSERT(iv.reserved() == 55)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 55)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 55))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 55" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 77); do { } while (false); do { MOZ_CrashSequence(__null, 77); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 78 | ||||
| 79 | Vector<int, 42> iv2(std::move(iv)); | |||
| 80 | MOZ_RELEASE_ASSERT(iv.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 80); do { } while (false); do { MOZ_CrashSequence(__null, 80); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 81 | MOZ_RELEASE_ASSERT(iv2.reserved() == 55)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv2.reserved() == 55)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv2.reserved() == 55))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("iv2.reserved() == 55" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 81); do { } while (false); do { MOZ_CrashSequence(__null, 81); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 82 | ||||
| 83 | iv2.clearAndFree(); | |||
| 84 | MOZ_RELEASE_ASSERT(iv2.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(iv2.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(iv2.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("iv2.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 84); do { } while (false); do { MOZ_CrashSequence(__null, 84); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 85 | #endif | |||
| 86 | } | |||
| 87 | ||||
| 88 | void mozilla::detail::VectorTesting::testConstRange() { | |||
| 89 | #ifdef DEBUG1 | |||
| 90 | Vector<int> vec; | |||
| 91 | ||||
| 92 | for (int i = 0; i < 10; i++) { | |||
| 93 | MOZ_RELEASE_ASSERT(vec.append(i))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.append(i))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.append(i)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.append(i)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 93); do { } while (false); do { MOZ_CrashSequence(__null, 93); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 94 | } | |||
| 95 | ||||
| 96 | const auto& vecRef = vec; | |||
| 97 | ||||
| 98 | Vector<int>::ConstRange range = vecRef.all(); | |||
| 99 | for (int i = 0; i < 10; i++) { | |||
| 100 | MOZ_RELEASE_ASSERT(!range.empty())do { static_assert( mozilla::detail::AssertionConditionType< decltype(!range.empty())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!range.empty()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!range.empty()" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 100); do { } while (false); do { MOZ_CrashSequence(__null, 100); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 101 | MOZ_RELEASE_ASSERT(range.front() == i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(range.front() == i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(range.front() == i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("range.front() == i" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 101); do { } while (false); do { MOZ_CrashSequence(__null, 101); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 102 | range.popFront(); | |||
| 103 | } | |||
| 104 | #endif | |||
| 105 | } | |||
| 106 | ||||
| 107 | namespace { | |||
| 108 | ||||
| 109 | struct S { | |||
| 110 | size_t j; | |||
| 111 | UniquePtr<size_t> k; | |||
| 112 | ||||
| 113 | static size_t constructCount; | |||
| 114 | static size_t moveCount; | |||
| 115 | static size_t destructCount; | |||
| 116 | ||||
| 117 | static void resetCounts() { | |||
| 118 | constructCount = 0; | |||
| 119 | moveCount = 0; | |||
| 120 | destructCount = 0; | |||
| 121 | } | |||
| 122 | ||||
| 123 | S(size_t j, size_t k) : j(j), k(MakeUnique<size_t>(k)) { constructCount++; } | |||
| 124 | ||||
| 125 | S(S&& rhs) : j(rhs.j), k(std::move(rhs.k)) { | |||
| 126 | rhs.j = 0; | |||
| 127 | rhs.k.reset(nullptr); | |||
| 128 | moveCount++; | |||
| 129 | } | |||
| 130 | ||||
| 131 | ~S() { destructCount++; } | |||
| 132 | ||||
| 133 | S& operator=(S&& rhs) { | |||
| 134 | j = rhs.j; | |||
| 135 | rhs.j = 0; | |||
| 136 | k = std::move(rhs.k); | |||
| 137 | rhs.k.reset(); | |||
| 138 | moveCount++; | |||
| 139 | return *this; | |||
| 140 | } | |||
| 141 | ||||
| 142 | bool operator==(const S& rhs) const { return j == rhs.j && *k == *rhs.k; } | |||
| 143 | ||||
| 144 | S(const S&) = delete; | |||
| 145 | S& operator=(const S&) = delete; | |||
| 146 | }; | |||
| 147 | ||||
| 148 | size_t S::constructCount = 0; | |||
| 149 | size_t S::moveCount = 0; | |||
| 150 | size_t S::destructCount = 0; | |||
| 151 | ||||
| 152 | } // namespace | |||
| 153 | ||||
| 154 | void mozilla::detail::VectorTesting::testEmplaceBack() { | |||
| 155 | S::resetCounts(); | |||
| 156 | ||||
| 157 | Vector<S> vec; | |||
| 158 | MOZ_RELEASE_ASSERT(vec.reserve(20))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(20))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(20)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(20)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 158); do { } while (false); do { MOZ_CrashSequence(__null, 158); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 159 | ||||
| 160 | for (size_t i = 0; i < 10; i++) { | |||
| 161 | S s(i, i * i); | |||
| 162 | MOZ_RELEASE_ASSERT(vec.append(std::move(s)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.append(std::move(s)))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.append(std::move(s))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.append(std::move(s))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 162); do { } while (false); do { MOZ_CrashSequence(__null, 162); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 163 | } | |||
| 164 | ||||
| 165 | MOZ_RELEASE_ASSERT(vec.length() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 165); do { } while (false); do { MOZ_CrashSequence(__null, 165); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 166 | MOZ_RELEASE_ASSERT(S::constructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 166); do { } while (false); do { MOZ_CrashSequence(__null, 166); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 167 | MOZ_RELEASE_ASSERT(S::moveCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 167); do { } while (false); do { MOZ_CrashSequence(__null, 167); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 168 | ||||
| 169 | for (size_t i = 10; i < 20; i++) { | |||
| 170 | MOZ_RELEASE_ASSERT(vec.emplaceBack(i, i * i))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.emplaceBack(i, i * i))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.emplaceBack(i, i * i)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.emplaceBack(i, i * i)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 170); do { } while (false); do { MOZ_CrashSequence(__null, 170); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 171 | } | |||
| 172 | ||||
| 173 | MOZ_RELEASE_ASSERT(vec.length() == 20)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 20)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 20))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 20" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 173); do { } while (false); do { MOZ_CrashSequence(__null, 173); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 174 | MOZ_RELEASE_ASSERT(S::constructCount == 20)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 20)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 20))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 20" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 174); do { } while (false); do { MOZ_CrashSequence(__null, 174); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 175 | MOZ_RELEASE_ASSERT(S::moveCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 175); do { } while (false); do { MOZ_CrashSequence(__null, 175); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 176 | ||||
| 177 | for (size_t i = 0; i < 20; i++) { | |||
| 178 | MOZ_RELEASE_ASSERT(vec[i].j == i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[i].j == i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[i].j == i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec[i].j == i", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 178); do { } while (false); do { MOZ_CrashSequence(__null, 178); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 179 | MOZ_RELEASE_ASSERT(*vec[i].k == i * i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[i].k == i * i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[i].k == i * i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[i].k == i * i" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 179); do { } while (false); do { MOZ_CrashSequence(__null, 179); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 180 | } | |||
| 181 | } | |||
| 182 | ||||
| 183 | void mozilla::detail::VectorTesting::testReverse() { | |||
| 184 | // Use UniquePtr to make sure that reverse() can handler move-only types. | |||
| 185 | Vector<UniquePtr<uint8_t>, 0> vec; | |||
| 186 | ||||
| 187 | // Reverse an odd number of elements. | |||
| 188 | ||||
| 189 | for (uint8_t i = 0; i < 5; i++) { | |||
| 190 | auto p = MakeUnique<uint8_t>(i); | |||
| 191 | MOZ_RELEASE_ASSERT(p)do { static_assert( mozilla::detail::AssertionConditionType< decltype(p)>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(p))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("p", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 191); do { } while (false); do { MOZ_CrashSequence(__null, 191); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 192 | MOZ_RELEASE_ASSERT(vec.append(std::move(p)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.append(std::move(p)))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.append(std::move(p))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.append(std::move(p))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 192); do { } while (false); do { MOZ_CrashSequence(__null, 192); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 193 | } | |||
| 194 | ||||
| 195 | vec.reverse(); | |||
| 196 | ||||
| 197 | MOZ_RELEASE_ASSERT(*vec[0] == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[0] == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[0] == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[0] == 4", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 197); do { } while (false); do { MOZ_CrashSequence(__null, 197 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 198 | MOZ_RELEASE_ASSERT(*vec[1] == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[1] == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[1] == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[1] == 3", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 198); do { } while (false); do { MOZ_CrashSequence(__null, 198 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 199 | MOZ_RELEASE_ASSERT(*vec[2] == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[2] == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[2] == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[2] == 2", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 199); do { } while (false); do { MOZ_CrashSequence(__null, 199 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 200 | MOZ_RELEASE_ASSERT(*vec[3] == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[3] == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[3] == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[3] == 1", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 200); do { } while (false); do { MOZ_CrashSequence(__null, 200 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 201 | MOZ_RELEASE_ASSERT(*vec[4] == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[4] == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[4] == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[4] == 0", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 201); do { } while (false); do { MOZ_CrashSequence(__null, 201 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 202 | ||||
| 203 | // Reverse an even number of elements. | |||
| 204 | ||||
| 205 | vec.popBack(); | |||
| 206 | vec.reverse(); | |||
| 207 | ||||
| 208 | MOZ_RELEASE_ASSERT(*vec[0] == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[0] == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[0] == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[0] == 1", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 208); do { } while (false); do { MOZ_CrashSequence(__null, 208 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 209 | MOZ_RELEASE_ASSERT(*vec[1] == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[1] == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[1] == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[1] == 2", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 209); do { } while (false); do { MOZ_CrashSequence(__null, 209 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 210 | MOZ_RELEASE_ASSERT(*vec[2] == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[2] == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[2] == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[2] == 3", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 210); do { } while (false); do { MOZ_CrashSequence(__null, 210 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 211 | MOZ_RELEASE_ASSERT(*vec[3] == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec[3] == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec[3] == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec[3] == 4", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 211); do { } while (false); do { MOZ_CrashSequence(__null, 211 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 212 | ||||
| 213 | // Reverse an empty vector. | |||
| 214 | ||||
| 215 | vec.clear(); | |||
| 216 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 216); do { } while (false); do { MOZ_CrashSequence(__null, 216); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 217 | vec.reverse(); | |||
| 218 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 218); do { } while (false); do { MOZ_CrashSequence(__null, 218); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 219 | ||||
| 220 | // Reverse a vector using only inline storage. | |||
| 221 | ||||
| 222 | Vector<UniquePtr<uint8_t>, 5> vec2; | |||
| 223 | for (uint8_t i = 0; i < 5; i++) { | |||
| 224 | auto p = MakeUnique<uint8_t>(i); | |||
| 225 | MOZ_RELEASE_ASSERT(p)do { static_assert( mozilla::detail::AssertionConditionType< decltype(p)>::isValid, "invalid assertion condition"); if ( (__builtin_expect(!!(!(!!(p))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("p", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 225); do { } while (false); do { MOZ_CrashSequence(__null, 225); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 226 | MOZ_RELEASE_ASSERT(vec2.append(std::move(p)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec2.append(std::move(p)))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec2.append(std::move(p))))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec2.append(std::move(p))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 226); do { } while (false); do { MOZ_CrashSequence(__null, 226); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 227 | } | |||
| 228 | ||||
| 229 | vec2.reverse(); | |||
| 230 | ||||
| 231 | MOZ_RELEASE_ASSERT(*vec2[0] == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec2[0] == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec2[0] == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec2[0] == 4", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 231); do { } while (false); do { MOZ_CrashSequence(__null, 231); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 232 | MOZ_RELEASE_ASSERT(*vec2[1] == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec2[1] == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec2[1] == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec2[1] == 3", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 232); do { } while (false); do { MOZ_CrashSequence(__null, 232); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 233 | MOZ_RELEASE_ASSERT(*vec2[2] == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec2[2] == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec2[2] == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec2[2] == 2", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 233); do { } while (false); do { MOZ_CrashSequence(__null, 233); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 234 | MOZ_RELEASE_ASSERT(*vec2[3] == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec2[3] == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec2[3] == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec2[3] == 1", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 234); do { } while (false); do { MOZ_CrashSequence(__null, 234); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 235 | MOZ_RELEASE_ASSERT(*vec2[4] == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*vec2[4] == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*vec2[4] == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*vec2[4] == 0", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 235); do { } while (false); do { MOZ_CrashSequence(__null, 235); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 236 | } | |||
| 237 | ||||
| 238 | void mozilla::detail::VectorTesting::testExtractRawBuffer() { | |||
| 239 | S::resetCounts(); | |||
| 240 | ||||
| 241 | Vector<S, 5> vec; | |||
| 242 | MOZ_RELEASE_ASSERT(vec.reserve(5))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(5))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(5)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(5)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 242); do { } while (false); do { MOZ_CrashSequence(__null, 242); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 243 | for (size_t i = 0; i < 5; i++) { | |||
| 244 | vec.infallibleEmplaceBack(i, i * i); | |||
| 245 | } | |||
| 246 | MOZ_RELEASE_ASSERT(vec.length() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 246); do { } while (false); do { MOZ_CrashSequence(__null, 246); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 247 | MOZ_ASSERT(vec.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 247); do { } while (false); do { MOZ_CrashSequence(__null, 247); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 248 | MOZ_RELEASE_ASSERT(S::constructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 5))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 248); do { } while (false); do { MOZ_CrashSequence(__null, 248); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 249 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 249); do { } while (false); do { MOZ_CrashSequence(__null, 249); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 250 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 250); do { } while (false); do { MOZ_CrashSequence(__null, 250); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 251 | ||||
| 252 | S* buf = vec.extractRawBuffer(); | |||
| 253 | MOZ_RELEASE_ASSERT(!buf)do { static_assert( mozilla::detail::AssertionConditionType< decltype(!buf)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(!buf))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("!buf", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 253); do { } while (false); do { MOZ_CrashSequence(__null, 253 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 254 | MOZ_RELEASE_ASSERT(vec.length() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 254); do { } while (false); do { MOZ_CrashSequence(__null, 254); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 255 | MOZ_ASSERT(vec.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 255); do { } while (false); do { MOZ_CrashSequence(__null, 255); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 256 | MOZ_RELEASE_ASSERT(S::constructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 5))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 256); do { } while (false); do { MOZ_CrashSequence(__null, 256); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 257 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 257); do { } while (false); do { MOZ_CrashSequence(__null, 257); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 258 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 258); do { } while (false); do { MOZ_CrashSequence(__null, 258); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 259 | ||||
| 260 | MOZ_RELEASE_ASSERT(vec.reserve(10))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(10))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(10)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(10)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 260); do { } while (false); do { MOZ_CrashSequence(__null, 260); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 261 | for (size_t i = 5; i < 10; i++) { | |||
| 262 | vec.infallibleEmplaceBack(i, i * i); | |||
| 263 | } | |||
| 264 | MOZ_RELEASE_ASSERT(vec.length() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 264); do { } while (false); do { MOZ_CrashSequence(__null, 264); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 265 | MOZ_ASSERT(vec.reserved() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 10))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 265); do { } while (false); do { MOZ_CrashSequence(__null, 265); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 266 | MOZ_RELEASE_ASSERT(S::constructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 266); do { } while (false); do { MOZ_CrashSequence(__null, 266); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 267 | MOZ_RELEASE_ASSERT(S::moveCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 267); do { } while (false); do { MOZ_CrashSequence(__null, 267); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 268 | MOZ_RELEASE_ASSERT(S::destructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 5))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 268); do { } while (false); do { MOZ_CrashSequence(__null, 268); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 269 | ||||
| 270 | buf = vec.extractRawBuffer(); | |||
| 271 | MOZ_RELEASE_ASSERT(buf)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(buf))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("buf", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 271); do { } while (false); do { MOZ_CrashSequence(__null, 271 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 272 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 272); do { } while (false); do { MOZ_CrashSequence(__null, 272); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 273 | MOZ_ASSERT(vec.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 273); do { } while (false); do { MOZ_CrashSequence(__null, 273); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 274 | MOZ_RELEASE_ASSERT(S::constructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 274); do { } while (false); do { MOZ_CrashSequence(__null, 274); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 275 | MOZ_RELEASE_ASSERT(S::moveCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 275); do { } while (false); do { MOZ_CrashSequence(__null, 275); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 276 | MOZ_RELEASE_ASSERT(S::destructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 5))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 276); do { } while (false); do { MOZ_CrashSequence(__null, 276); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 277 | ||||
| 278 | for (size_t i = 0; i < 10; i++) { | |||
| 279 | MOZ_RELEASE_ASSERT(buf[i].j == i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf[i].j == i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(buf[i].j == i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("buf[i].j == i", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 279); do { } while (false); do { MOZ_CrashSequence(__null, 279); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 280 | MOZ_RELEASE_ASSERT(*buf[i].k == i * i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*buf[i].k == i * i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*buf[i].k == i * i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*buf[i].k == i * i" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 280); do { } while (false); do { MOZ_CrashSequence(__null, 280); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 281 | } | |||
| 282 | ||||
| 283 | free(buf); | |||
| 284 | } | |||
| 285 | ||||
| 286 | void mozilla::detail::VectorTesting::testExtractOrCopyRawBuffer() { | |||
| 287 | S::resetCounts(); | |||
| 288 | ||||
| 289 | Vector<S, 5> vec; | |||
| 290 | MOZ_RELEASE_ASSERT(vec.reserve(5))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(5))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(5)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(5)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 290); do { } while (false); do { MOZ_CrashSequence(__null, 290); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 291 | for (size_t i = 0; i < 5; i++) { | |||
| 292 | vec.infallibleEmplaceBack(i, i * i); | |||
| 293 | } | |||
| 294 | MOZ_RELEASE_ASSERT(vec.length() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 294); do { } while (false); do { MOZ_CrashSequence(__null, 294); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 295 | MOZ_ASSERT(vec.reserved() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 295); do { } while (false); do { MOZ_CrashSequence(__null, 295); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 296 | MOZ_RELEASE_ASSERT(S::constructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 5))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 296); do { } while (false); do { MOZ_CrashSequence(__null, 296); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 297 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 297); do { } while (false); do { MOZ_CrashSequence(__null, 297); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 298 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 298); do { } while (false); do { MOZ_CrashSequence(__null, 298); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 299 | ||||
| 300 | S* buf = vec.extractOrCopyRawBuffer(); | |||
| 301 | MOZ_RELEASE_ASSERT(buf)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(buf))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("buf", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 301); do { } while (false); do { MOZ_CrashSequence(__null, 301 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 302 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 302); do { } while (false); do { MOZ_CrashSequence(__null, 302); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 303 | MOZ_ASSERT(vec.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 303); do { } while (false); do { MOZ_CrashSequence(__null, 303); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 304 | MOZ_RELEASE_ASSERT(S::constructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 5))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 304); do { } while (false); do { MOZ_CrashSequence(__null, 304); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 305 | MOZ_RELEASE_ASSERT(S::moveCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 305); do { } while (false); do { MOZ_CrashSequence(__null, 305); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 306 | MOZ_RELEASE_ASSERT(S::destructCount == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 5))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 306); do { } while (false); do { MOZ_CrashSequence(__null, 306); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 307 | ||||
| 308 | for (size_t i = 0; i < 5; i++) { | |||
| 309 | MOZ_RELEASE_ASSERT(buf[i].j == i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf[i].j == i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(buf[i].j == i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("buf[i].j == i", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 309); do { } while (false); do { MOZ_CrashSequence(__null, 309); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 310 | MOZ_RELEASE_ASSERT(*buf[i].k == i * i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*buf[i].k == i * i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*buf[i].k == i * i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*buf[i].k == i * i" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 310); do { } while (false); do { MOZ_CrashSequence(__null, 310); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 311 | } | |||
| 312 | ||||
| 313 | S::resetCounts(); | |||
| 314 | ||||
| 315 | MOZ_RELEASE_ASSERT(vec.reserve(10))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(10))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(10)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(10)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 315); do { } while (false); do { MOZ_CrashSequence(__null, 315); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 316 | for (size_t i = 0; i < 10; i++) { | |||
| 317 | vec.infallibleEmplaceBack(i, i * i); | |||
| 318 | } | |||
| 319 | MOZ_RELEASE_ASSERT(vec.length() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 319); do { } while (false); do { MOZ_CrashSequence(__null, 319); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 320 | MOZ_ASSERT(vec.reserved() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 10))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 320); do { } while (false); do { MOZ_CrashSequence(__null, 320); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 321 | MOZ_RELEASE_ASSERT(S::constructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 321); do { } while (false); do { MOZ_CrashSequence(__null, 321); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 322 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 322); do { } while (false); do { MOZ_CrashSequence(__null, 322); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 323 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 323); do { } while (false); do { MOZ_CrashSequence(__null, 323); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 324 | ||||
| 325 | buf = vec.extractOrCopyRawBuffer(); | |||
| 326 | MOZ_RELEASE_ASSERT(buf)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(buf))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("buf", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 326); do { } while (false); do { MOZ_CrashSequence(__null, 326 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 327 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 327); do { } while (false); do { MOZ_CrashSequence(__null, 327); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 328 | MOZ_ASSERT(vec.reserved() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 328); do { } while (false); do { MOZ_CrashSequence(__null, 328); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 329 | MOZ_RELEASE_ASSERT(S::constructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 329); do { } while (false); do { MOZ_CrashSequence(__null, 329); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 330 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 330); do { } while (false); do { MOZ_CrashSequence(__null, 330); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 331 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 331); do { } while (false); do { MOZ_CrashSequence(__null, 331); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 332 | ||||
| 333 | for (size_t i = 0; i < 10; i++) { | |||
| 334 | MOZ_RELEASE_ASSERT(buf[i].j == i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(buf[i].j == i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(buf[i].j == i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("buf[i].j == i", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 334); do { } while (false); do { MOZ_CrashSequence(__null, 334); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 335 | MOZ_RELEASE_ASSERT(*buf[i].k == i * i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*buf[i].k == i * i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*buf[i].k == i * i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*buf[i].k == i * i" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 335); do { } while (false); do { MOZ_CrashSequence(__null, 335); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 336 | } | |||
| 337 | ||||
| 338 | free(buf); | |||
| 339 | } | |||
| 340 | ||||
| 341 | void mozilla::detail::VectorTesting::testReplaceRawBuffer() { | |||
| 342 | S::resetCounts(); | |||
| 343 | ||||
| 344 | S* s = nullptr; | |||
| 345 | ||||
| 346 | { | |||
| 347 | Vector<S> v; | |||
| 348 | MOZ_RELEASE_ASSERT(v.reserve(4))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserve(4))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserve(4)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserve(4)", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 348); do { } while (false); do { MOZ_CrashSequence(__null, 348 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 349 | v.infallibleEmplaceBack(1, 2); | |||
| 350 | v.infallibleEmplaceBack(3, 4); | |||
| 351 | MOZ_RELEASE_ASSERT(S::constructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 2))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 351); do { } while (false); do { MOZ_CrashSequence(__null, 351); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 352 | s = v.extractRawBuffer(); | |||
| 353 | } | |||
| 354 | ||||
| 355 | MOZ_RELEASE_ASSERT(S::constructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 2))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 355); do { } while (false); do { MOZ_CrashSequence(__null, 355); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 356 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 356); do { } while (false); do { MOZ_CrashSequence(__null, 356); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 357 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 357); do { } while (false); do { MOZ_CrashSequence(__null, 357); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 358 | ||||
| 359 | { | |||
| 360 | Vector<S, 10> v; | |||
| 361 | v.replaceRawBuffer(s, 2); | |||
| 362 | MOZ_ASSERT(v.reserved() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 362); do { } while (false); do { MOZ_CrashSequence(__null, 362); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 363 | MOZ_RELEASE_ASSERT(v.length() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 363); do { } while (false); do { MOZ_CrashSequence(__null, 363); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 364 | MOZ_RELEASE_ASSERT(v.capacity() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 364); do { } while (false); do { MOZ_CrashSequence(__null, 364); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 365 | MOZ_RELEASE_ASSERT(v[0].j == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v[0].j == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v[0].j == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v[0].j == 1", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 365); do { } while (false); do { MOZ_CrashSequence(__null, 365 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 366 | MOZ_RELEASE_ASSERT(v[1].j == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v[1].j == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v[1].j == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v[1].j == 3", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 366); do { } while (false); do { MOZ_CrashSequence(__null, 366 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 367 | MOZ_RELEASE_ASSERT(S::destructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 2))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 367); do { } while (false); do { MOZ_CrashSequence(__null, 367); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 368 | } | |||
| 369 | ||||
| 370 | MOZ_RELEASE_ASSERT(S::constructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 2))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 370); do { } while (false); do { MOZ_CrashSequence(__null, 370); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 371 | MOZ_RELEASE_ASSERT(S::moveCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 371); do { } while (false); do { MOZ_CrashSequence(__null, 371); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 372 | MOZ_RELEASE_ASSERT(S::destructCount == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 4))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 372); do { } while (false); do { MOZ_CrashSequence(__null, 372); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 373 | ||||
| 374 | S::resetCounts(); | |||
| 375 | ||||
| 376 | { | |||
| 377 | Vector<S, 2> v; | |||
| 378 | MOZ_RELEASE_ASSERT(v.reserve(4))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserve(4))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserve(4)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserve(4)", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 378); do { } while (false); do { MOZ_CrashSequence(__null, 378 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 379 | v.infallibleEmplaceBack(9, 10); | |||
| 380 | MOZ_RELEASE_ASSERT(S::constructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 1))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 380); do { } while (false); do { MOZ_CrashSequence(__null, 380); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 381 | s = v.extractRawBuffer(); | |||
| 382 | MOZ_RELEASE_ASSERT(S::constructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 1))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 382); do { } while (false); do { MOZ_CrashSequence(__null, 382); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 383 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 383); do { } while (false); do { MOZ_CrashSequence(__null, 383); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 384 | } | |||
| 385 | ||||
| 386 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 386); do { } while (false); do { MOZ_CrashSequence(__null, 386); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 387 | ||||
| 388 | { | |||
| 389 | Vector<S> v; | |||
| 390 | v.replaceRawBuffer(s, 1, 4); | |||
| 391 | MOZ_ASSERT(v.reserved() == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 391); do { } while (false); do { MOZ_CrashSequence(__null, 391); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 392 | MOZ_RELEASE_ASSERT(v.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 392); do { } while (false); do { MOZ_CrashSequence(__null, 392); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 393 | MOZ_RELEASE_ASSERT(v.capacity() == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 393); do { } while (false); do { MOZ_CrashSequence(__null, 393); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 394 | MOZ_RELEASE_ASSERT(v[0].j == 9)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v[0].j == 9)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v[0].j == 9))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v[0].j == 9", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 394); do { } while (false); do { MOZ_CrashSequence(__null, 394 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 395 | for (size_t i = 0; i < 5; i++) MOZ_RELEASE_ASSERT(v.emplaceBack(i, i))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.emplaceBack(i, i))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.emplaceBack(i, i)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.emplaceBack(i, i)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 395); do { } while (false); do { MOZ_CrashSequence(__null, 395); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 396 | MOZ_ASSERT(v.reserved() == 6)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 6)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 6))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 6" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 396); do { } while (false); do { MOZ_CrashSequence(__null, 396); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 397 | MOZ_RELEASE_ASSERT(v.length() == 6)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 6)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 6))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 6" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 397); do { } while (false); do { MOZ_CrashSequence(__null, 397); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 398 | MOZ_RELEASE_ASSERT(S::constructCount == 6)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 6)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 6))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 6" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 398); do { } while (false); do { MOZ_CrashSequence(__null, 398); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 399 | MOZ_RELEASE_ASSERT(S::moveCount == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 399); do { } while (false); do { MOZ_CrashSequence(__null, 399); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 400 | MOZ_RELEASE_ASSERT(S::destructCount == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 4))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 400); do { } while (false); do { MOZ_CrashSequence(__null, 400); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 401 | } | |||
| 402 | ||||
| 403 | MOZ_RELEASE_ASSERT(S::destructCount == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 403); do { } while (false); do { MOZ_CrashSequence(__null, 403); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 404 | } | |||
| 405 | ||||
| 406 | void mozilla::detail::VectorTesting::testInsert() { | |||
| 407 | S::resetCounts(); | |||
| 408 | ||||
| 409 | Vector<S, 8> vec; | |||
| 410 | MOZ_RELEASE_ASSERT(vec.reserve(8))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(8))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(8)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(8)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 410); do { } while (false); do { MOZ_CrashSequence(__null, 410); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 411 | for (size_t i = 0; i < 7; i++) { | |||
| 412 | vec.infallibleEmplaceBack(i, i * i); | |||
| 413 | } | |||
| 414 | ||||
| 415 | MOZ_RELEASE_ASSERT(vec.length() == 7)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 7)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 7))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 7" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 415); do { } while (false); do { MOZ_CrashSequence(__null, 415); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 416 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 416); do { } while (false); do { MOZ_CrashSequence(__null, 416); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 417 | MOZ_RELEASE_ASSERT(S::constructCount == 7)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 7)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 7))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 7" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 417); do { } while (false); do { MOZ_CrashSequence(__null, 417); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 418 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 418); do { } while (false); do { MOZ_CrashSequence(__null, 418); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 419 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 419); do { } while (false); do { MOZ_CrashSequence(__null, 419); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 420 | ||||
| 421 | S s(42, 43); | |||
| 422 | MOZ_RELEASE_ASSERT(vec.insert(vec.begin() + 4, std::move(s)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.insert(vec.begin() + 4, std::move(s)))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(vec.insert(vec.begin() + 4, std::move(s))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.insert(vec.begin() + 4, std::move(s))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 422); do { } while (false); do { MOZ_CrashSequence(__null, 422); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 423 | ||||
| 424 | for (size_t i = 0; i < vec.length(); i++) { | |||
| 425 | const S& s = vec[i]; | |||
| 426 | MOZ_RELEASE_ASSERT(s.k)do { static_assert( mozilla::detail::AssertionConditionType< decltype(s.k)>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(!!(s.k))), 0))) { do { } while (false ); MOZ_ReportAssertionFailure("s.k", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 426); do { } while (false); do { MOZ_CrashSequence(__null, 426 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 427 | if (i < 4) { | |||
| 428 | MOZ_RELEASE_ASSERT(s.j == i && *s.k == i * i)do { static_assert( mozilla::detail::AssertionConditionType< decltype(s.j == i && *s.k == i * i)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(s.j == i && *s.k == i * i))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("s.j == i && *s.k == i * i", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 428); do { } while (false); do { MOZ_CrashSequence(__null, 428 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 429 | } else if (i == 4) { | |||
| 430 | MOZ_RELEASE_ASSERT(s.j == 42 && *s.k == 43)do { static_assert( mozilla::detail::AssertionConditionType< decltype(s.j == 42 && *s.k == 43)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(s.j == 42 && *s.k == 43))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("s.j == 42 && *s.k == 43", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 430); do { } while (false); do { MOZ_CrashSequence(__null, 430 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 431 | } else { | |||
| 432 | MOZ_RELEASE_ASSERT(s.j == i - 1 && *s.k == (i - 1) * (i - 1))do { static_assert( mozilla::detail::AssertionConditionType< decltype(s.j == i - 1 && *s.k == (i - 1) * (i - 1))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(s.j == i - 1 && *s.k == (i - 1) * (i - 1)))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("s.j == i - 1 && *s.k == (i - 1) * (i - 1)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 432); do { } while (false); do { MOZ_CrashSequence(__null, 432); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 433 | } | |||
| 434 | } | |||
| 435 | ||||
| 436 | MOZ_RELEASE_ASSERT(vec.length() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 436); do { } while (false); do { MOZ_CrashSequence(__null, 436); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 437 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 437); do { } while (false); do { MOZ_CrashSequence(__null, 437); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 438 | MOZ_RELEASE_ASSERT(S::constructCount == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 8))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 438); do { } while (false); do { MOZ_CrashSequence(__null, 438); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 439 | MOZ_RELEASE_ASSERT(S::moveCount == 1 /* move in insert() call */ +do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1 + 1 + 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1 + 1 + 3))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1 + 1 + 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 441); do { } while (false); do { MOZ_CrashSequence(__null, 441); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 440 | 1 /* move the back() element */ +do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1 + 1 + 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1 + 1 + 3))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1 + 1 + 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 441); do { } while (false); do { MOZ_CrashSequence(__null, 441); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 441 | 3 /* elements to shift */)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1 + 1 + 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1 + 1 + 3))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1 + 1 + 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 441); do { } while (false); do { MOZ_CrashSequence(__null, 441); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 442 | MOZ_RELEASE_ASSERT(S::destructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 1))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 442); do { } while (false); do { MOZ_CrashSequence(__null, 442); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 443 | } | |||
| 444 | ||||
| 445 | void mozilla::detail::VectorTesting::testErase() { | |||
| 446 | S::resetCounts(); | |||
| 447 | ||||
| 448 | Vector<S, 8> vec; | |||
| 449 | MOZ_RELEASE_ASSERT(vec.reserve(8))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserve(8))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserve(8)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserve(8)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 449); do { } while (false); do { MOZ_CrashSequence(__null, 449); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 450 | for (size_t i = 0; i < 7; i++) { | |||
| 451 | vec.infallibleEmplaceBack(i, i * i); | |||
| 452 | } | |||
| 453 | ||||
| 454 | // vec: [0, 1, 2, 3, 4, 5, 6] | |||
| 455 | MOZ_RELEASE_ASSERT(vec.length() == 7)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 7)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 7))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 7" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 455); do { } while (false); do { MOZ_CrashSequence(__null, 455); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 456 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 456); do { } while (false); do { MOZ_CrashSequence(__null, 456); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 457 | MOZ_RELEASE_ASSERT(S::constructCount == 7)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 7)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 7))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 7" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 457); do { } while (false); do { MOZ_CrashSequence(__null, 457); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 458 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 458); do { } while (false); do { MOZ_CrashSequence(__null, 458); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 459 | MOZ_RELEASE_ASSERT(S::destructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 459); do { } while (false); do { MOZ_CrashSequence(__null, 459); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 460 | S::resetCounts(); | |||
| 461 | ||||
| 462 | vec.erase(&vec[4]); | |||
| 463 | // vec: [0, 1, 2, 3, 5, 6] | |||
| 464 | MOZ_RELEASE_ASSERT(vec.length() == 6)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 6)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 6))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 6" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 464); do { } while (false); do { MOZ_CrashSequence(__null, 464); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 465 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 465); do { } while (false); do { MOZ_CrashSequence(__null, 465); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 466 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 466); do { } while (false); do { MOZ_CrashSequence(__null, 466); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 467 | // 5 and 6 should have been moved into 4 and 5. | |||
| 468 | MOZ_RELEASE_ASSERT(S::moveCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 468); do { } while (false); do { MOZ_CrashSequence(__null, 468); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 469 | MOZ_RELEASE_ASSERT(S::destructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 1))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 469); do { } while (false); do { MOZ_CrashSequence(__null, 469); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 470 | MOZ_RELEASE_ASSERT(vec[4] == S(5, 5 * 5))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[4] == S(5, 5 * 5))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[4] == S(5, 5 * 5)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vec[4] == S(5, 5 * 5)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 470); do { } while (false); do { MOZ_CrashSequence(__null, 470); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 471 | MOZ_RELEASE_ASSERT(vec[5] == S(6, 6 * 6))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[5] == S(6, 6 * 6))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[5] == S(6, 6 * 6)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vec[5] == S(6, 6 * 6)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 471); do { } while (false); do { MOZ_CrashSequence(__null, 471); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 472 | S::resetCounts(); | |||
| 473 | ||||
| 474 | vec.erase(&vec[3], &vec[5]); | |||
| 475 | // vec: [0, 1, 2, 6] | |||
| 476 | MOZ_RELEASE_ASSERT(vec.length() == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 476); do { } while (false); do { MOZ_CrashSequence(__null, 476); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 477 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 477); do { } while (false); do { MOZ_CrashSequence(__null, 477); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 478 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 478); do { } while (false); do { MOZ_CrashSequence(__null, 478); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 479 | // 6 should have been moved into 3. | |||
| 480 | MOZ_RELEASE_ASSERT(S::moveCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 480); do { } while (false); do { MOZ_CrashSequence(__null, 480); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 481 | MOZ_RELEASE_ASSERT(S::destructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 2))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 481); do { } while (false); do { MOZ_CrashSequence(__null, 481); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 482 | MOZ_RELEASE_ASSERT(vec[3] == S(6, 6 * 6))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[3] == S(6, 6 * 6))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[3] == S(6, 6 * 6)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vec[3] == S(6, 6 * 6)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 482); do { } while (false); do { MOZ_CrashSequence(__null, 482); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 483 | ||||
| 484 | S s2(2, 2 * 2); | |||
| 485 | S::resetCounts(); | |||
| 486 | ||||
| 487 | vec.eraseIfEqual(s2); | |||
| 488 | // vec: [0, 1, 6] | |||
| 489 | MOZ_RELEASE_ASSERT(vec.length() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 489); do { } while (false); do { MOZ_CrashSequence(__null, 489); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 490 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 490); do { } while (false); do { MOZ_CrashSequence(__null, 490); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 491 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 491); do { } while (false); do { MOZ_CrashSequence(__null, 491); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 492 | // 6 should have been moved into 2. | |||
| 493 | MOZ_RELEASE_ASSERT(S::moveCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 493); do { } while (false); do { MOZ_CrashSequence(__null, 493); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 494 | MOZ_RELEASE_ASSERT(S::destructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 1))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 494); do { } while (false); do { MOZ_CrashSequence(__null, 494); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 495 | MOZ_RELEASE_ASSERT(vec[2] == S(6, 6 * 6))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[2] == S(6, 6 * 6))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[2] == S(6, 6 * 6)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vec[2] == S(6, 6 * 6)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 495); do { } while (false); do { MOZ_CrashSequence(__null, 495); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 496 | S::resetCounts(); | |||
| 497 | ||||
| 498 | // Predicate to find one element. | |||
| 499 | vec.eraseIf([](const S& s) { return s.j == 1; }); | |||
| 500 | // vec: [0, 6] | |||
| 501 | MOZ_RELEASE_ASSERT(vec.length() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 501); do { } while (false); do { MOZ_CrashSequence(__null, 501); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 502 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 502); do { } while (false); do { MOZ_CrashSequence(__null, 502); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 503 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 503); do { } while (false); do { MOZ_CrashSequence(__null, 503); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 504 | // 6 should have been moved into 1. | |||
| 505 | MOZ_RELEASE_ASSERT(S::moveCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 505); do { } while (false); do { MOZ_CrashSequence(__null, 505); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 506 | MOZ_RELEASE_ASSERT(S::destructCount == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 1))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 506); do { } while (false); do { MOZ_CrashSequence(__null, 506); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 507 | MOZ_RELEASE_ASSERT(vec[1] == S(6, 6 * 6))do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec[1] == S(6, 6 * 6))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec[1] == S(6, 6 * 6)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vec[1] == S(6, 6 * 6)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 507); do { } while (false); do { MOZ_CrashSequence(__null, 507); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 508 | S::resetCounts(); | |||
| 509 | ||||
| 510 | // Generic predicate that flags everything. | |||
| 511 | vec.eraseIf([](auto&&) { return true; }); | |||
| 512 | // vec: [] | |||
| 513 | MOZ_RELEASE_ASSERT(vec.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 513); do { } while (false); do { MOZ_CrashSequence(__null, 513); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 514 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 514); do { } while (false); do { MOZ_CrashSequence(__null, 514); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 515 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 515); do { } while (false); do { MOZ_CrashSequence(__null, 515); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 516 | MOZ_RELEASE_ASSERT(S::moveCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 516); do { } while (false); do { MOZ_CrashSequence(__null, 516); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 517 | MOZ_RELEASE_ASSERT(S::destructCount == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 2))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 517); do { } while (false); do { MOZ_CrashSequence(__null, 517); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 518 | ||||
| 519 | for (size_t i = 0; i < 7; i++) { | |||
| 520 | vec.infallibleEmplaceBack(i, i * i); | |||
| 521 | } | |||
| 522 | // vec: [0, 1, 2, 3, 4, 5, 6] | |||
| 523 | MOZ_RELEASE_ASSERT(vec.length() == 7)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 7)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 7))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 7" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 523); do { } while (false); do { MOZ_CrashSequence(__null, 523); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 524 | S::resetCounts(); | |||
| 525 | ||||
| 526 | // Predicate that flags all even numbers. | |||
| 527 | vec.eraseIf([](const S& s) { return s.j % 2 == 0; }); | |||
| 528 | // vec: [1 (was 0), 3 (was 1), 5 (was 2)] | |||
| 529 | MOZ_RELEASE_ASSERT(vec.length() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.length() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.length() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.length() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 529); do { } while (false); do { MOZ_CrashSequence(__null, 529); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 530 | MOZ_ASSERT(vec.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vec.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vec.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vec.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 530); do { } while (false); do { MOZ_CrashSequence(__null, 530); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 531 | MOZ_RELEASE_ASSERT(S::constructCount == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::constructCount == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::constructCount == 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("S::constructCount == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 531); do { } while (false); do { MOZ_CrashSequence(__null, 531); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 532 | MOZ_RELEASE_ASSERT(S::moveCount == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::moveCount == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::moveCount == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("S::moveCount == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 532); do { } while (false); do { MOZ_CrashSequence(__null, 532); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 533 | MOZ_RELEASE_ASSERT(S::destructCount == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(S::destructCount == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(S::destructCount == 4))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("S::destructCount == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 533); do { } while (false); do { MOZ_CrashSequence(__null, 533); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 534 | } | |||
| 535 | ||||
| 536 | void mozilla::detail::VectorTesting::testShrinkStorageToFit() { | |||
| 537 | // Vectors not using inline storage realloc capacity to exact length. | |||
| 538 | { | |||
| 539 | Vector<int, 0> v1; | |||
| 540 | MOZ_RELEASE_ASSERT(v1.reserve(10))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.reserve(10))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.reserve(10)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.reserve(10)" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 540); do { } while (false); do { MOZ_CrashSequence(__null, 540); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 541 | v1.infallibleAppend(1); | |||
| 542 | MOZ_ASSERT(v1.reserved() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.reserved() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.reserved() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.reserved() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 542); do { } while (false); do { MOZ_CrashSequence(__null, 542); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 543 | MOZ_RELEASE_ASSERT(v1.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 543); do { } while (false); do { MOZ_CrashSequence(__null, 543); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 544 | MOZ_RELEASE_ASSERT(v1.capacity() >= 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.capacity() >= 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.capacity() >= 10))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("v1.capacity() >= 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 544); do { } while (false); do { MOZ_CrashSequence(__null, 544); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 545 | v1.shrinkStorageToFit(); | |||
| 546 | MOZ_ASSERT(v1.reserved() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.reserved() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.reserved() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.reserved() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 546); do { } while (false); do { MOZ_CrashSequence(__null, 546); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 547 | MOZ_RELEASE_ASSERT(v1.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 547); do { } while (false); do { MOZ_CrashSequence(__null, 547); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 548 | MOZ_RELEASE_ASSERT(v1.capacity() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v1.capacity() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v1.capacity() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v1.capacity() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 548); do { } while (false); do { MOZ_CrashSequence(__null, 548); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 549 | } | |||
| 550 | ||||
| 551 | // Vectors using inline storage do nothing. | |||
| 552 | { | |||
| 553 | Vector<int, 2> v2; | |||
| 554 | MOZ_RELEASE_ASSERT(v2.reserve(2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.reserve(2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.reserve(2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.reserve(2)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 554); do { } while (false); do { MOZ_CrashSequence(__null, 554); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 555 | v2.infallibleAppend(1); | |||
| 556 | MOZ_ASSERT(v2.reserved() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.reserved() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.reserved() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.reserved() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 556); do { } while (false); do { MOZ_CrashSequence(__null, 556); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 557 | MOZ_RELEASE_ASSERT(v2.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 557); do { } while (false); do { MOZ_CrashSequence(__null, 557); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 558 | MOZ_RELEASE_ASSERT(v2.capacity() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.capacity() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.capacity() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.capacity() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 558); do { } while (false); do { MOZ_CrashSequence(__null, 558); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 559 | v2.shrinkStorageToFit(); | |||
| 560 | MOZ_ASSERT(v2.reserved() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.reserved() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.reserved() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.reserved() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 560); do { } while (false); do { MOZ_CrashSequence(__null, 560); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 561 | MOZ_RELEASE_ASSERT(v2.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 561); do { } while (false); do { MOZ_CrashSequence(__null, 561); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 562 | MOZ_RELEASE_ASSERT(v2.capacity() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v2.capacity() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v2.capacity() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v2.capacity() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 562); do { } while (false); do { MOZ_CrashSequence(__null, 562); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 563 | } | |||
| 564 | ||||
| 565 | // shrinkStorageToFit uses inline storage if possible. | |||
| 566 | { | |||
| 567 | Vector<int, 2> v; | |||
| 568 | MOZ_RELEASE_ASSERT(v.reserve(4))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserve(4))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserve(4)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserve(4)", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 568); do { } while (false); do { MOZ_CrashSequence(__null, 568 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 569 | v.infallibleAppend(1); | |||
| 570 | MOZ_ASSERT(v.reserved() == 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 4))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 570); do { } while (false); do { MOZ_CrashSequence(__null, 570); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 571 | MOZ_RELEASE_ASSERT(v.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 571); do { } while (false); do { MOZ_CrashSequence(__null, 571); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 572 | MOZ_RELEASE_ASSERT(v.capacity() >= 4)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() >= 4)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() >= 4))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() >= 4" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 572); do { } while (false); do { MOZ_CrashSequence(__null, 572); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 573 | v.shrinkStorageToFit(); | |||
| 574 | MOZ_ASSERT(v.reserved() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 574); do { } while (false); do { MOZ_CrashSequence(__null, 574); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 575 | MOZ_RELEASE_ASSERT(v.length() == 1)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 1)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 1))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 1" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 575); do { } while (false); do { MOZ_CrashSequence(__null, 575); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 576 | MOZ_RELEASE_ASSERT(v.capacity() == 2)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() == 2)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() == 2))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() == 2" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 576); do { } while (false); do { MOZ_CrashSequence(__null, 576); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 577 | } | |||
| 578 | ||||
| 579 | // Non-pod shrinking to non-inline storage. | |||
| 580 | { | |||
| 581 | static size_t sConstructCounter = 0; | |||
| 582 | static size_t sCopyCounter = 0; | |||
| 583 | static size_t sMoveCounter = 0; | |||
| 584 | static size_t sDestroyCounter = 0; | |||
| 585 | struct NonPod { | |||
| 586 | int mSomething = 10; | |||
| 587 | ||||
| 588 | NonPod() { sConstructCounter++; } | |||
| 589 | ||||
| 590 | NonPod(const NonPod& aOther) : mSomething(aOther.mSomething) { | |||
| 591 | sCopyCounter++; | |||
| 592 | } | |||
| 593 | NonPod(NonPod&& aOther) : mSomething(aOther.mSomething) { | |||
| 594 | sMoveCounter++; | |||
| 595 | } | |||
| 596 | ~NonPod() { sDestroyCounter++; } | |||
| 597 | }; | |||
| 598 | ||||
| 599 | Vector<NonPod, 5> v; | |||
| 600 | MOZ_RELEASE_ASSERT(v.reserve(10))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserve(10))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserve(10)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserve(10)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 600); do { } while (false); do { MOZ_CrashSequence(__null, 600); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 601 | for (size_t i = 0; i < 8; ++i) { | |||
| 602 | v.infallibleEmplaceBack(); | |||
| 603 | } | |||
| 604 | MOZ_RELEASE_ASSERT(sConstructCounter == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sConstructCounter == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sConstructCounter == 8))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("sConstructCounter == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 604); do { } while (false); do { MOZ_CrashSequence(__null, 604); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 605 | MOZ_RELEASE_ASSERT(sCopyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sCopyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sCopyCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sCopyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 605); do { } while (false); do { MOZ_CrashSequence(__null, 605); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 606 | MOZ_RELEASE_ASSERT(sMoveCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sMoveCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sMoveCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sMoveCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 606); do { } while (false); do { MOZ_CrashSequence(__null, 606); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 607 | MOZ_RELEASE_ASSERT(sDestroyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sDestroyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sDestroyCounter == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("sDestroyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 607); do { } while (false); do { MOZ_CrashSequence(__null, 607); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 608 | MOZ_RELEASE_ASSERT(v.length() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 608); do { } while (false); do { MOZ_CrashSequence(__null, 608); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 609 | MOZ_ASSERT(v.reserved() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 609); do { } while (false); do { MOZ_CrashSequence(__null, 609); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 610 | MOZ_RELEASE_ASSERT(v.capacity() >= 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() >= 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() >= 10))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() >= 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 610); do { } while (false); do { MOZ_CrashSequence(__null, 610); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 611 | MOZ_RELEASE_ASSERT(v.shrinkStorageToFit())do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.shrinkStorageToFit())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.shrinkStorageToFit()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("v.shrinkStorageToFit()" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 611); do { } while (false); do { MOZ_CrashSequence(__null, 611); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 612 | ||||
| 613 | MOZ_RELEASE_ASSERT(sConstructCounter == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sConstructCounter == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sConstructCounter == 8))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("sConstructCounter == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 613); do { } while (false); do { MOZ_CrashSequence(__null, 613); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 614 | MOZ_RELEASE_ASSERT(sCopyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sCopyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sCopyCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sCopyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 614); do { } while (false); do { MOZ_CrashSequence(__null, 614); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 615 | MOZ_RELEASE_ASSERT(sMoveCounter == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sMoveCounter == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sMoveCounter == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sMoveCounter == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 615); do { } while (false); do { MOZ_CrashSequence(__null, 615); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 616 | MOZ_RELEASE_ASSERT(sDestroyCounter == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sDestroyCounter == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sDestroyCounter == 8))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("sDestroyCounter == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 616); do { } while (false); do { MOZ_CrashSequence(__null, 616); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 617 | MOZ_RELEASE_ASSERT(v.length() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 617); do { } while (false); do { MOZ_CrashSequence(__null, 617); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 618 | MOZ_ASSERT(v.reserved() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 618); do { } while (false); do { MOZ_CrashSequence(__null, 618); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 619 | MOZ_RELEASE_ASSERT(v.capacity() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 619); do { } while (false); do { MOZ_CrashSequence(__null, 619); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 620 | } | |||
| 621 | ||||
| 622 | // Non-POD shrinking to inline storage. | |||
| 623 | { | |||
| 624 | static size_t sConstructCounter = 0; | |||
| 625 | static size_t sCopyCounter = 0; | |||
| 626 | static size_t sMoveCounter = 0; | |||
| 627 | static size_t sDestroyCounter = 0; | |||
| 628 | struct NonPod { | |||
| 629 | int mSomething = 10; | |||
| 630 | ||||
| 631 | NonPod() { sConstructCounter++; } | |||
| 632 | ||||
| 633 | NonPod(const NonPod& aOther) : mSomething(aOther.mSomething) { | |||
| 634 | sCopyCounter++; | |||
| 635 | } | |||
| 636 | NonPod(NonPod&& aOther) : mSomething(aOther.mSomething) { | |||
| 637 | sMoveCounter++; | |||
| 638 | } | |||
| 639 | ~NonPod() { sDestroyCounter++; } | |||
| 640 | }; | |||
| 641 | ||||
| 642 | Vector<NonPod, 5> v; | |||
| 643 | MOZ_RELEASE_ASSERT(v.reserve(10))do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserve(10))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserve(10)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserve(10)", "/root/firefox-clang/mfbt/tests/TestVector.cpp", 643); do { } while (false); do { MOZ_CrashSequence(__null, 643); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 644 | for (size_t i = 0; i < 3; ++i) { | |||
| 645 | v.infallibleEmplaceBack(); | |||
| 646 | } | |||
| 647 | MOZ_RELEASE_ASSERT(sConstructCounter == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sConstructCounter == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sConstructCounter == 3))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("sConstructCounter == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 647); do { } while (false); do { MOZ_CrashSequence(__null, 647); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 648 | MOZ_RELEASE_ASSERT(sCopyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sCopyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sCopyCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sCopyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 648); do { } while (false); do { MOZ_CrashSequence(__null, 648); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 649 | MOZ_RELEASE_ASSERT(sMoveCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sMoveCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sMoveCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sMoveCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 649); do { } while (false); do { MOZ_CrashSequence(__null, 649); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 650 | MOZ_RELEASE_ASSERT(sDestroyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sDestroyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sDestroyCounter == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("sDestroyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 650); do { } while (false); do { MOZ_CrashSequence(__null, 650); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 651 | MOZ_RELEASE_ASSERT(v.length() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 651); do { } while (false); do { MOZ_CrashSequence(__null, 651); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 652 | MOZ_ASSERT(v.reserved() == 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 10))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 652); do { } while (false); do { MOZ_CrashSequence(__null, 652); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 653 | MOZ_RELEASE_ASSERT(v.capacity() >= 10)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() >= 10)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() >= 10))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() >= 10" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 653); do { } while (false); do { MOZ_CrashSequence(__null, 653); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 654 | MOZ_RELEASE_ASSERT(v.shrinkStorageToFit())do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.shrinkStorageToFit())>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.shrinkStorageToFit()))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("v.shrinkStorageToFit()" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 654); do { } while (false); do { MOZ_CrashSequence(__null, 654); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 655 | ||||
| 656 | MOZ_RELEASE_ASSERT(sConstructCounter == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sConstructCounter == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sConstructCounter == 3))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("sConstructCounter == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 656); do { } while (false); do { MOZ_CrashSequence(__null, 656); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 657 | MOZ_RELEASE_ASSERT(sCopyCounter == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sCopyCounter == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sCopyCounter == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sCopyCounter == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 657); do { } while (false); do { MOZ_CrashSequence(__null, 657); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 658 | MOZ_RELEASE_ASSERT(sMoveCounter == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sMoveCounter == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sMoveCounter == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("sMoveCounter == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 658); do { } while (false); do { MOZ_CrashSequence(__null, 658); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 659 | MOZ_RELEASE_ASSERT(sDestroyCounter == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(sDestroyCounter == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(sDestroyCounter == 3))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("sDestroyCounter == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 659); do { } while (false); do { MOZ_CrashSequence(__null, 659); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 660 | MOZ_RELEASE_ASSERT(v.length() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.length() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.length() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.length() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 660); do { } while (false); do { MOZ_CrashSequence(__null, 660); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 661 | MOZ_ASSERT(v.reserved() == 3)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.reserved() == 3)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.reserved() == 3))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.reserved() == 3" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 661); do { } while (false); do { MOZ_CrashSequence(__null, 661); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 662 | MOZ_RELEASE_ASSERT(v.capacity() == 5)do { static_assert( mozilla::detail::AssertionConditionType< decltype(v.capacity() == 5)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(v.capacity() == 5))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("v.capacity() == 5" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 662); do { } while (false); do { MOZ_CrashSequence(__null, 662); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 663 | } | |||
| 664 | } | |||
| 665 | ||||
| 666 | void mozilla::detail::VectorTesting::testAppend() { | |||
| 667 | // Test moving append/appendAll with a move-only type | |||
| 668 | Vector<UniquePtr<int>> bv; | |||
| 669 | for (const int val : IntegerRange<int>(0, 3)) { | |||
| 670 | MOZ_RELEASE_ASSERT(bv.append(MakeUnique<int>(val)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.append(MakeUnique<int>(val)))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !(bv.append(MakeUnique<int>(val))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.append(MakeUnique<int>(val))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 670); do { } while (false); do { MOZ_CrashSequence(__null, 670); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 671 | } | |||
| 672 | ||||
| 673 | Vector<UniquePtr<int>> otherbv; | |||
| 674 | for (const int val : IntegerRange<int>(3, 8)) { | |||
| 675 | MOZ_RELEASE_ASSERT(otherbv.append(MakeUnique<int>(val)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(otherbv.append(MakeUnique<int>(val)))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(otherbv.append(MakeUnique<int>(val))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("otherbv.append(MakeUnique<int>(val))" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 675); do { } while (false); do { MOZ_CrashSequence(__null, 675); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 676 | } | |||
| 677 | MOZ_RELEASE_ASSERT(bv.appendAll(std::move(otherbv)))do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.appendAll(std::move(otherbv)))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.appendAll(std::move(otherbv ))))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("bv.appendAll(std::move(otherbv))", "/root/firefox-clang/mfbt/tests/TestVector.cpp" , 677); do { } while (false); do { MOZ_CrashSequence(__null, 677 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 678 | ||||
| 679 | MOZ_RELEASE_ASSERT(otherbv.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(otherbv.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(otherbv.length() == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("otherbv.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 679); do { } while (false); do { MOZ_CrashSequence(__null, 679); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 680 | MOZ_RELEASE_ASSERT(bv.length() == 8)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bv.length() == 8)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bv.length() == 8))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bv.length() == 8" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 680); do { } while (false); do { MOZ_CrashSequence(__null, 680); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 681 | for (const int val : IntegerRange<int>(0, 8)) { | |||
| 682 | MOZ_RELEASE_ASSERT(*bv[val] == val)do { static_assert( mozilla::detail::AssertionConditionType< decltype(*bv[val] == val)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(*bv[val] == val))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("*bv[val] == val" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 682); do { } while (false); do { MOZ_CrashSequence(__null, 682); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 683 | } | |||
| 684 | } | |||
| 685 | ||||
| 686 | // Vector with no inline storage should occupy the absolute minimum space in | |||
| 687 | // non-debug builds. (Debug adds a laundry list of other constraints, none | |||
| 688 | // directly relevant to shipping builds, that aren't worth precisely modeling.) | |||
| 689 | #ifndef DEBUG1 | |||
| 690 | ||||
| 691 | template <typename T> | |||
| 692 | struct NoInlineStorageLayout { | |||
| 693 | T* mBegin; | |||
| 694 | size_t mLength; | |||
| 695 | struct CRAndStorage { | |||
| 696 | size_t mCapacity; | |||
| 697 | } mTail; | |||
| 698 | }; | |||
| 699 | ||||
| 700 | // Only one of these should be necessary, but test a few of them for good | |||
| 701 | // measure. | |||
| 702 | static_assert(sizeof(Vector<int, 0>) == sizeof(NoInlineStorageLayout<int>), | |||
| 703 | "Vector of int without inline storage shouldn't occupy dead " | |||
| 704 | "space for that absence of storage"); | |||
| 705 | ||||
| 706 | static_assert(sizeof(Vector<bool, 0>) == sizeof(NoInlineStorageLayout<bool>), | |||
| 707 | "Vector of bool without inline storage shouldn't occupy dead " | |||
| 708 | "space for that absence of storage"); | |||
| 709 | ||||
| 710 | static_assert(sizeof(Vector<S, 0>) == sizeof(NoInlineStorageLayout<S>), | |||
| 711 | "Vector of S without inline storage shouldn't occupy dead " | |||
| 712 | "space for that absence of storage"); | |||
| 713 | ||||
| 714 | #endif // DEBUG | |||
| 715 | ||||
| 716 | static void TestVectorBeginNonNull() { | |||
| 717 | // Vector::begin() should never return nullptr, to accommodate callers that | |||
| 718 | // (either for hygiene, or for semantic reasons) need a non-null pointer even | |||
| 719 | // for zero elements. | |||
| 720 | ||||
| 721 | Vector<bool, 0> bvec0; | |||
| 722 | MOZ_RELEASE_ASSERT(bvec0.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec0.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec0.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bvec0.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 722); do { } while (false); do { MOZ_CrashSequence(__null, 722); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 723 | MOZ_RELEASE_ASSERT(bvec0.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec0.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec0.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bvec0.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 723); do { } while (false); do { MOZ_CrashSequence(__null, 723); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 724 | ||||
| 725 | Vector<bool, 1> bvec1; | |||
| 726 | MOZ_RELEASE_ASSERT(bvec1.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec1.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec1.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bvec1.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 726); do { } while (false); do { MOZ_CrashSequence(__null, 726); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 727 | MOZ_RELEASE_ASSERT(bvec1.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec1.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec1.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("bvec1.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 727); do { } while (false); do { MOZ_CrashSequence(__null, 727); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 728 | ||||
| 729 | Vector<bool, 64> bvec64; | |||
| 730 | MOZ_RELEASE_ASSERT(bvec64.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec64.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec64.length() == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("bvec64.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 730); do { } while (false); do { MOZ_CrashSequence(__null, 730); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 731 | MOZ_RELEASE_ASSERT(bvec64.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(bvec64.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(bvec64.begin() != nullptr))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("bvec64.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 731); do { } while (false); do { MOZ_CrashSequence(__null, 731); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 732 | ||||
| 733 | Vector<int, 0> ivec0; | |||
| 734 | MOZ_RELEASE_ASSERT(ivec0.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec0.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec0.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("ivec0.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 734); do { } while (false); do { MOZ_CrashSequence(__null, 734); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 735 | MOZ_RELEASE_ASSERT(ivec0.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec0.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec0.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("ivec0.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 735); do { } while (false); do { MOZ_CrashSequence(__null, 735); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 736 | ||||
| 737 | Vector<int, 1> ivec1; | |||
| 738 | MOZ_RELEASE_ASSERT(ivec1.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec1.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec1.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("ivec1.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 738); do { } while (false); do { MOZ_CrashSequence(__null, 738); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 739 | MOZ_RELEASE_ASSERT(ivec1.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec1.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec1.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("ivec1.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 739); do { } while (false); do { MOZ_CrashSequence(__null, 739); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 740 | ||||
| 741 | Vector<int, 64> ivec64; | |||
| 742 | MOZ_RELEASE_ASSERT(ivec64.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec64.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec64.length() == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("ivec64.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 742); do { } while (false); do { MOZ_CrashSequence(__null, 742); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 743 | MOZ_RELEASE_ASSERT(ivec64.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(ivec64.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(ivec64.begin() != nullptr))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("ivec64.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 743); do { } while (false); do { MOZ_CrashSequence(__null, 743); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 744 | ||||
| 745 | Vector<long, 0> lvec0; | |||
| 746 | MOZ_RELEASE_ASSERT(lvec0.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec0.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec0.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("lvec0.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 746); do { } while (false); do { MOZ_CrashSequence(__null, 746); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 747 | MOZ_RELEASE_ASSERT(lvec0.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec0.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec0.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("lvec0.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 747); do { } while (false); do { MOZ_CrashSequence(__null, 747); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 748 | ||||
| 749 | Vector<long, 1> lvec1; | |||
| 750 | MOZ_RELEASE_ASSERT(lvec1.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec1.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec1.length() == 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("lvec1.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 750); do { } while (false); do { MOZ_CrashSequence(__null, 750); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 751 | MOZ_RELEASE_ASSERT(lvec1.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec1.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec1.begin() != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("lvec1.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 751); do { } while (false); do { MOZ_CrashSequence(__null, 751); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 752 | ||||
| 753 | Vector<long, 64> lvec64; | |||
| 754 | MOZ_RELEASE_ASSERT(lvec64.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec64.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec64.length() == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("lvec64.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 754); do { } while (false); do { MOZ_CrashSequence(__null, 754); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 755 | MOZ_RELEASE_ASSERT(lvec64.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(lvec64.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(lvec64.begin() != nullptr))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("lvec64.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 755); do { } while (false); do { MOZ_CrashSequence(__null, 755); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 756 | ||||
| 757 | // Vector<T, N> doesn't guarantee N inline elements -- the actual count is | |||
| 758 | // capped so that any Vector fits in a not-crazy amount of space -- so the | |||
| 759 | // code below won't overflow stacks or anything crazy. | |||
| 760 | struct VeryBig { | |||
| 761 | int array[16 * 1024 * 1024]; | |||
| 762 | }; | |||
| 763 | ||||
| 764 | Vector<VeryBig, 0> vbvec0; | |||
| 765 | MOZ_RELEASE_ASSERT(vbvec0.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec0.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec0.length() == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("vbvec0.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 765); do { } while (false); do { MOZ_CrashSequence(__null, 765); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 766 | MOZ_RELEASE_ASSERT(vbvec0.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec0.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec0.begin() != nullptr))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("vbvec0.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 766); do { } while (false); do { MOZ_CrashSequence(__null, 766); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 767 | ||||
| 768 | Vector<VeryBig, 1> vbvec1; | |||
| 769 | MOZ_RELEASE_ASSERT(vbvec1.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec1.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec1.length() == 0))), 0)) ) { do { } while (false); MOZ_ReportAssertionFailure("vbvec1.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 769); do { } while (false); do { MOZ_CrashSequence(__null, 769); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 770 | MOZ_RELEASE_ASSERT(vbvec1.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec1.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec1.begin() != nullptr))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("vbvec1.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 770); do { } while (false); do { MOZ_CrashSequence(__null, 770); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 771 | ||||
| 772 | Vector<VeryBig, 64> vbvec64; | |||
| 773 | MOZ_RELEASE_ASSERT(vbvec64.length() == 0)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec64.length() == 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec64.length() == 0))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("vbvec64.length() == 0" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 773); do { } while (false); do { MOZ_CrashSequence(__null, 773); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 774 | MOZ_RELEASE_ASSERT(vbvec64.begin() != nullptr)do { static_assert( mozilla::detail::AssertionConditionType< decltype(vbvec64.begin() != nullptr)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(vbvec64.begin() != nullptr)) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("vbvec64.begin() != nullptr" , "/root/firefox-clang/mfbt/tests/TestVector.cpp", 774); do { } while (false); do { MOZ_CrashSequence(__null, 774); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 775 | } | |||
| 776 | ||||
| 777 | int main() { | |||
| 778 | VectorTesting::testReserved(); | |||
| 779 | VectorTesting::testConstRange(); | |||
| 780 | VectorTesting::testEmplaceBack(); | |||
| 781 | VectorTesting::testReverse(); | |||
| 782 | VectorTesting::testExtractRawBuffer(); | |||
| 783 | VectorTesting::testExtractOrCopyRawBuffer(); | |||
| 784 | VectorTesting::testReplaceRawBuffer(); | |||
| 785 | VectorTesting::testInsert(); | |||
| 786 | VectorTesting::testErase(); | |||
| 787 | VectorTesting::testShrinkStorageToFit(); | |||
| 788 | VectorTesting::testAppend(); | |||
| 789 | TestVectorBeginNonNull(); | |||
| 790 | } |