зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322465 part 8 - Use explicit/MOZ_IMPLICIT for the unary constructors in mfbt/. r=Ehsan
MozReview-Commit-ID: 2TpfrAaAIuu --HG-- extra : rebase_source : 4fb5af1beb94c059cbadfaf27fe3949ae8b85efb
This commit is contained in:
Родитель
e551a0b979
Коммит
4e68f1ffa7
|
@ -1,9 +1,11 @@
|
|||
#define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
|
||||
#ifndef MOZ_HEAP_ALLOCATOR
|
||||
#define MOZ_HEAP_ALLOCATOR \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
|
||||
__attribute__((annotate("moz_heap_allocator"))) \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifdef WIN32
|
||||
# define MOZ_USE_CHAR16_WRAPPER
|
||||
# include <cstdint>
|
||||
# include "mozilla/Attributes.h"
|
||||
/**
|
||||
* Win32 API extensively uses wchar_t, which is represented by a separated
|
||||
* builtin type than char16_t per spec. It's not the case for MSVC prior to
|
||||
|
@ -39,13 +40,13 @@ private:
|
|||
"char16_t and wchar_t sizes differ");
|
||||
|
||||
public:
|
||||
char16ptr_t(const char16_t* aPtr) : mPtr(aPtr) {}
|
||||
char16ptr_t(const wchar_t* aPtr) :
|
||||
MOZ_IMPLICIT char16ptr_t(const char16_t* aPtr) : mPtr(aPtr) {}
|
||||
MOZ_IMPLICIT char16ptr_t(const wchar_t* aPtr) :
|
||||
mPtr(reinterpret_cast<const char16_t*>(aPtr))
|
||||
{}
|
||||
|
||||
/* Without this, nullptr assignment would be ambiguous. */
|
||||
constexpr char16ptr_t(decltype(nullptr)) : mPtr(nullptr) {}
|
||||
constexpr MOZ_IMPLICIT char16ptr_t(decltype(nullptr)) : mPtr(nullptr) {}
|
||||
|
||||
operator const char16_t*() const
|
||||
{
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
{
|
||||
return mPtr;
|
||||
}
|
||||
operator bool() const
|
||||
MOZ_IMPLICIT operator bool() const
|
||||
{
|
||||
return mPtr != nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче