tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e99c1970686484100badb848d49189433e76b4a2
parent de9d6a8d595215e8b8a5f360ec9543c19c0b97ed
Author: serge-sans-paille <sguelton@mozilla.com>
Date:   Thu,  2 Oct 2025 05:11:42 +0000

Bug 1991398 - Simplify CheckedInt implementation r=emilio,media-playback-reviewers,win-reviewers,dom-storage-reviewers,gstoll,padenot

Now that we support gcc starting with version 10 and clang starting with
version 17, we can solely rely on __builtin_(mul|add|sub)_overflow for
CheckedInt implementation. This greatly simplifies the implementation.

Also tidy up includes as a side effect.

Differential Revision: https://phabricator.services.mozilla.com/D266655

Diffstat:
Mdom/base/nsDOMWindowUtils.cpp | 1-
Mdom/canvas/WebGLContext.h | 1-
Mdom/canvas/WebGLContextValidate.cpp | 1-
Mdom/canvas/WebGLContextVertices.cpp | 1-
Mdom/canvas/WebGLTexture.h | 1-
Mdom/encoding/TextEncoder.cpp | 1-
Mdom/file/BlobSet.cpp | 1-
Mdom/fs/parent/datamodel/FileSystemDatabaseManagerVersion002.cpp | 1-
Mdom/html/HTMLCanvasElement.cpp | 1-
Mdom/indexedDB/Key.cpp | 1-
Mdom/media/ipc/RemoteMediaData.cpp | 8+++++---
Mdom/media/mp4/MP4Metadata.cpp | 1-
Mdom/media/webaudio/AudioBuffer.cpp | 1-
Meditor/libeditor/EditorBase.cpp | 1-
Mgfx/2d/Blur.cpp | 1-
Mgfx/2d/Blur.h | 1-
Mgfx/thebes/gfxASurface.cpp | 1-
Mimage/imgFrame.cpp | 1-
Mipc/glue/IPCMessageUtilsSpecializations.h | 1-
Mjs/src/builtin/OrderedHashTableObject.h | 1-
Mjs/src/builtin/temporal/Temporal.cpp | 4+++-
Mjs/src/jit/shared/Assembler-shared.h | 4+++-
Mjs/xpconnect/loader/ScriptPreloader-inl.h | 1-
Mjs/xpconnect/loader/ScriptPreloader.h | 1-
Mmfbt/CheckedInt.h | 187++++++++-----------------------------------------------------------------------
Mmfbt/tests/TestCheckedInt.cpp | 21---------------------
Mparser/htmlparser/nsScanner.h | 1-
Mtoolkit/xre/dllservices/DynamicBlocklist.h | 1-
Mtoolkit/xre/dllservices/mozglue/nsWindowsDllInterceptor.h | 1-
Mwidget/gtk/IMContextWrapper.h | 1-
Mwidget/windows/IMMHandler.cpp | 1-
31 files changed, 28 insertions(+), 222 deletions(-)

diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp @@ -15,7 +15,6 @@ #include "js/experimental/PCCountProfiling.h" // JS::{Start,Stop}PCCountProfiling, JS::PurgePCCounts, JS::GetPCCountScript{Count,Summary,Contents} #include "mozilla/Base64.h" #include "mozilla/ChaosMode.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EventStateManager.h" #include "mozilla/InputTaskManager.h" #include "mozilla/Logging.h" diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h @@ -21,7 +21,6 @@ #include "js/ScalarType.h" // js::Scalar::Type #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EnumeratedArray.h" #include "mozilla/Mutex.h" #include "mozilla/StaticMutex.h" diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp @@ -22,7 +22,6 @@ #include "WebGLVertexArray.h" #include "gfxEnv.h" #include "jsfriendapi.h" -#include "mozilla/CheckedInt.h" #include "mozilla/Preferences.h" #include "mozilla/StaticPrefs_webgl.h" #include "nsPrintfCString.h" diff --git a/dom/canvas/WebGLContextVertices.cpp b/dom/canvas/WebGLContextVertices.cpp @@ -13,7 +13,6 @@ #include "WebGLTexture.h" #include "WebGLTypes.h" #include "WebGLVertexArray.h" -#include "mozilla/CheckedInt.h" #include "mozilla/ResultVariant.h" namespace mozilla { diff --git a/dom/canvas/WebGLTexture.h b/dom/canvas/WebGLTexture.h @@ -16,7 +16,6 @@ #include "WebGLStrongTypes.h" #include "WebGLTypes.h" #include "mozilla/Assertions.h" -#include "mozilla/CheckedInt.h" #include "mozilla/dom/TypedArray.h" namespace mozilla { diff --git a/dom/encoding/TextEncoder.cpp b/dom/encoding/TextEncoder.cpp @@ -6,7 +6,6 @@ #include "mozilla/dom/TextEncoder.h" -#include "mozilla/CheckedInt.h" #include "mozilla/ErrorResult.h" #include "mozilla/UniquePtrExtensions.h" #include "nsReadableUtils.h" diff --git a/dom/file/BlobSet.cpp b/dom/file/BlobSet.cpp @@ -9,7 +9,6 @@ #include "MemoryBlobImpl.h" #include "MultipartBlobImpl.h" #include "StringBlobImpl.h" -#include "mozilla/CheckedInt.h" #include "mozilla/dom/File.h" namespace mozilla::dom { diff --git a/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion002.cpp b/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion002.cpp @@ -16,7 +16,6 @@ #include "ResultStatement.h" #include "StartedTransaction.h" #include "mozStorageHelper.h" -#include "mozilla/CheckedInt.h" #include "mozilla/dom/FileSystemDataManager.h" #include "mozilla/dom/FileSystemHandle.h" #include "mozilla/dom/FileSystemLog.h" diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp @@ -18,7 +18,6 @@ #include "mozilla/Assertions.h" #include "mozilla/Base64.h" #include "mozilla/BasePrincipal.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EventDispatcher.h" #include "mozilla/MouseEvents.h" #include "mozilla/Preferences.h" diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp @@ -24,7 +24,6 @@ #include "mozIStorageStatement.h" #include "mozIStorageValueArray.h" #include "mozilla/Casting.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EndianUtils.h" #include "mozilla/FloatingPoint.h" #include "mozilla/ResultExtensions.h" diff --git a/dom/media/ipc/RemoteMediaData.cpp b/dom/media/ipc/RemoteMediaData.cpp @@ -29,9 +29,11 @@ uint8_t* RemoteArrayOfByteBuffer::BuffersStartAddress() const { } bool RemoteArrayOfByteBuffer::Check(size_t aOffset, size_t aSizeInBytes) const { - return mBuffers && mBuffers->IsReadable() && - detail::IsAddValid(aOffset, aSizeInBytes) && - aOffset + aSizeInBytes <= mBuffers->Size<uint8_t>(); + if (!mBuffers || !mBuffers->IsReadable()) { + return false; + } + auto size = CheckedInt<size_t>(aOffset) + aSizeInBytes; + return size.isValid() && size.value() <= mBuffers->Size<uint8_t>(); } void RemoteArrayOfByteBuffer::Write(size_t aOffset, const void* aSourceAddr, diff --git a/dom/media/mp4/MP4Metadata.cpp b/dom/media/mp4/MP4Metadata.cpp @@ -13,7 +13,6 @@ #include "MoofParser.h" #include "VideoUtils.h" #include "mozilla/Assertions.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EndianUtils.h" #include "mozilla/Logging.h" #include "mozilla/RefPtr.h" diff --git a/dom/media/webaudio/AudioBuffer.cpp b/dom/media/webaudio/AudioBuffer.cpp @@ -14,7 +14,6 @@ #include "js/ArrayBuffer.h" // JS::StealArrayBufferContents #include "js/experimental/TypedData.h" // JS_NewFloat32Array, JS_GetFloat32ArrayData, JS_GetTypedArrayLength, JS_GetArrayBufferViewBuffer #include "jsfriendapi.h" -#include "mozilla/CheckedInt.h" #include "mozilla/ErrorResult.h" #include "mozilla/HoldDropJSObjects.h" #include "mozilla/MemoryReporting.h" diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp @@ -41,7 +41,6 @@ #include "mozilla/EditorDOMPoint.h" #include "mozilla/intl/BidiEmbeddingLevel.h" #include "mozilla/BasePrincipal.h" // for BasePrincipal -#include "mozilla/CheckedInt.h" // for CheckedInt #include "mozilla/ComposerCommandsUpdater.h" // for ComposerCommandsUpdater #include "mozilla/ContentEvents.h" // for InternalClipboardEvent #include "mozilla/DebugOnly.h" // for DebugOnly diff --git a/gfx/2d/Blur.cpp b/gfx/2d/Blur.cpp @@ -10,7 +10,6 @@ #include <math.h> #include <string.h> -#include "mozilla/CheckedInt.h" #include "NumericTools.h" #include "2D.h" diff --git a/gfx/2d/Blur.h b/gfx/2d/Blur.h @@ -10,7 +10,6 @@ #include "mozilla/gfx/Rect.h" #include "mozilla/gfx/Point.h" #include "mozilla/gfx/Types.h" -#include "mozilla/CheckedInt.h" class SkSurface; diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp @@ -6,7 +6,6 @@ #include "nsIMemoryReporter.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Base64.h" -#include "mozilla/CheckedInt.h" #include "mozilla/Attributes.h" #include "mozilla/MemoryReporting.h" #include "nsISupportsImpl.h" diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp @@ -17,7 +17,6 @@ #include "gfxUtils.h" #include "MainThreadUtils.h" -#include "mozilla/CheckedInt.h" #include "mozilla/gfx/Tools.h" #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" diff --git a/ipc/glue/IPCMessageUtilsSpecializations.h b/ipc/glue/IPCMessageUtilsSpecializations.h @@ -54,7 +54,6 @@ // to the cpp file. #include "base/string_util.h" // for StringPrintf #include "mozilla/ArrayUtils.h" // for ArrayLength -#include "mozilla/CheckedInt.h" #ifdef _MSC_VER # pragma warning(disable : 4800) diff --git a/js/src/builtin/OrderedHashTableObject.h b/js/src/builtin/OrderedHashTableObject.h @@ -44,7 +44,6 @@ * void makeEmpty(Key*); */ -#include "mozilla/CheckedInt.h" #include "mozilla/HashFunctions.h" #include "mozilla/Likely.h" #include "mozilla/Maybe.h" diff --git a/js/src/builtin/temporal/Temporal.cpp b/js/src/builtin/temporal/Temporal.cpp @@ -7,7 +7,9 @@ #include "builtin/temporal/Temporal.h" #include "mozilla/Casting.h" -#include "mozilla/CheckedInt.h" +#ifdef DEBUG +# include "mozilla/CheckedInt.h" +#endif #include "mozilla/FloatingPoint.h" #include "mozilla/Likely.h" #include "mozilla/MathAlgorithms.h" diff --git a/js/src/jit/shared/Assembler-shared.h b/js/src/jit/shared/Assembler-shared.h @@ -7,7 +7,9 @@ #ifndef jit_shared_Assembler_shared_h #define jit_shared_Assembler_shared_h -#include "mozilla/CheckedInt.h" +#if JS_BITS_PER_WORD == 32 +# include "mozilla/CheckedInt.h" +#endif #include "mozilla/DebugOnly.h" #include <limits.h> diff --git a/js/xpconnect/loader/ScriptPreloader-inl.h b/js/xpconnect/loader/ScriptPreloader-inl.h @@ -8,7 +8,6 @@ #include "mozilla/Attributes.h" #include "mozilla/Assertions.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EndianUtils.h" #include "mozilla/EnumSet.h" #include "mozilla/Range.h" diff --git a/js/xpconnect/loader/ScriptPreloader.h b/js/xpconnect/loader/ScriptPreloader.h @@ -7,7 +7,6 @@ #define ScriptPreloader_h #include "mozilla/Atomics.h" -#include "mozilla/CheckedInt.h" #include "mozilla/EnumSet.h" #include "mozilla/EventTargetAndLockCapability.h" #include "mozilla/LinkedList.h" diff --git a/mfbt/CheckedInt.h b/mfbt/CheckedInt.h @@ -9,43 +9,14 @@ #ifndef mozilla_CheckedInt_h #define mozilla_CheckedInt_h -#include <stdint.h> #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/IntegerTypeTraits.h" + +#include <cstdint> #include <limits> #include <type_traits> -#define MOZILLA_CHECKEDINT_COMPARABLE_VERSION(major, minor, patch) \ - (major << 16 | minor << 8 | patch) - -// Probe for builtin math overflow support. Disabled for 32-bit builds for now -// since "gcc -m32" claims to support these but its implementation is buggy. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82274 -// Also disabled for clang before version 7 (resp. Xcode clang 10.0.1): while -// clang 5 and 6 have a working __builtin_add_overflow, it is not constexpr. -#if defined(HAVE_64BIT_BUILD) -# if defined(__has_builtin) && \ - (!defined(__clang_major__) || \ - (!defined(__apple_build_version__) && __clang_major__ >= 7) || \ - (defined(__apple_build_version__) && \ - MOZILLA_CHECKEDINT_COMPARABLE_VERSION( \ - __clang_major__, __clang_minor__, __clang_patchlevel__) >= \ - MOZILLA_CHECKEDINT_COMPARABLE_VERSION(10, 0, 1))) -# define MOZ_HAS_BUILTIN_OP_OVERFLOW (__has_builtin(__builtin_add_overflow)) -# elif defined(__GNUC__) -// (clang also defines __GNUC__ but it supports __has_builtin since at least -// v3.1 (released in 2012) so it won't get here.) -# define MOZ_HAS_BUILTIN_OP_OVERFLOW (__GNUC__ >= 5) -# else -# define MOZ_HAS_BUILTIN_OP_OVERFLOW (0) -# endif -#else -# define MOZ_HAS_BUILTIN_OP_OVERFLOW (0) -#endif - -#undef MOZILLA_CHECKEDINT_COMPARABLE_VERSION - namespace mozilla { template <typename T> @@ -64,8 +35,6 @@ namespace detail { * type that isn't just a typedef for some of them, is int8_t. */ -struct UnsupportedType {}; - template <typename IntegerType> struct IsSupportedPass2 { static const bool value = false; @@ -177,33 +146,6 @@ struct IsSupportedPass2<unsigned long long> { * Ideas taken from IntegerLib, code different. */ -template <typename IntegerType, size_t Size = sizeof(IntegerType)> -struct TwiceBiggerType { - typedef typename detail::StdintTypeForSizeAndSignedness< - sizeof(IntegerType) * 2, std::is_signed_v<IntegerType>>::Type Type; -}; - -template <typename IntegerType> -struct TwiceBiggerType<IntegerType, 8> { - typedef UnsupportedType Type; -}; - -template <typename T> -constexpr bool HasSignBit(T aX) { - // In C++, right bit shifts on negative values is undefined by the standard. - // Notice that signed-to-unsigned conversions are always well-defined in the - // standard, as the value congruent modulo 2**n as expected. By contrast, - // unsigned-to-signed is only well-defined if the value is representable. - return bool(std::make_unsigned_t<T>(aX) >> PositionOfSignBit<T>::value); -} - -// Bitwise ops may return a larger type, so it's good to use this inline -// helper guaranteeing that the result is really of type T. -template <typename T> -constexpr T BinaryComplement(T aX) { - return ~aX; -} - template <typename T, typename U, bool IsTSigned = std::is_signed_v<T>, bool IsUSigned = std::is_signed_v<U>> struct DoesRangeContainRange {}; @@ -270,95 +212,6 @@ constexpr bool IsInRange(U aX) { } template <typename T> -constexpr bool IsAddValid(T aX, T aY) { -#if MOZ_HAS_BUILTIN_OP_OVERFLOW - T dummy; - return !__builtin_add_overflow(aX, aY, &dummy); -#else - // Addition is valid if the sign of aX+aY is equal to either that of aX or - // that of aY. Since the value of aX+aY is undefined if we have a signed - // type, we compute it using the unsigned type of the same size. Beware! - // These bitwise operations can return a larger integer type, if T was a - // small type like int8_t, so we explicitly cast to T. - - std::make_unsigned_t<T> ux = aX; - std::make_unsigned_t<T> uy = aY; - std::make_unsigned_t<T> result = ux + uy; - return std::is_signed_v<T> - ? HasSignBit(BinaryComplement(T((result ^ aX) & (result ^ aY)))) - : BinaryComplement(aX) >= aY; -#endif -} - -template <typename T> -constexpr bool IsSubValid(T aX, T aY) { -#if MOZ_HAS_BUILTIN_OP_OVERFLOW - T dummy; - return !__builtin_sub_overflow(aX, aY, &dummy); -#else - // Subtraction is valid if either aX and aY have same sign, or aX-aY and aX - // have same sign. Since the value of aX-aY is undefined if we have a signed - // type, we compute it using the unsigned type of the same size. - std::make_unsigned_t<T> ux = aX; - std::make_unsigned_t<T> uy = aY; - std::make_unsigned_t<T> result = ux - uy; - - return std::is_signed_v<T> - ? HasSignBit(BinaryComplement(T((result ^ aX) & (aX ^ aY)))) - : aX >= aY; -#endif -} - -template <typename T, bool IsTSigned = std::is_signed_v<T>, - bool TwiceBiggerTypeIsSupported = - IsSupported<typename TwiceBiggerType<T>::Type>::value> -struct IsMulValidImpl {}; - -template <typename T, bool IsTSigned> -struct IsMulValidImpl<T, IsTSigned, true> { - static constexpr bool run(T aX, T aY) { - typedef typename TwiceBiggerType<T>::Type TwiceBiggerType; - TwiceBiggerType product = TwiceBiggerType(aX) * TwiceBiggerType(aY); - return IsInRange<T>(product); - } -}; - -template <typename T> -struct IsMulValidImpl<T, true, false> { - static constexpr bool run(T aX, T aY) { - const T max = std::numeric_limits<T>::max(); - const T min = std::numeric_limits<T>::min(); - - if (aX == 0 || aY == 0) { - return true; - } - if (aX > 0) { - return aY > 0 ? aX <= max / aY : aY >= min / aX; - } - - // If we reach this point, we know that aX < 0. - return aY > 0 ? aX >= min / aY : aY >= max / aX; - } -}; - -template <typename T> -struct IsMulValidImpl<T, false, false> { - static constexpr bool run(T aX, T aY) { - return aY == 0 || aX <= std::numeric_limits<T>::max() / aY; - } -}; - -template <typename T> -constexpr bool IsMulValid(T aX, T aY) { -#if MOZ_HAS_BUILTIN_OP_OVERFLOW - T dummy; - return !__builtin_mul_overflow(aX, aY, &dummy); -#else - return IsMulValidImpl<T>::run(aX, aY); -#endif -} - -template <typename T> constexpr bool IsDivValid(T aX, T aY) { // Keep in mind that in the signed case, min/-1 is invalid because // abs(min)>max. @@ -684,34 +537,28 @@ class CheckedInt { return CheckedInt<T>(T(0), false); \ } \ /* For some T, arithmetic ops automatically promote to a wider type, so \ - * explitly do the narrowing cast here. The narrowing cast is valid \ + * explicitly do the narrowing cast here. The narrowing cast is valid \ * because we did the "Is##NAME##Valid" check above. */ \ return CheckedInt<T>(T(aLhs.mValue OP aRhs.mValue), \ aLhs.mIsValid && aRhs.mIsValid); \ } -#if MOZ_HAS_BUILTIN_OP_OVERFLOW -# define MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2(NAME, OP, FUN) \ - template <typename T> \ - constexpr CheckedInt<T> operator OP(const CheckedInt<T>& aLhs, \ - const CheckedInt<T>& aRhs) { \ - auto result = T{}; \ - if (FUN(aLhs.mValue, aRhs.mValue, &result)) { \ - static_assert(detail::IsInRange<T>(0), \ - "Integer type can't represent 0"); \ - return CheckedInt<T>(T(0), false); \ - } \ - return CheckedInt<T>(result, aLhs.mIsValid && aRhs.mIsValid); \ - } +#define MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2(NAME, OP, FUN) \ + template <typename T> \ + constexpr CheckedInt<T> operator OP(const CheckedInt<T>& aLhs, \ + const CheckedInt<T>& aRhs) { \ + auto result = T{}; \ + if (FUN(aLhs.mValue, aRhs.mValue, &result)) { \ + static_assert(detail::IsInRange<T>(0), \ + "Integer type can't represent 0"); \ + return CheckedInt<T>(T(0), false); \ + } \ + return CheckedInt<T>(result, aLhs.mIsValid && aRhs.mIsValid); \ + } MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2(Add, +, __builtin_add_overflow) MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2(Sub, -, __builtin_sub_overflow) MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2(Mul, *, __builtin_mul_overflow) -# undef MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2 -#else -MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Add, +) -MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Sub, -) -MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Mul, *) -#endif +#undef MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR2 MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Div, /) MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Mod, %) @@ -719,7 +566,7 @@ MOZ_CHECKEDINT_BASIC_BINARY_OPERATOR(Mod, %) // Implement castToCheckedInt<T>(x), making sure that // - it allows x to be either a CheckedInt<T> or any integer type -// that can be casted to T +// that can be cast to T // - if x is already a CheckedInt<T>, we just return a reference to it, // instead of copying it (optimization) diff --git a/mfbt/tests/TestCheckedInt.cpp b/mfbt/tests/TestCheckedInt.cpp @@ -43,25 +43,6 @@ void verifyImplFunction(bool aX, bool aExpected, const char* aFile, int aLine, #define VERIFY_IS_INVALID(x) VERIFY_IMPL((x).isValid(), false) #define VERIFY_IS_VALID_IF(x, condition) VERIFY_IMPL((x).isValid(), (condition)) -template <typename T, size_t Size = sizeof(T)> -struct testTwiceBiggerType { - static void run() { - VERIFY( - detail::IsSupported<typename detail::TwiceBiggerType<T>::Type>::value); - VERIFY(sizeof(typename detail::TwiceBiggerType<T>::Type) == 2 * sizeof(T)); - VERIFY(bool(std::is_signed_v<typename detail::TwiceBiggerType<T>::Type>) == - bool(std::is_signed_v<T>)); - } -}; - -template <typename T> -struct testTwiceBiggerType<T, 8> { - static void run() { - VERIFY_IS_FALSE( - detail::IsSupported<typename detail::TwiceBiggerType<T>::Type>::value); - } -}; - template <typename T> void test() { static bool alreadyRun = false; @@ -77,8 +58,6 @@ void test() { const bool isTSigned = std::is_signed_v<T>; VERIFY(bool(isTSigned) == !bool(T(-1) > T(0))); - testTwiceBiggerType<T>::run(); - using unsignedT = std::make_unsigned_t<T>; VERIFY(sizeof(unsignedT) == sizeof(T)); diff --git a/parser/htmlparser/nsScanner.h b/parser/htmlparser/nsScanner.h @@ -23,7 +23,6 @@ #include "nsIParser.h" #include "mozilla/Encoding.h" #include "nsScannerString.h" -#include "mozilla/CheckedInt.h" class nsReadEndCondition { public: diff --git a/toolkit/xre/dllservices/DynamicBlocklist.h b/toolkit/xre/dllservices/DynamicBlocklist.h @@ -10,7 +10,6 @@ #include <winternl.h> #include "nsWindowsHelpers.h" -#include "mozilla/CheckedInt.h" #include "mozilla/NativeNt.h" #include "mozilla/UniquePtr.h" #include "mozilla/Unused.h" diff --git a/toolkit/xre/dllservices/mozglue/nsWindowsDllInterceptor.h b/toolkit/xre/dllservices/mozglue/nsWindowsDllInterceptor.h @@ -17,7 +17,6 @@ #include "mozilla/Assertions.h" #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" -#include "mozilla/CheckedInt.h" #include "mozilla/DebugOnly.h" #include "mozilla/NativeNt.h" diff --git a/widget/gtk/IMContextWrapper.h b/widget/gtk/IMContextWrapper.h @@ -15,7 +15,6 @@ #include "nsCOMPtr.h" #include "nsTArray.h" #include "nsIWidget.h" -#include "mozilla/CheckedInt.h" #include "mozilla/ContentData.h" #include "mozilla/EventForwards.h" #include "mozilla/Maybe.h" diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp @@ -14,7 +14,6 @@ #include "KeyboardLayout.h" #include <algorithm> -#include "mozilla/CheckedInt.h" #include "mozilla/MiscEvents.h" #include "mozilla/TextEvents.h" #include "mozilla/ToString.h"