commit 0a16df7a28efd3d5fe3d10c7bddec4a07be04d42
parent c17b14ec9d443d7ed5c6fd9610d6e5575465c40f
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Wed, 1 Oct 2025 08:32:28 +0000
Bug 1991396 - Cleanup type definition in Char16.h r=emilio
Also cleanup included headers while we're at it.
Differential Revision: https://phabricator.services.mozilla.com/D266654
Diffstat:
5 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/browser/components/shell/Windows11LimitedAccessFeatures.cpp b/browser/components/shell/Windows11LimitedAccessFeatures.cpp
@@ -29,7 +29,6 @@ static mozilla::LazyLogModule sLog("Windows11LimitedAccessFeatures");
# include "mozilla/Atomics.h"
# include "mozilla/Base64.h"
-# include "mozilla/Char16.h"
# include "mozilla/WinHeaderOnlyUtils.h"
# include "WinUtils.h"
diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp
@@ -22,6 +22,10 @@
#include "js/ValueArray.h"
#include "vm/JSObject.h"
+#ifdef XP_WIN
+# include "mozilla/Char16.h"
+#endif
+
using JS::AutoStableStringChars;
namespace js::ctypes {
diff --git a/mfbt/Char16.h b/mfbt/Char16.h
@@ -19,6 +19,7 @@
# ifdef WIN32
# define MOZ_USE_CHAR16_WRAPPER
+# include <cstddef>
# include <cstdint>
# include "mozilla/Attributes.h"
/**
@@ -44,7 +45,7 @@ class char16ptr_t {
: mPtr(reinterpret_cast<const char16_t*>(aPtr)) {}
/* Without this, nullptr assignment would be ambiguous. */
- constexpr MOZ_IMPLICIT char16ptr_t(decltype(nullptr)) : mPtr(nullptr) {}
+ constexpr MOZ_IMPLICIT char16ptr_t(std::nullptr_t) : mPtr(nullptr) {}
constexpr operator const char16_t*() const { return mPtr; }
operator const wchar_t*() const {
@@ -95,11 +96,11 @@ class char16ptr_t {
bool operator==(const char16ptr_t& aOther) const {
return mPtr == aOther.mPtr;
}
- bool operator==(decltype(nullptr)) const { return mPtr == nullptr; }
+ bool operator==(std::nullptr_t) const { return mPtr == nullptr; }
bool operator!=(const char16ptr_t& aOther) const {
return mPtr != aOther.mPtr;
}
- bool operator!=(decltype(nullptr)) const { return mPtr != nullptr; }
+ bool operator!=(std::nullptr_t) const { return mPtr != nullptr; }
char16ptr_t operator+(int aValue) const { return char16ptr_t(mPtr + aValue); }
char16ptr_t operator+(unsigned int aValue) const {
return char16ptr_t(mPtr + aValue);
@@ -121,8 +122,7 @@ class char16ptr_t {
}
};
-inline decltype((char*)0 - (char*)0) operator-(const char16_t* aX,
- const char16ptr_t aY) {
+inline ptrdiff_t operator-(const char16_t* aX, const char16ptr_t aY) {
return aX - static_cast<const char16_t*>(aY);
}
diff --git a/xpcom/base/nsVersionComparator.cpp b/xpcom/base/nsVersionComparator.cpp
@@ -17,6 +17,7 @@
# include "nsString.h"
# endif
# include "nsAlgorithm.h"
+# include "mozilla/Char16.h"
#endif
struct VersionPart {
diff --git a/xpcom/string/nsString.h b/xpcom/string/nsString.h
@@ -10,6 +10,7 @@
#include <ostream>
#include "mozilla/Attributes.h"
+#include "mozilla/Char16.h"
#include "nsStringFwd.h"