Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj.

It's an annotation that is used a lot, and should be used even more, so a
shorter name is better.

MozReview-Commit-ID: 1VS4Dney4WX

--HG--
extra : rebase_source : b26919c1b0fcb32e5339adeef5be5becae6032cf
This commit is contained in:
Nicholas Nethercote 2016-04-27 14:16:50 +10:00
Родитель a5c843fe5f
Коммит 2511b2c327
92 изменённых файлов: 605 добавлений и 614 удалений

Просмотреть файл

@ -166,7 +166,7 @@ private:
uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent);
MOZ_WARN_UNUSED_RESULT bool CheckDocTree() const;
MOZ_MUST_USE bool CheckDocTree() const;
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
nsTArray<DocAccessibleParent*> mChildDocs;

Просмотреть файл

@ -142,7 +142,7 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsIContent *GetBindingParent() const override;
virtual nsXBLBinding *GetXBLBinding() const override;

Просмотреть файл

@ -1392,7 +1392,7 @@ public:
* @param aResult the result. Out param.
* @return false on out of memory errors, true otherwise.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult, const mozilla::fallible_t&);
@ -1765,7 +1765,7 @@ public:
*/
static bool CanAccessNativeAnon();
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
@ -1774,7 +1774,7 @@ public:
}
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
@ -1782,7 +1782,7 @@ public:
return WrapNative(cx, native, nullptr, nullptr, vp, aAllowWrapping);
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static nsresult WrapNative(JSContext *cx, nsISupports *native,
nsWrapperCache *cache,
JS::MutableHandle<JS::Value> vp,
@ -1815,7 +1815,7 @@ public:
* @param aString the string to convert the newlines inside [in/out]
*/
static void PlatformToDOMLineBreaks(nsString &aString);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);

Просмотреть файл

@ -138,7 +138,7 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override;
virtual void SaveSubtreeState() override;

Просмотреть файл

@ -37,7 +37,7 @@ class nsHTMLContentSerializer final : public nsXHTMLContentSerializer {
nsAString& aStr) override;
protected:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool SerializeHTMLAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@ -46,7 +46,7 @@ class nsHTMLContentSerializer final : public nsXHTMLContentSerializer {
int32_t aNamespace,
nsAString& aStr);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;

Просмотреть файл

@ -546,7 +546,7 @@ public:
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
/**

Просмотреть файл

@ -179,14 +179,14 @@ public:
insertBack(aElem);
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
already_AddRefed<nsScriptLoadRequest> Steal(nsScriptLoadRequest* aElem)
{
aElem->removeFrom(*this);
return dont_AddRef(aElem);
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
already_AddRefed<nsScriptLoadRequest> StealFirst()
{
MOZ_ASSERT(!isEmpty());

Просмотреть файл

@ -135,7 +135,7 @@ public:
* Append the contents of this string fragment to aString
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendTo(nsAString& aString,
const mozilla::fallible_t& aFallible) const {
if (mState.mIs2b) {
@ -169,7 +169,7 @@ public:
* @param aLength the length of the substring
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendTo(nsAString& aString, int32_t aOffset, int32_t aLength,
const mozilla::fallible_t& aFallible) const
{

Просмотреть файл

@ -47,7 +47,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
nsAString& aStr,
nsresult& aResult) override;
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) override;
@ -70,7 +70,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
virtual void MaybeEnterInPreContent(nsIContent* aNode) override;
virtual void MaybeLeaveFromPreContent(nsIContent* aNode) override;
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@ -82,13 +82,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
bool IsFirstChildOfOL(nsIContent* aElement);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr);
bool IsShorthandAttr(const nsIAtom* aAttrName,
const nsIAtom* aElementName);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;

Просмотреть файл

@ -72,14 +72,14 @@ class nsXMLContentSerializer : public nsIContentSerializer {
/**
* Appends a char16_t character and increments the column position
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendToString(const char16_t aChar,
nsAString& aOutputStr);
/**
* Appends a nsAString string and increments the column position
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendToString(const nsAString& aStr,
nsAString& aOutputStr);
@ -88,7 +88,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* by mLineBreak, except in the case of raw output.
* It increments the column position.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendToStringConvertLF(const nsAString& aStr,
nsAString& aOutputStr);
@ -96,7 +96,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by wrapping it when necessary.
* It updates the column position.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendToStringWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
@ -104,12 +104,12 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by formating and wrapping it when necessary
* It updates the column position.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
nsAString& aOutputStr);
// used by AppendToStringWrapped
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@ -117,7 +117,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringFormatedWrapped
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendFormatedWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@ -126,7 +126,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsAString &aOutputStr);
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendWrapped_NonWhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
@ -139,7 +139,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add mLineBreak to the string
* It updates the column position and other flags.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendNewLineToString(nsAString& aOutputStr);
@ -147,7 +147,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* Appends a string by translating entities
* It doesn't increment the column position
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr);
@ -197,7 +197,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
nsIContent *aOriginalElement,
const nsAString& aTagNamespaceURI);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@ -207,7 +207,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
uint32_t aSkipAttr,
bool aAddNSAttr);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool SerializeAttr(const nsAString& aPrefix,
const nsAString& aName,
const nsAString& aValue,
@ -239,7 +239,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* aElement and aOriginalElement are the same as the corresponding arguments
* to AppendElementStart.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendEndOfElementStart(mozilla::dom::Element* aEleemnt,
mozilla::dom::Element* aOriginalElement,
nsAString& aStr);
@ -249,7 +249,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* after the serialization ot the start tag.
* (called at the end of AppendElementStart)
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) { return true; };
@ -298,16 +298,16 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* add intendation. Call only in the case of formating and if the current
* position is at 0. It updates the column position.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool AppendIndentation(nsAString& aStr);
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool IncrIndentation(nsIAtom* aName);
void DecrIndentation(nsIAtom* aName);
// Functions to check for newlines that needs to be added between nodes in
// the root of a document. See mAddNewlineForRootNode
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool MaybeAddNewlineForRootNode(nsAString& aStr);
void MaybeFlagNewlineForRootNode(nsINode* aNode);

Просмотреть файл

@ -104,7 +104,7 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
DataType* AddEntry(const nsAString& aKey)
{
EntryType* ent = this->PutEntry(aKey, fallible);

Просмотреть файл

@ -25,7 +25,7 @@ class Promise;
// JSContext.
// Accept strings.
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const nsAString& aArgument,
JS::MutableHandle<JS::Value> aValue);
@ -36,7 +36,7 @@ ToJSValue(JSContext* aCx,
// desirable. So make this a template that only gets used if the argument type
// is actually boolean
template<typename T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsSame<T, bool>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@ -124,7 +124,7 @@ ToJSValue(JSContext* aCx,
}
// Accept CallbackObjects
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
ToJSValue(JSContext* aCx,
CallbackObject& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -140,7 +140,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsWrapperCache (e.g. most
// DOM objects).
template <class T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsBaseOf<nsWrapperCache, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T& aArgument,
@ -156,7 +156,7 @@ ToJSValue(JSContext* aCx,
// Accept typed arrays built from appropriate nsTArray values
template<typename T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsBaseOf<AllTypedArraysBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const TypedArrayCreator<T>& aArgument,
@ -176,7 +176,7 @@ ToJSValue(JSContext* aCx,
// Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
// DOM File).
template <class T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
!IsBaseOf<CallbackObject, T>::value &&
IsBaseOf<nsISupports, T>::value, bool>::Type
@ -194,7 +194,7 @@ ToJSValue(JSContext* aCx,
// Accept nsRefPtr/nsCOMPtr
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const nsCOMPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -203,7 +203,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const RefPtr<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -212,7 +212,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const NonNull<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -222,7 +222,7 @@ ToJSValue(JSContext* aCx,
// Accept WebIDL dictionaries
template <class T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsBaseOf<DictionaryBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@ -232,7 +232,7 @@ ToJSValue(JSContext* aCx,
}
// Accept existing JS values (which may not be same-compartment with us
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@ -241,7 +241,7 @@ ToJSValue(JSContext* aCx, JS::Handle<JS::Value> aArgument,
}
// Accept existing JS values on the Heap (which may not be same-compartment with us
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@ -250,7 +250,7 @@ ToJSValue(JSContext* aCx, const JS::Heap<JS::Value>& aArgument,
}
// Accept existing rooted JS values (which may not be same-compartment with us
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@ -260,7 +260,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JS::Value>& aArgument,
// Accept existing rooted JS objects (which may not be same-compartment with
// us).
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
JS::MutableHandle<JS::Value> aValue)
{
@ -270,7 +270,7 @@ ToJSValue(JSContext* aCx, const JS::Rooted<JSObject*>& aArgument,
// Accept nsresult, for use in rejections, and create an XPCOM
// exception object representing that nsresult.
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
nsresult aArgument,
JS::MutableHandle<JS::Value> aValue);
@ -278,14 +278,14 @@ ToJSValue(JSContext* aCx,
// Accept ErrorResult, for use in rejections, and create an exception
// representing the failure. Note, the ErrorResult must indicate a failure
// with aArgument.Failure() returning true.
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
ErrorResult& aArgument,
JS::MutableHandle<JS::Value> aValue);
// Accept owning WebIDL unions.
template <typename T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsBaseOf<AllOwningUnionBase, T>::value, bool>::Type
ToJSValue(JSContext* aCx,
const T& aArgument,
@ -297,7 +297,7 @@ ToJSValue(JSContext* aCx,
// Accept pointers to other things we accept
template <typename T>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
typename EnableIf<IsPointer<T>::value, bool>::Type
ToJSValue(JSContext* aCx,
T aArgument,
@ -308,7 +308,7 @@ ToJSValue(JSContext* aCx,
#ifdef SPIDERMONKEY_PROMISE
// Accept Promise objects, which need special handling.
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
Promise& aArgument,
JS::MutableHandle<JS::Value> aValue);
@ -316,7 +316,7 @@ ToJSValue(JSContext* aCx,
// Accept arrays of other things we accept
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
T* aArguments,
size_t aLength,
@ -343,7 +343,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const nsTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -353,7 +353,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const FallibleTArray<T>& aArgument,
JS::MutableHandle<JS::Value> aValue)
@ -363,7 +363,7 @@ ToJSValue(JSContext* aCx,
}
template <typename T, int N>
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
ToJSValue(JSContext* aCx,
const T(&aArgument)[N],
JS::MutableHandle<JS::Value> aValue)

Просмотреть файл

@ -156,8 +156,7 @@ public:
// Whether the value change should be notified to the frame/contet nor not.
eSetValue_Notify = 1 << 2
};
MOZ_WARN_UNUSED_RESULT bool SetValue(const nsAString& aValue,
uint32_t aFlags);
MOZ_MUST_USE bool SetValue(const nsAString& aValue, uint32_t aFlags);
void GetValue(nsAString& aValue, bool aIgnoreWrap) const;
void EmptyValue() { if (mValue) mValue->Truncate(); }
bool IsEmpty() const { return mValue ? mValue->IsEmpty() : true; }

Просмотреть файл

@ -59,11 +59,11 @@ public:
virtual bool IsForApp() const = 0;
virtual bool IsForBrowser() const = 0;
MOZ_WARN_UNUSED_RESULT virtual PBlobParent*
MOZ_MUST_USE virtual PBlobParent*
SendPBlobConstructor(PBlobParent* aActor,
const BlobConstructorParams& aParams) = 0;
MOZ_WARN_UNUSED_RESULT virtual PBrowserParent*
MOZ_MUST_USE virtual PBrowserParent*
SendPBrowserConstructor(PBrowserParent* actor,
const TabId& aTabId,
const IPCTabContext& context,

Просмотреть файл

@ -36,7 +36,7 @@ public:
base_type::SetLength(newLen + sExtra);
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool SetLength(size_type newLen, const mozilla::fallible_t&)
{
return base_type::SetLength(newLen + sExtra, mozilla::fallible);

Просмотреть файл

@ -106,7 +106,7 @@ struct BaseRect {
// (including edges) of *this and aRect. If there are no points in that
// intersection, returns an empty rectangle with x/y set to the std::max of the x/y
// of *this and aRect.
MOZ_WARN_UNUSED_RESULT Sub Intersect(const Sub& aRect) const
MOZ_MUST_USE Sub Intersect(const Sub& aRect) const
{
Sub result;
result.x = std::max<T>(x, aRect.x);
@ -134,7 +134,7 @@ struct BaseRect {
// this and aRect2.
// Thus, empty input rectangles are ignored.
// If both rectangles are empty, returns this.
MOZ_WARN_UNUSED_RESULT Sub Union(const Sub& aRect) const
MOZ_MUST_USE Sub Union(const Sub& aRect) const
{
if (IsEmpty()) {
return aRect;
@ -147,7 +147,7 @@ struct BaseRect {
// Returns the smallest rectangle that contains both the points (including
// edges) of both aRect1 and aRect2.
// Thus, empty input rectangles are allowed to affect the result.
MOZ_WARN_UNUSED_RESULT Sub UnionEdges(const Sub& aRect) const
MOZ_MUST_USE Sub UnionEdges(const Sub& aRect) const
{
Sub result;
result.x = std::min(x, aRect.x);
@ -525,7 +525,7 @@ struct BaseRect {
* Clamp aPoint to this rectangle. It is allowed to end up on any
* edge of the rectangle.
*/
MOZ_WARN_UNUSED_RESULT Point ClampPoint(const Point& aPoint) const
MOZ_MUST_USE Point ClampPoint(const Point& aPoint) const
{
return Point(std::max(x, std::min(XMost(), aPoint.x)),
std::max(y, std::min(YMost(), aPoint.y)));
@ -536,7 +536,7 @@ struct BaseRect {
* aRect then the dimensions that don't fit will be shrunk so that they
* do fit. The resulting rect is returned.
*/
MOZ_WARN_UNUSED_RESULT Sub MoveInsideAndClamp(const Sub& aRect) const
MOZ_MUST_USE Sub MoveInsideAndClamp(const Sub& aRect) const
{
Sub rect(std::max(aRect.x, x),
std::max(aRect.y, y),

Просмотреть файл

@ -35,12 +35,12 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
* @param aFromAPP the APP to scale from
* @param aToAPP the APP to scale to
*/
MOZ_WARN_UNUSED_RESULT inline nsPoint
MOZ_MUST_USE inline nsPoint
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_WARN_UNUSED_RESULT inline nsPoint
MOZ_MUST_USE inline nsPoint
RemoveResolution(const float resolution) const;
MOZ_WARN_UNUSED_RESULT inline nsPoint
MOZ_MUST_USE inline nsPoint
ApplyResolution(const float resolution) const;
};

Просмотреть файл

@ -56,7 +56,7 @@ struct nsRect :
// overflowing nscoord values in the 'width' and 'height' fields by
// clamping the width and height values to nscoord_MAX if necessary.
MOZ_WARN_UNUSED_RESULT nsRect SaturatingUnion(const nsRect& aRect) const
MOZ_MUST_USE nsRect SaturatingUnion(const nsRect& aRect) const
{
if (IsEmpty()) {
return aRect;
@ -67,7 +67,7 @@ struct nsRect :
}
}
MOZ_WARN_UNUSED_RESULT nsRect SaturatingUnionEdges(const nsRect& aRect) const
MOZ_MUST_USE nsRect SaturatingUnionEdges(const nsRect& aRect) const
{
#ifdef NS_COORD_IS_FLOAT
return UnionEdges(aRect);
@ -102,7 +102,7 @@ struct nsRect :
#ifndef NS_COORD_IS_FLOAT
// Make all nsRect Union methods be saturating.
MOZ_WARN_UNUSED_RESULT nsRect UnionEdges(const nsRect& aRect) const
MOZ_MUST_USE nsRect UnionEdges(const nsRect& aRect) const
{
return SaturatingUnionEdges(aRect);
}
@ -110,7 +110,7 @@ struct nsRect :
{
*this = aRect1.UnionEdges(aRect2);
}
MOZ_WARN_UNUSED_RESULT nsRect Union(const nsRect& aRect) const
MOZ_MUST_USE nsRect Union(const nsRect& aRect) const
{
return SaturatingUnion(aRect);
}
@ -138,32 +138,32 @@ struct nsRect :
* @param aToAPP the APP to scale to
* @note this can turn an empty rectangle into a non-empty rectangle
*/
MOZ_WARN_UNUSED_RESULT inline nsRect
MOZ_MUST_USE inline nsRect
ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_WARN_UNUSED_RESULT inline nsRect
MOZ_MUST_USE inline nsRect
ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ScaleToNearestPixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ToNearestPixels(nscoord aAppUnitsPerPixel) const;
// Note: this can turn an empty rectangle into a non-empty rectangle
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ScaleToOutsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
// Note: this can turn an empty rectangle into a non-empty rectangle
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ToOutsidePixels(nscoord aAppUnitsPerPixel) const;
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ScaleToInsidePixels(float aXScale, float aYScale,
nscoord aAppUnitsPerPixel) const;
MOZ_WARN_UNUSED_RESULT inline mozilla::gfx::IntRect
MOZ_MUST_USE inline mozilla::gfx::IntRect
ToInsidePixels(nscoord aAppUnitsPerPixel) const;
// This is here only to keep IPDL-generated code happy. DO NOT USE.
@ -172,7 +172,7 @@ struct nsRect :
return IsEqualEdges(aRect);
}
MOZ_WARN_UNUSED_RESULT inline nsRect RemoveResolution(const float aResolution) const;
MOZ_MUST_USE inline nsRect RemoveResolution(const float aResolution) const;
};
/*

Просмотреть файл

@ -297,9 +297,9 @@ public:
* @param aToAPP the APP to scale to
* @note this can turn an empty region into a non-empty region
*/
MOZ_WARN_UNUSED_RESULT nsRegion
MOZ_MUST_USE nsRegion
ScaleToOtherAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const;
MOZ_WARN_UNUSED_RESULT nsRegion
MOZ_MUST_USE nsRegion
ScaleToOtherAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const;
nsRegion& ScaleRoundOut(float aXScale, float aYScale);
nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale);

Просмотреть файл

@ -30,7 +30,7 @@ struct nsSize : public mozilla::gfx::BaseSize<nscoord, nsSize> {
* @param aFromAPP the APP to scale from
* @param aToAPP the APP to scale to
*/
MOZ_WARN_UNUSED_RESULT inline nsSize
MOZ_MUST_USE inline nsSize
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
};

Просмотреть файл

@ -110,9 +110,9 @@ public:
* NS_ERROR_OUT_OF_MEMORY if OOM
* NS_OK is all we have is an approximation
*/
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
/**
* Resets the charset converter so it may be recycled for a completely

Просмотреть файл

@ -135,9 +135,9 @@ public:
* NS_ERROR_OUT_OF_MEMORY if OOM
* NS_OK if all we have is an approximation
*/
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) = 0;
/**
* Resets the charset converter so it may be recycled for a completely

Просмотреть файл

@ -24,9 +24,9 @@ public:
char16_t* aDest,
int32_t* aDestLength) override;
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;

Просмотреть файл

@ -49,9 +49,9 @@ protected:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
//--------------------------------------------------------------------
// Subclassing of nsBasicDecoderSupport class [declaration]

Просмотреть файл

@ -48,9 +48,9 @@ public:
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override;
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override {mHighSurrogate = 0; return NS_OK;}

Просмотреть файл

@ -24,9 +24,9 @@ public:
//--------------------------------------------------------------------
// Subclassing of nsDecoderSupport class [declaration]
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;
protected:

Просмотреть файл

@ -19,9 +19,9 @@ public:
NS_IMETHOD Convert(const char16_t* aSrc, int32_t* aSrcLength,
char* aDest, int32_t* aDestLength);
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength);
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength);
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength);
NS_IMETHOD Reset();
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,

Просмотреть файл

@ -29,9 +29,9 @@ public:
NS_IMETHOD Finish(char* aDest,
int32_t* aDestLength) override;
MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength) override;
NS_IMETHOD Reset() override;

Просмотреть файл

@ -81,30 +81,30 @@ class Pickle {
// the Pickle, initialize *iter to NULL. If successful, these methods return
// true. Otherwise, false is returned to indicate that the result could not
// be extracted.
MOZ_WARN_UNUSED_RESULT bool ReadBool(void** iter, bool* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadInt16(void** iter, int16_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadUInt16(void** iter, uint16_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadShort(void** iter, short* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadInt(void** iter, int* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadLong(void** iter, long* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadULong(void** iter, unsigned long* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadSize(void** iter, size_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadInt32(void** iter, int32_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadUInt32(void** iter, uint32_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadInt64(void** iter, int64_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadUInt64(void** iter, uint64_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadDouble(void** iter, double* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadIntPtr(void** iter, intptr_t* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadUnsignedChar(void** iter, unsigned char* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadString(void** iter, std::string* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadWString(void** iter, std::wstring* result) const;
MOZ_WARN_UNUSED_RESULT bool ReadData(void** iter, const char** data, int* length) const;
MOZ_WARN_UNUSED_RESULT bool ReadBytes(void** iter, const char** data, int length,
MOZ_MUST_USE bool ReadBool(void** iter, bool* result) const;
MOZ_MUST_USE bool ReadInt16(void** iter, int16_t* result) const;
MOZ_MUST_USE bool ReadUInt16(void** iter, uint16_t* result) const;
MOZ_MUST_USE bool ReadShort(void** iter, short* result) const;
MOZ_MUST_USE bool ReadInt(void** iter, int* result) const;
MOZ_MUST_USE bool ReadLong(void** iter, long* result) const;
MOZ_MUST_USE bool ReadULong(void** iter, unsigned long* result) const;
MOZ_MUST_USE bool ReadSize(void** iter, size_t* result) const;
MOZ_MUST_USE bool ReadInt32(void** iter, int32_t* result) const;
MOZ_MUST_USE bool ReadUInt32(void** iter, uint32_t* result) const;
MOZ_MUST_USE bool ReadInt64(void** iter, int64_t* result) const;
MOZ_MUST_USE bool ReadUInt64(void** iter, uint64_t* result) const;
MOZ_MUST_USE bool ReadDouble(void** iter, double* result) const;
MOZ_MUST_USE bool ReadIntPtr(void** iter, intptr_t* result) const;
MOZ_MUST_USE bool ReadUnsignedChar(void** iter, unsigned char* result) const;
MOZ_MUST_USE bool ReadString(void** iter, std::string* result) const;
MOZ_MUST_USE bool ReadWString(void** iter, std::wstring* result) const;
MOZ_MUST_USE bool ReadData(void** iter, const char** data, int* length) const;
MOZ_MUST_USE bool ReadBytes(void** iter, const char** data, int length,
uint32_t alignment = sizeof(memberAlignmentType)) const;
// Safer version of ReadInt() checks for the result not being negative.
// Use it for reading the object sizes.
MOZ_WARN_UNUSED_RESULT bool ReadLength(void** iter, int* result) const;
MOZ_MUST_USE bool ReadLength(void** iter, int* result) const;
// Methods for adding to the payload of the Pickle. These values are
// appended to the end of the Pickle's payload. When reading values from a

Просмотреть файл

@ -185,7 +185,7 @@ class CxxCodeGen(CodePrinter, Visitor):
self.printdent()
if md.warn_unused:
self.write('MOZ_WARN_UNUSED_RESULT ')
self.write('MOZ_MUST_USE ')
if md.inline:
self.write('inline ')
if md.never_inline:

Просмотреть файл

@ -77,8 +77,8 @@ class HashMap
// HashMap construction is fallible (due to OOM); thus the user must call
// init after constructing a HashMap and check the return value.
explicit HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {}
MOZ_WARN_UNUSED_RESULT bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
// Return whether the given lookup value is present in the map. E.g.:
//
@ -140,19 +140,19 @@ class HashMap
}
template<typename KeyInput, typename ValueInput>
MOZ_WARN_UNUSED_RESULT bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) {
return impl.add(p,
mozilla::Forward<KeyInput>(k),
mozilla::Forward<ValueInput>(v));
}
template<typename KeyInput>
MOZ_WARN_UNUSED_RESULT bool add(AddPtr& p, KeyInput&& k) {
MOZ_MUST_USE bool add(AddPtr& p, KeyInput&& k) {
return impl.add(p, mozilla::Forward<KeyInput>(k), Value());
}
template<typename KeyInput, typename ValueInput>
MOZ_WARN_UNUSED_RESULT bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) {
return impl.relookupOrAdd(p, k,
mozilla::Forward<KeyInput>(k),
mozilla::Forward<ValueInput>(v));
@ -223,7 +223,7 @@ class HashMap
// Overwrite existing value with v. Return false on oom.
template<typename KeyInput, typename ValueInput>
MOZ_WARN_UNUSED_RESULT bool put(KeyInput&& k, ValueInput&& v) {
MOZ_MUST_USE bool put(KeyInput&& k, ValueInput&& v) {
AddPtr p = lookupForAdd(k);
if (p) {
p->value() = mozilla::Forward<ValueInput>(v);
@ -234,7 +234,7 @@ class HashMap
// Like put, but assert that the given key is not already present.
template<typename KeyInput, typename ValueInput>
MOZ_WARN_UNUSED_RESULT bool putNew(KeyInput&& k, ValueInput&& v) {
MOZ_MUST_USE bool putNew(KeyInput&& k, ValueInput&& v) {
return impl.putNew(k, mozilla::Forward<KeyInput>(k), mozilla::Forward<ValueInput>(v));
}
@ -331,8 +331,8 @@ class HashSet
// HashSet construction is fallible (due to OOM); thus the user must call
// init after constructing a HashSet and check the return value.
explicit HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {}
MOZ_WARN_UNUSED_RESULT bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
MOZ_MUST_USE bool init(uint32_t len = 16) { return impl.init(len); }
bool initialized() const { return impl.initialized(); }
// Return whether the given lookup value is present in the map. E.g.:
//
@ -389,12 +389,12 @@ class HashSet
AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); }
template <typename U>
MOZ_WARN_UNUSED_RESULT bool add(AddPtr& p, U&& u) {
MOZ_MUST_USE bool add(AddPtr& p, U&& u) {
return impl.add(p, mozilla::Forward<U>(u));
}
template <typename U>
MOZ_WARN_UNUSED_RESULT bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) {
return impl.relookupOrAdd(p, l, mozilla::Forward<U>(u));
}
@ -463,19 +463,19 @@ class HashSet
// Add |u| if it is not present already. Return false on oom.
template <typename U>
MOZ_WARN_UNUSED_RESULT bool put(U&& u) {
MOZ_MUST_USE bool put(U&& u) {
AddPtr p = lookupForAdd(u);
return p ? true : add(p, mozilla::Forward<U>(u));
}
// Like put, but assert that the given key is not already present.
template <typename U>
MOZ_WARN_UNUSED_RESULT bool putNew(U&& u) {
MOZ_MUST_USE bool putNew(U&& u) {
return impl.putNew(u, mozilla::Forward<U>(u));
}
template <typename U>
MOZ_WARN_UNUSED_RESULT bool putNew(const Lookup& l, U&& u) {
MOZ_MUST_USE bool putNew(const Lookup& l, U&& u) {
return impl.putNew(l, mozilla::Forward<U>(u));
}
@ -1193,7 +1193,7 @@ class HashTable : private AllocPolicy
#endif
{}
MOZ_WARN_UNUSED_RESULT bool init(uint32_t length)
MOZ_MUST_USE bool init(uint32_t length)
{
MOZ_ASSERT(!initialized());
@ -1689,7 +1689,7 @@ class HashTable : private AllocPolicy
}
template <typename... Args>
MOZ_WARN_UNUSED_RESULT bool add(AddPtr& p, Args&&... args)
MOZ_MUST_USE bool add(AddPtr& p, Args&&... args)
{
mozilla::ReentrancyGuard g(*this);
MOZ_ASSERT(table);
@ -1738,7 +1738,7 @@ class HashTable : private AllocPolicy
// Note: |l| may be alias arguments in |args|, so this function must take
// care not to use |l| after moving |args|.
template <typename... Args>
MOZ_WARN_UNUSED_RESULT bool putNew(const Lookup& l, Args&&... args)
MOZ_MUST_USE bool putNew(const Lookup& l, Args&&... args)
{
if (!this->checkSimulatedOOM())
return false;
@ -1753,7 +1753,7 @@ class HashTable : private AllocPolicy
// Note: |l| may be a reference to a piece of |u|, so this function
// must take care not to use |l| after moving |u|.
template <typename... Args>
MOZ_WARN_UNUSED_RESULT bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
MOZ_MUST_USE bool relookupOrAdd(AddPtr& p, const Lookup& l, Args&&... args)
{
#ifdef JS_DEBUG
p.generation = generation();

Просмотреть файл

@ -344,7 +344,7 @@ namespace js {
* instances of type |T|. Return false if the calculation overflowed.
*/
template <typename T>
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
CalculateAllocSize(size_t numElems, size_t* bytesOut)
{
*bytesOut = numElems * sizeof(T);
@ -357,7 +357,7 @@ CalculateAllocSize(size_t numElems, size_t* bytesOut)
* false if the calculation overflowed.
*/
template <typename T, typename Extra>
MOZ_WARN_UNUSED_RESULT inline bool
MOZ_MUST_USE inline bool
CalculateAllocSizeWithExtra(size_t numExtra, size_t* bytesOut)
{
*bytesOut = sizeof(T) + numExtra * sizeof(Extra);

Просмотреть файл

@ -2828,11 +2828,11 @@ class MOZ_STACK_CLASS FunctionValidator
Encoder& encoder() { return *encoder_; }
MOZ_WARN_UNUSED_RESULT bool writeInt32Lit(int32_t i32) {
MOZ_MUST_USE bool writeInt32Lit(int32_t i32) {
return encoder().writeExpr(Expr::I32Const) &&
encoder().writeVarS32(i32);
}
MOZ_WARN_UNUSED_RESULT bool writeConstExpr(NumLit lit) {
MOZ_MUST_USE bool writeConstExpr(NumLit lit) {
switch (lit.which()) {
case NumLit::Fixnum:
case NumLit::NegativeInt:
@ -2860,14 +2860,14 @@ class MOZ_STACK_CLASS FunctionValidator
}
MOZ_CRASH("unexpected literal type");
}
MOZ_WARN_UNUSED_RESULT bool writeCall(ParseNode* pn, Expr op) {
MOZ_MUST_USE bool writeCall(ParseNode* pn, Expr op) {
return encoder().writeExpr(op) &&
fg_.addCallSiteLineNum(m().tokenStream().srcCoords.lineNum(pn->pn_pos.begin));
}
MOZ_WARN_UNUSED_RESULT bool prepareCall(ParseNode* pn) {
MOZ_MUST_USE bool prepareCall(ParseNode* pn) {
return fg_.addCallSiteLineNum(m().tokenStream().srcCoords.lineNum(pn->pn_pos.begin));
}
MOZ_WARN_UNUSED_RESULT bool writeSimdOp(SimdType simdType, SimdOperation op) {
MOZ_MUST_USE bool writeSimdOp(SimdType simdType, SimdOperation op) {
Expr expr = SimdToExpr(simdType, op);
if (expr == Expr::Limit)
return true;

Просмотреть файл

@ -345,12 +345,12 @@ class Encoder
Bytes& bytes_;
template <class T>
MOZ_WARN_UNUSED_RESULT bool write(const T& v) {
MOZ_MUST_USE bool write(const T& v) {
return bytes_.append(reinterpret_cast<const uint8_t*>(&v), sizeof(T));
}
template <typename UInt>
MOZ_WARN_UNUSED_RESULT bool writeVarU(UInt i) {
MOZ_MUST_USE bool writeVarU(UInt i) {
do {
uint8_t byte = i & 0x7f;
i >>= 7;
@ -363,7 +363,7 @@ class Encoder
}
template <typename SInt>
MOZ_WARN_UNUSED_RESULT bool writeVarS(SInt i) {
MOZ_MUST_USE bool writeVarS(SInt i) {
bool done;
do {
uint8_t byte = i & 0x7f;
@ -415,44 +415,44 @@ class Encoder
// Fixed-size encoding operations simply copy the literal bytes (without
// attempting to align).
MOZ_WARN_UNUSED_RESULT bool writeFixedU8(uint8_t i) {
MOZ_MUST_USE bool writeFixedU8(uint8_t i) {
return write<uint8_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeFixedU32(uint32_t i) {
MOZ_MUST_USE bool writeFixedU32(uint32_t i) {
return write<uint32_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeFixedF32(float f) {
MOZ_MUST_USE bool writeFixedF32(float f) {
return write<float>(f);
}
MOZ_WARN_UNUSED_RESULT bool writeFixedF64(double d) {
MOZ_MUST_USE bool writeFixedF64(double d) {
return write<double>(d);
}
MOZ_WARN_UNUSED_RESULT bool writeFixedI32x4(const I32x4& i32x4) {
MOZ_MUST_USE bool writeFixedI32x4(const I32x4& i32x4) {
return write<I32x4>(i32x4);
}
MOZ_WARN_UNUSED_RESULT bool writeFixedF32x4(const F32x4& f32x4) {
MOZ_MUST_USE bool writeFixedF32x4(const F32x4& f32x4) {
return write<F32x4>(f32x4);
}
// Variable-length encodings that all use LEB128.
MOZ_WARN_UNUSED_RESULT bool writeVarU32(uint32_t i) {
MOZ_MUST_USE bool writeVarU32(uint32_t i) {
return writeVarU<uint32_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeVarS32(int32_t i) {
MOZ_MUST_USE bool writeVarS32(int32_t i) {
return writeVarS<int32_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeVarU64(uint64_t i) {
MOZ_MUST_USE bool writeVarU64(uint64_t i) {
return writeVarU<uint64_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeVarS64(int64_t i) {
MOZ_MUST_USE bool writeVarS64(int64_t i) {
return writeVarS<int64_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool writeValType(ValType type) {
MOZ_MUST_USE bool writeValType(ValType type) {
static_assert(size_t(ValType::Limit) <= INT8_MAX, "fits");
return writeFixedU8(size_t(type));
}
MOZ_WARN_UNUSED_RESULT bool writeExpr(Expr expr) {
MOZ_MUST_USE bool writeExpr(Expr expr) {
static_assert(size_t(Expr::Limit) <= ExprLimit, "fits");
if (size_t(expr) < UINT8_MAX)
return writeFixedU8(uint8_t(expr));
@ -462,7 +462,7 @@ class Encoder
// Variable-length encodings that allow back-patching.
MOZ_WARN_UNUSED_RESULT bool writePatchableVarU32(size_t* offset) {
MOZ_MUST_USE bool writePatchableVarU32(size_t* offset) {
*offset = bytes_.length();
return writeVarU32(UINT32_MAX);
}
@ -473,7 +473,7 @@ class Encoder
// Byte ranges start with an LEB128 length followed by an arbitrary sequence
// of bytes. When used for strings, bytes are to be interpreted as utf8.
MOZ_WARN_UNUSED_RESULT bool writeBytes(const void* bytes, uint32_t numBytes) {
MOZ_MUST_USE bool writeBytes(const void* bytes, uint32_t numBytes) {
return writeVarU32(numBytes) &&
bytes_.append(reinterpret_cast<const uint8_t*>(bytes), numBytes);
}
@ -485,7 +485,7 @@ class Encoder
// after the section length is the string id of the section.
template <size_t IdSizeWith0>
MOZ_WARN_UNUSED_RESULT bool startSection(const char (&id)[IdSizeWith0], size_t* offset) {
MOZ_MUST_USE bool startSection(const char (&id)[IdSizeWith0], size_t* offset) {
static const size_t IdSize = IdSizeWith0 - 1;
MOZ_ASSERT(id[IdSize] == '\0');
return writeVarU32(IdSize) &&
@ -508,7 +508,7 @@ class Decoder
const uint8_t* cur_;
template <class T>
MOZ_WARN_UNUSED_RESULT bool read(T* out) {
MOZ_MUST_USE bool read(T* out) {
if (bytesRemain() < sizeof(T))
return false;
memcpy((void*)out, cur_, sizeof(T));
@ -526,7 +526,7 @@ class Decoder
}
template <typename UInt>
MOZ_WARN_UNUSED_RESULT bool readVarU(UInt* out) {
MOZ_MUST_USE bool readVarU(UInt* out) {
const unsigned numBits = sizeof(UInt) * CHAR_BIT;
const unsigned remainderBits = numBits % 7;
const unsigned numBitsInSevens = numBits - remainderBits;
@ -550,7 +550,7 @@ class Decoder
}
template <typename SInt>
MOZ_WARN_UNUSED_RESULT bool readVarS(SInt* out) {
MOZ_MUST_USE bool readVarS(SInt* out) {
const unsigned numBits = sizeof(SInt) * CHAR_BIT;
const unsigned remainderBits = numBits % 7;
const unsigned numBitsInSevens = numBits - remainderBits;
@ -613,40 +613,40 @@ class Decoder
// Fixed-size encoding operations simply copy the literal bytes (without
// attempting to align).
MOZ_WARN_UNUSED_RESULT bool readFixedU8(uint8_t* i) {
MOZ_MUST_USE bool readFixedU8(uint8_t* i) {
return read<uint8_t>(i);
}
MOZ_WARN_UNUSED_RESULT bool readFixedU32(uint32_t* u) {
MOZ_MUST_USE bool readFixedU32(uint32_t* u) {
return read<uint32_t>(u);
}
MOZ_WARN_UNUSED_RESULT bool readFixedF32(float* f) {
MOZ_MUST_USE bool readFixedF32(float* f) {
return read<float>(f);
}
MOZ_WARN_UNUSED_RESULT bool readFixedF64(double* d) {
MOZ_MUST_USE bool readFixedF64(double* d) {
return read<double>(d);
}
MOZ_WARN_UNUSED_RESULT bool readFixedI32x4(I32x4* i32x4) {
MOZ_MUST_USE bool readFixedI32x4(I32x4* i32x4) {
return read<I32x4>(i32x4);
}
MOZ_WARN_UNUSED_RESULT bool readFixedF32x4(F32x4* f32x4) {
MOZ_MUST_USE bool readFixedF32x4(F32x4* f32x4) {
return read<F32x4>(f32x4);
}
// Variable-length encodings that all use LEB128.
MOZ_WARN_UNUSED_RESULT bool readVarU32(uint32_t* out) {
MOZ_MUST_USE bool readVarU32(uint32_t* out) {
return readVarU<uint32_t>(out);
}
MOZ_WARN_UNUSED_RESULT bool readVarS32(int32_t* out) {
MOZ_MUST_USE bool readVarS32(int32_t* out) {
return readVarS<int32_t>(out);
}
MOZ_WARN_UNUSED_RESULT bool readVarU64(uint64_t* out) {
MOZ_MUST_USE bool readVarU64(uint64_t* out) {
return readVarU<uint64_t>(out);
}
MOZ_WARN_UNUSED_RESULT bool readVarS64(int64_t* out) {
MOZ_MUST_USE bool readVarS64(int64_t* out) {
return readVarS<int64_t>(out);
}
MOZ_WARN_UNUSED_RESULT bool readValType(ValType* type) {
MOZ_MUST_USE bool readValType(ValType* type) {
static_assert(uint8_t(ValType::Limit) <= INT8_MAX, "fits");
uint8_t u8;
if (!readFixedU8(&u8))
@ -654,7 +654,7 @@ class Decoder
*type = (ValType)u8;
return true;
}
MOZ_WARN_UNUSED_RESULT bool readExpr(Expr* expr) {
MOZ_MUST_USE bool readExpr(Expr* expr) {
static_assert(size_t(Expr::Limit) <= ExprLimit, "fits");
uint8_t u8;
if (!readFixedU8(&u8))
@ -673,7 +673,7 @@ class Decoder
// See writeBytes comment.
MOZ_WARN_UNUSED_RESULT bool readBytes(Bytes* bytes) {
MOZ_MUST_USE bool readBytes(Bytes* bytes) {
uint32_t numBytes;
if (!readVarU32(&numBytes))
return false;
@ -685,7 +685,7 @@ class Decoder
cur_ += numBytes;
return true;
}
MOZ_WARN_UNUSED_RESULT bool readBytesRaw(uint32_t numBytes, const uint8_t** bytes) {
MOZ_MUST_USE bool readBytesRaw(uint32_t numBytes, const uint8_t** bytes) {
if (bytes)
*bytes = cur_;
if (bytesRemain() < numBytes)
@ -699,7 +699,7 @@ class Decoder
static const uint32_t NotStarted = UINT32_MAX;
template <size_t IdSizeWith0>
MOZ_WARN_UNUSED_RESULT bool startSection(const char (&id)[IdSizeWith0], uint32_t* startOffset,
MOZ_MUST_USE bool startSection(const char (&id)[IdSizeWith0], uint32_t* startOffset,
uint32_t* size) {
static const size_t IdSize = IdSizeWith0 - 1;
MOZ_ASSERT(id[IdSize] == '\0');
@ -723,10 +723,10 @@ class Decoder
*startOffset = NotStarted;
return true;
}
MOZ_WARN_UNUSED_RESULT bool finishSection(uint32_t startOffset, uint32_t size) {
MOZ_MUST_USE bool finishSection(uint32_t startOffset, uint32_t size) {
return size == (cur_ - beg_) - startOffset;
}
MOZ_WARN_UNUSED_RESULT bool skipSection() {
MOZ_MUST_USE bool skipSection() {
uint32_t idSize;
if (!readVarU32(&idSize) || bytesRemain() < idSize)
return false;

Просмотреть файл

@ -505,68 +505,68 @@ class ExprIter : private Policy
bool isInitialized_;
#endif
MOZ_WARN_UNUSED_RESULT bool readFixedU8(uint8_t* out) {
MOZ_MUST_USE bool readFixedU8(uint8_t* out) {
if (Validate)
return d_.readFixedU8(out);
*out = d_.uncheckedReadFixedU8();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readFixedU32(uint32_t* out) {
MOZ_MUST_USE bool readFixedU32(uint32_t* out) {
if (Validate)
return d_.readFixedU32(out);
*out = d_.uncheckedReadFixedU32();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readVarS32(int32_t* out) {
MOZ_MUST_USE bool readVarS32(int32_t* out) {
if (Validate)
return d_.readVarS32(out);
*out = d_.uncheckedReadVarS32();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readVarU32(uint32_t* out) {
MOZ_MUST_USE bool readVarU32(uint32_t* out) {
if (Validate)
return d_.readVarU32(out);
*out = d_.uncheckedReadVarU32();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readVarS64(int64_t* out) {
MOZ_MUST_USE bool readVarS64(int64_t* out) {
if (Validate)
return d_.readVarS64(out);
*out = d_.uncheckedReadVarS64();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readVarU64(uint64_t* out) {
MOZ_MUST_USE bool readVarU64(uint64_t* out) {
if (Validate)
return d_.readVarU64(out);
*out = d_.uncheckedReadVarU64();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readFixedF32(float* out) {
MOZ_MUST_USE bool readFixedF32(float* out) {
if (Validate)
return d_.readFixedF32(out);
*out = d_.uncheckedReadFixedF32();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readFixedF64(double* out) {
MOZ_MUST_USE bool readFixedF64(double* out) {
if (Validate)
return d_.readFixedF64(out);
*out = d_.uncheckedReadFixedF64();
return true;
}
MOZ_WARN_UNUSED_RESULT bool readFixedI32x4(I32x4* out) {
MOZ_MUST_USE bool readFixedI32x4(I32x4* out) {
if (Validate)
return d_.readFixedI32x4(out);
d_.uncheckedReadFixedI32x4(out);
return true;
}
MOZ_WARN_UNUSED_RESULT bool readFixedF32x4(F32x4* out) {
MOZ_MUST_USE bool readFixedF32x4(F32x4* out) {
if (Validate)
return d_.readFixedF32x4(out);
d_.uncheckedReadFixedF32x4(out);
return true;
}
MOZ_WARN_UNUSED_RESULT bool readAtomicViewType(Scalar::Type* viewType) {
MOZ_MUST_USE bool readAtomicViewType(Scalar::Type* viewType) {
uint8_t x;
if (!readFixedU8(&x))
return false;
@ -576,7 +576,7 @@ class ExprIter : private Policy
return true;
}
MOZ_WARN_UNUSED_RESULT bool readAtomicBinOpOp(jit::AtomicOp* op) {
MOZ_MUST_USE bool readAtomicBinOpOp(jit::AtomicOp* op) {
uint8_t x;
if (!readFixedU8(&x))
return false;
@ -822,30 +822,30 @@ class ExprIter : private Policy
bool setInitialized() { return true; }
#endif
MOZ_WARN_UNUSED_RESULT bool typeMismatch(ExprType actual, ExprType expected) MOZ_COLD;
MOZ_WARN_UNUSED_RESULT bool checkType(ExprType actual, ExprType expected);
MOZ_WARN_UNUSED_RESULT bool readFunctionReturnValue(ExprType ret);
MOZ_WARN_UNUSED_RESULT bool checkBranch(uint32_t relativeDepth, ExprType type);
MOZ_WARN_UNUSED_RESULT bool pushControl(LabelKind kind);
MOZ_WARN_UNUSED_RESULT bool popControl(LabelKind* kind, ExprType* type, Value* value);
MOZ_WARN_UNUSED_RESULT bool popControlAfterCheck(LabelKind* kind, ExprType* type, Value* value);
MOZ_WARN_UNUSED_RESULT bool push(ExprType t) { return valueStack_.emplaceBack(t); }
MOZ_WARN_UNUSED_RESULT bool push(TypeAndValue<Value> tv) { return valueStack_.append(tv); }
MOZ_WARN_UNUSED_RESULT bool readLinearMemoryAddress(uint32_t byteSize, LinearMemoryAddress<Value>* addr);
MOZ_MUST_USE bool typeMismatch(ExprType actual, ExprType expected) MOZ_COLD;
MOZ_MUST_USE bool checkType(ExprType actual, ExprType expected);
MOZ_MUST_USE bool readFunctionReturnValue(ExprType ret);
MOZ_MUST_USE bool checkBranch(uint32_t relativeDepth, ExprType type);
MOZ_MUST_USE bool pushControl(LabelKind kind);
MOZ_MUST_USE bool popControl(LabelKind* kind, ExprType* type, Value* value);
MOZ_MUST_USE bool popControlAfterCheck(LabelKind* kind, ExprType* type, Value* value);
MOZ_MUST_USE bool push(ExprType t) { return valueStack_.emplaceBack(t); }
MOZ_MUST_USE bool push(TypeAndValue<Value> tv) { return valueStack_.append(tv); }
MOZ_MUST_USE bool readLinearMemoryAddress(uint32_t byteSize, LinearMemoryAddress<Value>* addr);
void infallibleCheckSuccessor(ControlStackEntry<ControlItem>& controlItem, ExprType type);
void infalliblePush(ExprType t) { valueStack_.infallibleEmplaceBack(t); }
void infalliblePush(TypeAndValue<Value> tv) { valueStack_.infallibleAppend(tv); }
// Test whether reading the top of the value stack is currently valid.
MOZ_WARN_UNUSED_RESULT bool checkTop() {
MOZ_MUST_USE bool checkTop() {
if (Validate && valueStack_.length() <= controlStack_.back().valueStackStart())
return fail("popping value from outside block");
return true;
}
// Pop the top of the value stack.
MOZ_WARN_UNUSED_RESULT bool pop(TypeAndValue<Value>* tv) {
MOZ_MUST_USE bool pop(TypeAndValue<Value>* tv) {
if (!checkTop())
return false;
*tv = valueStack_.popCopy();
@ -853,7 +853,7 @@ class ExprIter : private Policy
}
// Pop the top of the value stack and check that it has the given type.
MOZ_WARN_UNUSED_RESULT bool popWithType(ExprType expectedType, Value* value) {
MOZ_MUST_USE bool popWithType(ExprType expectedType, Value* value) {
if (!checkTop())
return false;
TypeAndValue<Value> tv = valueStack_.popCopy();
@ -864,7 +864,7 @@ class ExprIter : private Policy
}
// Read the top of the value stack (without popping it).
MOZ_WARN_UNUSED_RESULT bool top(TypeAndValue<Value>* tv) {
MOZ_MUST_USE bool top(TypeAndValue<Value>* tv) {
if (!checkTop())
return false;
*tv = valueStack_.back();
@ -873,7 +873,7 @@ class ExprIter : private Policy
// Read the top of the value stack (without popping it) and check that it
// has the given type.
MOZ_WARN_UNUSED_RESULT bool topWithType(ExprType expectedType, Value* value) {
MOZ_MUST_USE bool topWithType(ExprType expectedType, Value* value) {
if (!checkTop())
return false;
TypeAndValue<Value>& tv = valueStack_.back();
@ -908,77 +908,75 @@ class ExprIter : private Policy
bool done() const { return d_.done(); }
// Report a general failure.
MOZ_WARN_UNUSED_RESULT bool fail(const char* msg) MOZ_COLD;
MOZ_MUST_USE bool fail(const char* msg) MOZ_COLD;
// Report an unimplemented feature.
MOZ_WARN_UNUSED_RESULT
bool notYetImplemented(const char* what) MOZ_COLD;
MOZ_MUST_USE bool notYetImplemented(const char* what) MOZ_COLD;
// Report an unrecognized opcode.
MOZ_WARN_UNUSED_RESULT
bool unrecognizedOpcode(Expr expr) MOZ_COLD;
MOZ_MUST_USE bool unrecognizedOpcode(Expr expr) MOZ_COLD;
// ------------------------------------------------------------------------
// Decoding and validation interface.
MOZ_WARN_UNUSED_RESULT bool readExpr(Expr* expr);
MOZ_WARN_UNUSED_RESULT bool readFunctionStart();
MOZ_WARN_UNUSED_RESULT bool readFunctionEnd(ExprType ret);
MOZ_WARN_UNUSED_RESULT bool readReturn();
MOZ_WARN_UNUSED_RESULT bool readBlock();
MOZ_WARN_UNUSED_RESULT bool readLoop();
MOZ_WARN_UNUSED_RESULT bool readIf();
MOZ_WARN_UNUSED_RESULT bool readElse();
MOZ_WARN_UNUSED_RESULT bool readEnd();
MOZ_WARN_UNUSED_RESULT bool readBr();
MOZ_WARN_UNUSED_RESULT bool readBrIf();
MOZ_WARN_UNUSED_RESULT bool readBrTable();
MOZ_WARN_UNUSED_RESULT bool readBrTableEntry(ExprType type, uint32_t* depth);
MOZ_WARN_UNUSED_RESULT bool readUnreachable();
MOZ_WARN_UNUSED_RESULT bool readUnary(ValType operandType);
MOZ_WARN_UNUSED_RESULT bool readConversion(ValType operandType, ValType resultType);
MOZ_WARN_UNUSED_RESULT bool readBinary(ValType operandType);
MOZ_WARN_UNUSED_RESULT bool readComparison(ValType operandType);
MOZ_WARN_UNUSED_RESULT bool readLoad(ValType resultType, uint32_t byteSize);
MOZ_WARN_UNUSED_RESULT bool readStore(ValType resultType, uint32_t byteSize);
MOZ_WARN_UNUSED_RESULT bool readTrivial();
MOZ_WARN_UNUSED_RESULT bool readSelect();
MOZ_WARN_UNUSED_RESULT bool readGetLocal(const ValTypeVector& locals);
MOZ_WARN_UNUSED_RESULT bool readSetLocal(const ValTypeVector& locals);
MOZ_WARN_UNUSED_RESULT bool readGetGlobal(const GlobalDescVector& globals);
MOZ_WARN_UNUSED_RESULT bool readSetGlobal(const GlobalDescVector& globals);
MOZ_WARN_UNUSED_RESULT bool readI32Const();
MOZ_WARN_UNUSED_RESULT bool readI64Const();
MOZ_WARN_UNUSED_RESULT bool readF32Const();
MOZ_WARN_UNUSED_RESULT bool readF64Const();
MOZ_WARN_UNUSED_RESULT bool readI32x4Const();
MOZ_WARN_UNUSED_RESULT bool readF32x4Const();
MOZ_WARN_UNUSED_RESULT bool readB32x4Const();
MOZ_WARN_UNUSED_RESULT bool readCall();
MOZ_WARN_UNUSED_RESULT bool readCallIndirect();
MOZ_WARN_UNUSED_RESULT bool readCallImport();
MOZ_WARN_UNUSED_RESULT bool readCallArg(ValType type, uint32_t numArgs, uint32_t argIndex, Value* arg);
MOZ_WARN_UNUSED_RESULT bool readCallArgsEnd(uint32_t numArgs);
MOZ_WARN_UNUSED_RESULT bool readCallIndirectCallee(Value* callee);
MOZ_WARN_UNUSED_RESULT bool readCallReturn(ExprType ret);
MOZ_WARN_UNUSED_RESULT bool readAtomicLoad();
MOZ_WARN_UNUSED_RESULT bool readAtomicStore();
MOZ_WARN_UNUSED_RESULT bool readAtomicBinOp();
MOZ_WARN_UNUSED_RESULT bool readAtomicCompareExchange();
MOZ_WARN_UNUSED_RESULT bool readAtomicExchange();
MOZ_WARN_UNUSED_RESULT bool readSimdComparison(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSimdShiftByScalar(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSimdBooleanReduction(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readExtractLane(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readReplaceLane(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSplat(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSwizzle(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readShuffle(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSimdSelect(ValType simdType);
MOZ_WARN_UNUSED_RESULT bool readSimdCtor();
MOZ_WARN_UNUSED_RESULT bool readSimdCtorArg(ValType elementType, uint32_t numElements, uint32_t argIndex, Value* arg);
MOZ_WARN_UNUSED_RESULT bool readSimdCtorArgsEnd(uint32_t numElements);
MOZ_WARN_UNUSED_RESULT bool readSimdCtorReturn(ValType simdType);
MOZ_MUST_USE bool readExpr(Expr* expr);
MOZ_MUST_USE bool readFunctionStart();
MOZ_MUST_USE bool readFunctionEnd(ExprType ret);
MOZ_MUST_USE bool readReturn();
MOZ_MUST_USE bool readBlock();
MOZ_MUST_USE bool readLoop();
MOZ_MUST_USE bool readIf();
MOZ_MUST_USE bool readElse();
MOZ_MUST_USE bool readEnd();
MOZ_MUST_USE bool readBr();
MOZ_MUST_USE bool readBrIf();
MOZ_MUST_USE bool readBrTable();
MOZ_MUST_USE bool readBrTableEntry(ExprType type, uint32_t* depth);
MOZ_MUST_USE bool readUnreachable();
MOZ_MUST_USE bool readUnary(ValType operandType);
MOZ_MUST_USE bool readConversion(ValType operandType, ValType resultType);
MOZ_MUST_USE bool readBinary(ValType operandType);
MOZ_MUST_USE bool readComparison(ValType operandType);
MOZ_MUST_USE bool readLoad(ValType resultType, uint32_t byteSize);
MOZ_MUST_USE bool readStore(ValType resultType, uint32_t byteSize);
MOZ_MUST_USE bool readTrivial();
MOZ_MUST_USE bool readSelect();
MOZ_MUST_USE bool readGetLocal(const ValTypeVector& locals);
MOZ_MUST_USE bool readSetLocal(const ValTypeVector& locals);
MOZ_MUST_USE bool readGetGlobal(const GlobalDescVector& globals);
MOZ_MUST_USE bool readSetGlobal(const GlobalDescVector& globals);
MOZ_MUST_USE bool readI32Const();
MOZ_MUST_USE bool readI64Const();
MOZ_MUST_USE bool readF32Const();
MOZ_MUST_USE bool readF64Const();
MOZ_MUST_USE bool readI32x4Const();
MOZ_MUST_USE bool readF32x4Const();
MOZ_MUST_USE bool readB32x4Const();
MOZ_MUST_USE bool readCall();
MOZ_MUST_USE bool readCallIndirect();
MOZ_MUST_USE bool readCallImport();
MOZ_MUST_USE bool readCallArg(ValType type, uint32_t numArgs, uint32_t argIndex, Value* arg);
MOZ_MUST_USE bool readCallArgsEnd(uint32_t numArgs);
MOZ_MUST_USE bool readCallIndirectCallee(Value* callee);
MOZ_MUST_USE bool readCallReturn(ExprType ret);
MOZ_MUST_USE bool readAtomicLoad();
MOZ_MUST_USE bool readAtomicStore();
MOZ_MUST_USE bool readAtomicBinOp();
MOZ_MUST_USE bool readAtomicCompareExchange();
MOZ_MUST_USE bool readAtomicExchange();
MOZ_MUST_USE bool readSimdComparison(ValType simdType);
MOZ_MUST_USE bool readSimdShiftByScalar(ValType simdType);
MOZ_MUST_USE bool readSimdBooleanReduction(ValType simdType);
MOZ_MUST_USE bool readExtractLane(ValType simdType);
MOZ_MUST_USE bool readReplaceLane(ValType simdType);
MOZ_MUST_USE bool readSplat(ValType simdType);
MOZ_MUST_USE bool readSwizzle(ValType simdType);
MOZ_MUST_USE bool readShuffle(ValType simdType);
MOZ_MUST_USE bool readSimdSelect(ValType simdType);
MOZ_MUST_USE bool readSimdCtor();
MOZ_MUST_USE bool readSimdCtorArg(ValType elementType, uint32_t numElements, uint32_t argIndex, Value* arg);
MOZ_MUST_USE bool readSimdCtorArgsEnd(uint32_t numElements);
MOZ_MUST_USE bool readSimdCtorReturn(ValType simdType);
// ------------------------------------------------------------------------
// Translation interface. These methods provide the information obtained
@ -1062,7 +1060,7 @@ ExprIter<Policy>::typeMismatch(ExprType actual, ExprType expected)
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::checkType(ExprType actual, ExprType expected)
{
if (!Validate) {
@ -1698,7 +1696,7 @@ ExprIter<Policy>::readSetGlobal(const GlobalDescVector& globals)
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readI32Const()
{
return readVarS32(&u_.i32) &&
@ -1707,7 +1705,7 @@ ExprIter<Policy>::readI32Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readI64Const()
{
return readVarS64(&u_.i64) &&
@ -1716,7 +1714,7 @@ ExprIter<Policy>::readI64Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readF32Const()
{
if (!readFixedF32(&u_.f32))
@ -1733,7 +1731,7 @@ ExprIter<Policy>::readF32Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readF64Const()
{
if (!readFixedF64(&u_.f64))
@ -1750,7 +1748,7 @@ ExprIter<Policy>::readF64Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readI32x4Const()
{
return readFixedI32x4(&u_.i32x4) &&
@ -1759,7 +1757,7 @@ ExprIter<Policy>::readI32x4Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readF32x4Const()
{
return readFixedF32x4(&u_.f32x4) &&
@ -1768,7 +1766,7 @@ ExprIter<Policy>::readF32x4Const()
}
template <typename Policy>
inline MOZ_WARN_UNUSED_RESULT bool
inline MOZ_MUST_USE bool
ExprIter<Policy>::readB32x4Const()
{
return readFixedI32x4(&u_.i32x4) &&

Просмотреть файл

@ -501,7 +501,7 @@ class Module : public mozilla::LinkedListElement<Module>
void specializeToHeap(ArrayBufferObjectMaybeShared* heap);
void despecializeFromHeap(ArrayBufferObjectMaybeShared* heap);
bool sendCodeRangesToProfiler(JSContext* cx);
MOZ_WARN_UNUSED_RESULT bool setProfilingEnabled(JSContext* cx, bool enabled);
MOZ_MUST_USE bool setProfilingEnabled(JSContext* cx, bool enabled);
ImportExit& importToExit(const Import& import);
friend class js::WasmActivation;

Просмотреть файл

@ -740,17 +740,17 @@ class OrderedHashMap
typedef typename Impl::Range Range;
explicit OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
MOZ_WARN_UNUSED_RESULT bool init() { return impl.init(); }
MOZ_MUST_USE bool init() { return impl.init(); }
uint32_t count() const { return impl.count(); }
bool has(const Key& key) const { return impl.has(key); }
Range all() { return impl.all(); }
const Entry* get(const Key& key) const { return impl.get(key); }
Entry* get(const Key& key) { return impl.get(key); }
bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); }
MOZ_WARN_UNUSED_RESULT bool clear() { return impl.clear(); }
MOZ_MUST_USE bool clear() { return impl.clear(); }
template <typename V>
MOZ_WARN_UNUSED_RESULT bool put(const Key& key, V&& value) {
MOZ_MUST_USE bool put(const Key& key, V&& value) {
return impl.put(Entry(key, Forward<V>(value)));
}
@ -792,13 +792,13 @@ class OrderedHashSet
typedef typename Impl::Range Range;
explicit OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {}
MOZ_WARN_UNUSED_RESULT bool init() { return impl.init(); }
MOZ_MUST_USE bool init() { return impl.init(); }
uint32_t count() const { return impl.count(); }
bool has(const T& value) const { return impl.has(value); }
Range all() { return impl.all(); }
MOZ_WARN_UNUSED_RESULT bool put(const T& value) { return impl.put(value); }
MOZ_MUST_USE bool put(const T& value) { return impl.put(value); }
bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); }
MOZ_WARN_UNUSED_RESULT bool clear() { return impl.clear(); }
MOZ_MUST_USE bool clear() { return impl.clear(); }
void rekeyOneEntry(const T& current, const T& newKey) {
return impl.rekeyOneEntry(current, newKey, newKey);

Просмотреть файл

@ -866,11 +866,11 @@ class FullParseHandler
MOZ_ASSERT(pn->isArity(PN_LIST));
pn->pn_xflags |= flag;
}
MOZ_WARN_UNUSED_RESULT ParseNode* parenthesize(ParseNode* pn) {
MOZ_MUST_USE ParseNode* parenthesize(ParseNode* pn) {
pn->setInParens(true);
return pn;
}
MOZ_WARN_UNUSED_RESULT ParseNode* setLikelyIIFE(ParseNode* pn) {
MOZ_MUST_USE ParseNode* setLikelyIIFE(ParseNode* pn) {
return parenthesize(pn);
}
void setPrologue(ParseNode* pn) {

Просмотреть файл

@ -502,7 +502,7 @@ class SyntaxParseHandler
void setBlockId(Node pn, unsigned blockid) {}
void setFlag(Node pn, unsigned flag) {}
void setListFlag(Node pn, unsigned flag) {}
MOZ_WARN_UNUSED_RESULT Node parenthesize(Node node) {
MOZ_MUST_USE Node parenthesize(Node node) {
// A number of nodes have different behavior upon parenthesization, but
// only in some circumstances. Convert these nodes to special
// parenthesized forms.
@ -531,7 +531,7 @@ class SyntaxParseHandler
// to the unparenthesized form: return |node| unchanged.
return node;
}
MOZ_WARN_UNUSED_RESULT Node setLikelyIIFE(Node pn) {
MOZ_MUST_USE Node setLikelyIIFE(Node pn) {
return pn; // Remain in syntax-parse mode.
}
void setPrologue(Node pn) {}

Просмотреть файл

@ -127,7 +127,7 @@ struct Zone : public JS::shadow::Zone,
{
explicit Zone(JSRuntime* rt);
~Zone();
MOZ_WARN_UNUSED_RESULT bool init(bool isSystem);
MOZ_MUST_USE bool init(bool isSystem);
void findOutgoingEdges(js::gc::ComponentFinder<JS::Zone>& finder);
@ -151,7 +151,7 @@ struct Zone : public JS::shadow::Zone,
bool isTooMuchMalloc() const { return gcMallocBytes <= 0; }
void onTooMuchMalloc();
MOZ_WARN_UNUSED_RESULT void* onOutOfMemory(js::AllocFunction allocFunc, size_t nbytes,
MOZ_MUST_USE void* onOutOfMemory(js::AllocFunction allocFunc, size_t nbytes,
void* reallocPtr = nullptr) {
if (!js::CurrentThreadCanAccessRuntime(runtime_))
return nullptr;
@ -380,7 +380,7 @@ struct Zone : public JS::shadow::Zone,
}
// Creates a HashNumber based on getUniqueId. Returns false on OOM.
MOZ_WARN_UNUSED_RESULT bool getHashCode(js::gc::Cell* cell, js::HashNumber* hashp) {
MOZ_MUST_USE bool getHashCode(js::gc::Cell* cell, js::HashNumber* hashp) {
uint64_t uid;
if (!getUniqueId(cell, &uid))
return false;
@ -390,7 +390,7 @@ struct Zone : public JS::shadow::Zone,
// Puts an existing UID in |uidp|, or creates a new UID for this Cell and
// puts that into |uidp|. Returns false on OOM.
MOZ_WARN_UNUSED_RESULT bool getUniqueId(js::gc::Cell* cell, uint64_t* uidp) {
MOZ_MUST_USE bool getUniqueId(js::gc::Cell* cell, uint64_t* uidp) {
MOZ_ASSERT(uidp);
MOZ_ASSERT(js::CurrentThreadCanAccessZone(this));
@ -425,7 +425,7 @@ struct Zone : public JS::shadow::Zone,
}
// Return true if this cell has a UID associated with it.
MOZ_WARN_UNUSED_RESULT bool hasUniqueId(js::gc::Cell* cell) {
MOZ_MUST_USE bool hasUniqueId(js::gc::Cell* cell) {
MOZ_ASSERT(js::CurrentThreadCanAccessZone(this));
return uniqueIds_.has(cell);
}

Просмотреть файл

@ -130,7 +130,7 @@ FOR_EACH_REG_EXP_TREE_TYPE(FORWARD_DECLARE)
// InfallibleVector is like Vector, but all its methods are infallible (they
// crash on OOM). We use this class instead of Vector to avoid a ton of
// MOZ_WARN_UNUSED_RESULT warnings in irregexp code (imported from V8).
// MOZ_MUST_USE warnings in irregexp code (imported from V8).
template<typename T, size_t N>
class InfallibleVector
{

Просмотреть файл

@ -169,7 +169,7 @@ class MOZ_RAII CacheRegisterAllocator
writer_(writer)
{}
MOZ_WARN_UNUSED_RESULT bool init(const AllocatableGeneralRegisterSet& available) {
MOZ_MUST_USE bool init(const AllocatableGeneralRegisterSet& available) {
availableRegs_ = available;
if (!origInputLocations_.resize(writer_.numInputOperands()))
return false;
@ -395,12 +395,12 @@ class MOZ_RAII BaselineCacheIRCompiler : public CacheIRCompiler
stubDataOffset_(stubDataOffset)
{}
MOZ_WARN_UNUSED_RESULT bool init(CacheKind kind);
MOZ_MUST_USE bool init(CacheKind kind);
JitCode* compile();
private:
#define DEFINE_OP(op) MOZ_WARN_UNUSED_RESULT bool emit##op();
#define DEFINE_OP(op) MOZ_MUST_USE bool emit##op();
CACHE_IR_OPS(DEFINE_OP)
#undef DEFINE_OP

Просмотреть файл

@ -204,7 +204,7 @@ class ExecutableAllocator
static void reprotectPool(JSRuntime* rt, ExecutablePool* pool, ProtectionSetting protection);
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static bool makeWritable(void* start, size_t size)
{
#ifdef NON_WRITABLE_JIT_CODE
@ -214,7 +214,7 @@ class ExecutableAllocator
#endif
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static bool makeExecutable(void* start, size_t size)
{
#ifdef NON_WRITABLE_JIT_CODE
@ -308,7 +308,7 @@ class ExecutableAllocator
void operator=(const ExecutableAllocator&) = delete;
#ifdef NON_WRITABLE_JIT_CODE
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static bool reprotectRegion(void*, size_t, ProtectionSetting);
#endif

Просмотреть файл

@ -32,7 +32,7 @@ class FixedList
{ }
// Dynamic memory allocation requires the ability to report failure.
MOZ_WARN_UNUSED_RESULT bool init(TempAllocator& alloc, size_t length) {
MOZ_MUST_USE bool init(TempAllocator& alloc, size_t length) {
length_ = length;
if (length == 0)
return true;
@ -57,7 +57,7 @@ class FixedList
length_ -= num;
}
MOZ_WARN_UNUSED_RESULT bool growBy(TempAllocator& alloc, size_t num) {
MOZ_MUST_USE bool growBy(TempAllocator& alloc, size_t num) {
size_t newlength = length_ + num;
if (newlength < length_)
return false;

Просмотреть файл

@ -1221,7 +1221,7 @@ class MVariadicT : public T
FixedList<MUse> operands_;
protected:
MOZ_WARN_UNUSED_RESULT bool init(TempAllocator& alloc, size_t length) {
MOZ_MUST_USE bool init(TempAllocator& alloc, size_t length) {
return operands_.init(alloc, length);
}
void initOperand(size_t index, MDefinition* operand) {
@ -2022,7 +2022,7 @@ class MSimdGeneralShuffle :
return new(alloc) MSimdGeneralShuffle(numVectors, numLanes, type);
}
MOZ_WARN_UNUSED_RESULT bool init(TempAllocator& alloc) {
MOZ_MUST_USE bool init(TempAllocator& alloc) {
return MVariadicInstruction::init(alloc, numVectors_ + numLanes_);
}
void setVector(unsigned i, MDefinition* vec) {
@ -2666,7 +2666,7 @@ class MTableSwitch final
return successors_.length();
}
MOZ_WARN_UNUSED_RESULT bool addSuccessor(MBasicBlock* successor, size_t* index) {
MOZ_MUST_USE bool addSuccessor(MBasicBlock* successor, size_t* index) {
MOZ_ASSERT(successors_.length() < (size_t)(high_ - low_ + 2));
MOZ_ASSERT(!successors_.empty());
*index = successors_.length();
@ -2711,14 +2711,14 @@ class MTableSwitch final
return high() - low() + 1;
}
MOZ_WARN_UNUSED_RESULT bool addDefault(MBasicBlock* block, size_t* index = nullptr) {
MOZ_MUST_USE bool addDefault(MBasicBlock* block, size_t* index = nullptr) {
MOZ_ASSERT(successors_.empty());
if (index)
*index = 0;
return successors_.append(block);
}
MOZ_WARN_UNUSED_RESULT bool addCase(size_t successorIndex) {
MOZ_MUST_USE bool addCase(size_t successorIndex) {
return cases_.append(successorIndex);
}
@ -2727,7 +2727,7 @@ class MTableSwitch final
return blocks_[i];
}
MOZ_WARN_UNUSED_RESULT bool addBlock(MBasicBlock* block) {
MOZ_MUST_USE bool addBlock(MBasicBlock* block) {
return blocks_.append(block);
}
@ -3630,7 +3630,7 @@ class MArrayState
explicit MArrayState(MDefinition* arr);
MOZ_WARN_UNUSED_RESULT bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* len);
MOZ_MUST_USE bool init(TempAllocator& alloc, MDefinition* obj, MDefinition* len);
void initElement(uint32_t index, MDefinition* def) {
initOperand(index + 2, def);
@ -7349,11 +7349,11 @@ class MPhi final
// Add types for this phi which speculate about new inputs that may come in
// via a loop backedge.
MOZ_WARN_UNUSED_RESULT bool addBackedgeType(MIRType type, TemporaryTypeSet* typeSet);
MOZ_MUST_USE bool addBackedgeType(MIRType type, TemporaryTypeSet* typeSet);
// Initializes the operands vector to the given capacity,
// permitting use of addInput() instead of addInputSlow().
MOZ_WARN_UNUSED_RESULT bool reserveLength(size_t length) {
MOZ_MUST_USE bool reserveLength(size_t length) {
return inputs_.reserve(length);
}
@ -7364,7 +7364,7 @@ class MPhi final
// Appends a new input to the input vector. May perform reallocation.
// Prefer reserveLength() and addInput() instead, where possible.
MOZ_WARN_UNUSED_RESULT bool addInputSlow(MDefinition* ins) {
MOZ_MUST_USE bool addInputSlow(MDefinition* ins) {
return inputs_.emplaceBack(ins, this);
}
@ -13396,7 +13396,7 @@ class MResumePoint final :
protected:
// Initializes operands_ to an empty array of a fixed length.
// The array may then be filled in by inherit().
MOZ_WARN_UNUSED_RESULT bool init(TempAllocator& alloc);
MOZ_MUST_USE bool init(TempAllocator& alloc);
void clearOperand(size_t index) {
// FixedList doesn't initialize its elements, so do an unchecked init.

Просмотреть файл

@ -47,11 +47,11 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
private:
MBasicBlock(MIRGraph& graph, const CompileInfo& info, BytecodeSite* site, Kind kind);
MOZ_WARN_UNUSED_RESULT bool init();
MOZ_MUST_USE bool init();
void copySlots(MBasicBlock* from);
MOZ_WARN_UNUSED_RESULT bool inherit(TempAllocator& alloc, BytecodeAnalysis* analysis, MBasicBlock* pred,
MOZ_MUST_USE bool inherit(TempAllocator& alloc, BytecodeAnalysis* analysis, MBasicBlock* pred,
uint32_t popped, unsigned stackPhiCount = 0);
MOZ_WARN_UNUSED_RESULT bool inheritResumePoint(MBasicBlock* pred);
MOZ_MUST_USE bool inheritResumePoint(MBasicBlock* pred);
void assertUsesAreNotWithin(MUseIterator use, MUseIterator end);
// This block cannot be reached by any means.
@ -154,8 +154,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
MDefinition* argumentsObject();
// Increase the number of slots available
MOZ_WARN_UNUSED_RESULT bool increaseSlots(size_t num);
MOZ_WARN_UNUSED_RESULT bool ensureHasSlots(size_t num);
MOZ_MUST_USE bool increaseSlots(size_t num);
MOZ_MUST_USE bool ensureHasSlots(size_t num);
// Initializes a slot value; must not be called for normal stack
// operations, as it will not create new SSA names for copies.
@ -166,7 +166,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
// In an OSR block, set all MOsrValues to use the MResumePoint attached to
// the MStart.
MOZ_WARN_UNUSED_RESULT bool linkOsrValues(MStart* start);
MOZ_MUST_USE bool linkOsrValues(MStart* start);
// Sets the instruction associated with various slot types. The
// instruction must lie at the top of the stack.
@ -220,17 +220,17 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
// Adds a predecessor. Every predecessor must have the same exit stack
// depth as the entry state to this block. Adding a predecessor
// automatically creates phi nodes and rewrites uses as needed.
MOZ_WARN_UNUSED_RESULT bool addPredecessor(TempAllocator& alloc, MBasicBlock* pred);
MOZ_WARN_UNUSED_RESULT bool addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_t popped);
MOZ_MUST_USE bool addPredecessor(TempAllocator& alloc, MBasicBlock* pred);
MOZ_MUST_USE bool addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_t popped);
// Add a predecessor which won't introduce any new phis to this block.
// This may be called after the contents of this block have been built.
void addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existingPred);
// Stranger utilities used for inlining.
MOZ_WARN_UNUSED_RESULT bool addPredecessorWithoutPhis(MBasicBlock* pred);
MOZ_MUST_USE bool addPredecessorWithoutPhis(MBasicBlock* pred);
void inheritSlots(MBasicBlock* parent);
MOZ_WARN_UNUSED_RESULT bool initEntrySlots(TempAllocator& alloc);
MOZ_MUST_USE bool initEntrySlots(TempAllocator& alloc);
// Replaces an edge for a given block with a new block. This is
// used for critical edge splitting.
@ -255,8 +255,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
// Sets a back edge. This places phi nodes and rewrites instructions within
// the current loop as necessary. If the backedge introduces new types for
// phis at the loop header, returns a disabling abort.
MOZ_WARN_UNUSED_RESULT AbortReason setBackedge(MBasicBlock* block);
MOZ_WARN_UNUSED_RESULT bool setBackedgeAsmJS(MBasicBlock* block);
MOZ_MUST_USE AbortReason setBackedge(MBasicBlock* block);
MOZ_MUST_USE bool setBackedgeAsmJS(MBasicBlock* block);
// Resets a LOOP_HEADER block to a NORMAL block. This is needed when
// optimizations remove the backedge.
@ -271,10 +271,10 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
void inheritPhis(MBasicBlock* header);
// Propagates backedge slots into phis operands of the loop header.
MOZ_WARN_UNUSED_RESULT bool inheritPhisFromBackedge(MBasicBlock* backedge, bool* hadTypeChange);
MOZ_MUST_USE bool inheritPhisFromBackedge(MBasicBlock* backedge, bool* hadTypeChange);
// Compute the types for phis in this block according to their inputs.
MOZ_WARN_UNUSED_RESULT bool specializePhis();
MOZ_MUST_USE bool specializePhis();
void insertBefore(MInstruction* at, MInstruction* ins);
void insertAfter(MInstruction* at, MInstruction* ins);
@ -773,7 +773,7 @@ class MIRGraph
return returnAccumulator_;
}
MOZ_WARN_UNUSED_RESULT bool addReturn(MBasicBlock* returnBlock) {
MOZ_MUST_USE bool addReturn(MBasicBlock* returnBlock) {
if (!returnAccumulator_)
return true;

Просмотреть файл

@ -1619,7 +1619,7 @@ CodeGeneratorShared::jumpToBlock(MBasicBlock* mir, Assembler::Condition cond)
}
#endif
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
CodeGeneratorShared::addCacheLocations(const CacheLocationList& locs, size_t* numLocs,
size_t* curIndex)
{

Просмотреть файл

@ -262,7 +262,7 @@ class CodeGeneratorShared : public LElementVisitor
};
protected:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool allocateData(size_t size, size_t* offset) {
MOZ_ASSERT(size % sizeof(void*) == 0);
*offset = runtimeData_.length();

Просмотреть файл

@ -617,7 +617,7 @@ class BaseAssemblerX64 : public BaseAssembler
m_formatter.oneByteOp64(OP_MOVSXD_GvEv, offset, base, index, scale, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
movl_ripr(RegisterID dst)
{
m_formatter.oneByteRipOp(OP_MOV_GvEv, 0, (RegisterID)dst);
@ -626,7 +626,7 @@ class BaseAssemblerX64 : public BaseAssembler
return label;
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
movl_rrip(RegisterID src)
{
m_formatter.oneByteRipOp(OP_MOV_EvGv, 0, (RegisterID)src);
@ -635,7 +635,7 @@ class BaseAssemblerX64 : public BaseAssembler
return label;
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
movq_ripr(RegisterID dst)
{
m_formatter.oneByteRipOp64(OP_MOV_GvEv, 0, dst);
@ -650,7 +650,7 @@ class BaseAssemblerX64 : public BaseAssembler
m_formatter.oneByteOp64(OP_LEA, offset, base, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
leaq_rip(RegisterID dst)
{
m_formatter.oneByteRipOp64(OP_LEA, 0, dst);
@ -714,44 +714,44 @@ class BaseAssemblerX64 : public BaseAssembler
twoByteOpInt64Simd("vmovq", VEX_PD, OP2_MOVD_VdEd, src, invalid_xmm, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovsd_ripr(XMMRegisterID dst)
{
return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_VsdWsd, invalid_xmm, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovss_ripr(XMMRegisterID dst)
{
return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_VsdWsd, invalid_xmm, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovsd_rrip(XMMRegisterID src)
{
return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_WsdVsd, invalid_xmm, src);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovss_rrip(XMMRegisterID src)
{
return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_WsdVsd, invalid_xmm, src);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovdqa_rrip(XMMRegisterID src)
{
return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_WdqVdq, invalid_xmm, src);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovaps_rrip(XMMRegisterID src)
{
return twoByteRipOpSimd("vmovdqa", VEX_PS, OP2_MOVAPS_WsdVsd, invalid_xmm, src);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovaps_ripr(XMMRegisterID dst)
{
return twoByteRipOpSimd("vmovaps", VEX_PS, OP2_MOVAPS_VsdWsd, invalid_xmm, dst);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
vmovdqa_ripr(XMMRegisterID dst)
{
return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_VdqWdq, invalid_xmm, dst);
@ -759,7 +759,7 @@ class BaseAssemblerX64 : public BaseAssembler
private:
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
twoByteRipOpSimd(const char* name, VexOperandType ty, TwoByteOpcodeID opcode,
XMMRegisterID src0, XMMRegisterID dst)
{

Просмотреть файл

@ -1504,7 +1504,7 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
cmpl_im_disp32(int32_t rhs, int32_t offset, RegisterID base)
{
spew("cmpl $0x%x, " MEM_o32b, rhs, ADDR_o32b(offset, base));
@ -1521,7 +1521,7 @@ public:
return r;
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
cmpl_im_disp32(int32_t rhs, const void* addr)
{
spew("cmpl $0x%x, %p", rhs, addr);
@ -2236,7 +2236,7 @@ public:
// Flow control:
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
call()
{
m_formatter.oneByteOp(OP_CALL_rel32);
@ -2260,7 +2260,7 @@ public:
// Comparison of EAX against a 32-bit immediate. The immediate is patched
// in as if it were a jump target. The intention is to toggle the first
// byte of the instruction between a CMP and a JMP to produce a pseudo-NOP.
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
cmp_eax()
{
m_formatter.oneByteOp(OP_CMP_EAXIv);
@ -2285,7 +2285,7 @@ public:
m_formatter.immediate32(diff - 5);
}
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
jmp()
{
m_formatter.oneByteOp(OP_JMP_rel32);
@ -2328,7 +2328,7 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
jCC(Condition cond)
{
m_formatter.twoByteOp(jccRel32(cond));
@ -4669,7 +4669,7 @@ threeByteOpImmSimd("vblendps", VEX_PD, OP3_BLENDPS_VpsWpsIb, ESCAPE_3A, imm, off
m_buffer.putInt64Unchecked(imm);
}
MOZ_WARN_UNUSED_RESULT JmpSrc
MOZ_MUST_USE JmpSrc
immediateRel32()
{
m_buffer.putIntUnchecked(0);

Просмотреть файл

@ -92,23 +92,23 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared
};
private:
MOZ_WARN_UNUSED_RESULT uint32_t
MOZ_MUST_USE uint32_t
emitAsmJSBoundsCheckBranch(const MAsmJSHeapAccess* mir, const MInstruction* ins,
Register ptr, Label* fail);
public:
// For SIMD and atomic loads and stores (which throw on out-of-bounds):
MOZ_WARN_UNUSED_RESULT uint32_t
MOZ_MUST_USE uint32_t
maybeEmitThrowingAsmJSBoundsCheck(const MAsmJSHeapAccess* mir, const MInstruction* ins,
const LAllocation* ptr);
// For asm.js plain and atomic loads that possibly require a bounds check:
MOZ_WARN_UNUSED_RESULT uint32_t
MOZ_MUST_USE uint32_t
maybeEmitAsmJSLoadBoundsCheck(const MAsmJSLoadHeap* mir, LAsmJSLoadHeap* ins,
OutOfLineLoadTypedArrayOutOfBounds** ool);
// For asm.js plain and atomic stores that possibly require a bounds check:
MOZ_WARN_UNUSED_RESULT uint32_t
MOZ_MUST_USE uint32_t
maybeEmitAsmJSStoreBoundsCheck(const MAsmJSStoreHeap* mir, LAsmJSStoreHeap* ins,
Label** rejoin);

Просмотреть файл

@ -434,7 +434,7 @@ struct JSContext : public js::ExclusiveContext,
return throwing;
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool getPendingException(JS::MutableHandleValue rval);
bool isThrowingOutOfMemory();

Просмотреть файл

@ -521,18 +521,18 @@ struct JSCompartment
JSCompartment(JS::Zone* zone, const JS::CompartmentOptions& options);
~JSCompartment();
MOZ_WARN_UNUSED_RESULT bool init(JSContext* maybecx);
MOZ_MUST_USE bool init(JSContext* maybecx);
MOZ_WARN_UNUSED_RESULT inline bool wrap(JSContext* cx, JS::MutableHandleValue vp,
MOZ_MUST_USE inline bool wrap(JSContext* cx, JS::MutableHandleValue vp,
JS::HandleObject existing = nullptr);
MOZ_WARN_UNUSED_RESULT bool wrap(JSContext* cx, js::MutableHandleString strp);
MOZ_WARN_UNUSED_RESULT bool wrap(JSContext* cx, JS::MutableHandleObject obj,
MOZ_MUST_USE bool wrap(JSContext* cx, js::MutableHandleString strp);
MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandleObject obj,
JS::HandleObject existingArg = nullptr);
MOZ_WARN_UNUSED_RESULT bool wrap(JSContext* cx, JS::MutableHandle<js::PropertyDescriptor> desc);
MOZ_MUST_USE bool wrap(JSContext* cx, JS::MutableHandle<js::PropertyDescriptor> desc);
template<typename T> MOZ_WARN_UNUSED_RESULT bool wrap(JSContext* cx,
JS::AutoVectorRooter<T>& vec) {
template<typename T> MOZ_MUST_USE bool wrap(JSContext* cx,
JS::AutoVectorRooter<T>& vec) {
for (size_t i = 0; i < vec.length(); ++i) {
if (!wrap(cx, vec[i]))
return false;
@ -540,8 +540,8 @@ struct JSCompartment
return true;
};
MOZ_WARN_UNUSED_RESULT bool putWrapper(JSContext* cx, const js::CrossCompartmentKey& wrapped,
const js::Value& wrapper);
MOZ_MUST_USE bool putWrapper(JSContext* cx, const js::CrossCompartmentKey& wrapped,
const js::Value& wrapper);
js::WrapperMap::Ptr lookupWrapper(const js::Value& wrapped) const {
return crossCompartmentWrappers.lookup(js::CrossCompartmentKey(wrapped));

Просмотреть файл

@ -1318,11 +1318,11 @@ class MOZ_STACK_CLASS AutoStableStringChars
: s_(cx), state_(Uninitialized)
{}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool init(JSContext* cx, JSString* s);
/* Like init(), but Latin1 chars are inflated to TwoByte. */
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool initTwoByte(JSContext* cx, JSString* s);
bool isLatin1() const { return state_ == Latin1; }

Просмотреть файл

@ -285,7 +285,7 @@ ClassCanHaveFixedData(const Class* clasp)
// returned in place of the pointer passed. If a GC occurs, the returned pointer
// may be the passed pointer, relocated by GC. If no GC could occur, it's just
// passed through. We root nothing unless necessary.
static MOZ_ALWAYS_INLINE MOZ_WARN_UNUSED_RESULT JSObject*
static MOZ_ALWAYS_INLINE MOZ_MUST_USE JSObject*
SetNewObjectMetadata(ExclusiveContext* cxArg, JSObject* obj)
{
MOZ_ASSERT(!cxArg->compartment()->hasObjectPendingMetadata());

Просмотреть файл

@ -1672,7 +1672,7 @@ js::GetPCCountScriptCount(JSContext* cx)
enum MaybeComma {NO_COMMA, COMMA};
static MOZ_WARN_UNUSED_RESULT bool
static MOZ_MUST_USE bool
AppendJSONProperty(StringBuffer& buf, const char* name, MaybeComma comma = COMMA)
{
if (comma && !buf.append(','))

Просмотреть файл

@ -1372,7 +1372,7 @@ class StringSegmentRange
: stack(cx, StringVector(cx)), cur(cx)
{}
MOZ_WARN_UNUSED_RESULT bool init(JSString* str) {
MOZ_MUST_USE bool init(JSString* str) {
MOZ_ASSERT(stack.empty());
return settle(str);
}
@ -1386,7 +1386,7 @@ class StringSegmentRange
return cur;
}
MOZ_WARN_UNUSED_RESULT bool popFront() {
MOZ_MUST_USE bool popFront() {
MOZ_ASSERT(!empty());
if (stack.empty()) {
cur = nullptr;

Просмотреть файл

@ -282,7 +282,7 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared
// Detach this buffer from its original memory. (This necessarily makes
// views of this buffer unusable for modifying that original memory.)
static MOZ_WARN_UNUSED_RESULT bool
static MOZ_MUST_USE bool
detach(JSContext* cx, Handle<ArrayBufferObject*> buffer, BufferContents newContents);
private:

Просмотреть файл

@ -72,7 +72,7 @@ class StringBuffer
return cb.ref<TwoByteCharBuffer>();
}
MOZ_WARN_UNUSED_RESULT bool inflateChars();
MOZ_MUST_USE bool inflateChars();
public:
explicit StringBuffer(ExclusiveContext* cx)
@ -85,12 +85,12 @@ class StringBuffer
cb.construct<Latin1CharBuffer>(cx);
}
MOZ_WARN_UNUSED_RESULT bool reserve(size_t len) {
MOZ_MUST_USE bool reserve(size_t len) {
if (len > reserved_)
reserved_ = len;
return isLatin1() ? latin1Chars().reserve(len) : twoByteChars().reserve(len);
}
MOZ_WARN_UNUSED_RESULT bool resize(size_t len) {
MOZ_MUST_USE bool resize(size_t len) {
return isLatin1() ? latin1Chars().resize(len) : twoByteChars().resize(len);
}
bool empty() const {
@ -103,7 +103,7 @@ class StringBuffer
return isLatin1() ? latin1Chars()[idx] : twoByteChars()[idx];
}
MOZ_WARN_UNUSED_RESULT bool ensureTwoByteChars() {
MOZ_MUST_USE bool ensureTwoByteChars() {
if (isLatin1() && !inflateChars())
return false;
@ -113,7 +113,7 @@ class StringBuffer
return true;
}
MOZ_WARN_UNUSED_RESULT bool append(const char16_t c) {
MOZ_MUST_USE bool append(const char16_t c) {
if (isLatin1()) {
if (c <= JSString::MAX_LATIN1_CHAR)
return latin1Chars().append(Latin1Char(c));
@ -122,44 +122,44 @@ class StringBuffer
}
return twoByteChars().append(c);
}
MOZ_WARN_UNUSED_RESULT bool append(Latin1Char c) {
MOZ_MUST_USE bool append(Latin1Char c) {
return isLatin1() ? latin1Chars().append(c) : twoByteChars().append(c);
}
MOZ_WARN_UNUSED_RESULT bool append(char c) {
MOZ_MUST_USE bool append(char c) {
return append(Latin1Char(c));
}
inline MOZ_WARN_UNUSED_RESULT bool append(const char16_t* begin, const char16_t* end);
inline MOZ_MUST_USE bool append(const char16_t* begin, const char16_t* end);
MOZ_WARN_UNUSED_RESULT bool append(const char16_t* chars, size_t len) {
MOZ_MUST_USE bool append(const char16_t* chars, size_t len) {
return append(chars, chars + len);
}
MOZ_WARN_UNUSED_RESULT bool append(const Latin1Char* begin, const Latin1Char* end) {
MOZ_MUST_USE bool append(const Latin1Char* begin, const Latin1Char* end) {
return isLatin1() ? latin1Chars().append(begin, end) : twoByteChars().append(begin, end);
}
MOZ_WARN_UNUSED_RESULT bool append(const Latin1Char* chars, size_t len) {
MOZ_MUST_USE bool append(const Latin1Char* chars, size_t len) {
return append(chars, chars + len);
}
MOZ_WARN_UNUSED_RESULT bool append(const JS::ConstCharPtr chars, size_t len) {
MOZ_MUST_USE bool append(const JS::ConstCharPtr chars, size_t len) {
return append(chars.get(), chars.get() + len);
}
MOZ_WARN_UNUSED_RESULT bool appendN(Latin1Char c, size_t n) {
MOZ_MUST_USE bool appendN(Latin1Char c, size_t n) {
return isLatin1() ? latin1Chars().appendN(c, n) : twoByteChars().appendN(c, n);
}
inline MOZ_WARN_UNUSED_RESULT bool append(JSString* str);
inline MOZ_WARN_UNUSED_RESULT bool append(JSLinearString* str);
inline MOZ_WARN_UNUSED_RESULT bool appendSubstring(JSString* base, size_t off, size_t len);
inline MOZ_WARN_UNUSED_RESULT bool appendSubstring(JSLinearString* base, size_t off, size_t len);
inline MOZ_MUST_USE bool append(JSString* str);
inline MOZ_MUST_USE bool append(JSLinearString* str);
inline MOZ_MUST_USE bool appendSubstring(JSString* base, size_t off, size_t len);
inline MOZ_MUST_USE bool appendSubstring(JSLinearString* base, size_t off, size_t len);
MOZ_WARN_UNUSED_RESULT bool append(const char* chars, size_t len) {
MOZ_MUST_USE bool append(const char* chars, size_t len) {
return append(reinterpret_cast<const Latin1Char*>(chars), len);
}
template <size_t ArrayLength>
MOZ_WARN_UNUSED_RESULT bool append(const char (&array)[ArrayLength]) {
MOZ_MUST_USE bool append(const char (&array)[ArrayLength]) {
return append(array, ArrayLength - 1); /* No trailing '\0'. */
}

Просмотреть файл

@ -96,7 +96,7 @@ public:
* within the specified limits), else returns false on failure (there is a
* reference loop/the reference chain has exceeded the specified limits).
*/
MOZ_WARN_UNUSED_RESULT bool Reference() {
MOZ_MUST_USE bool Reference() {
// If we fail this assertion then either a consumer failed to break a
// reference loop/chain, or else they called Reference() more than once
MOZ_ASSERT(*mRefCounter >= 0);

Просмотреть файл

@ -37,8 +37,8 @@
/* Workaround build problem with Sun Studio 12 */
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# undef MOZ_WARN_UNUSED_RESULT
# define MOZ_WARN_UNUSED_RESULT
# undef MOZ_MUST_USE
# define MOZ_MUST_USE
# undef MOZ_ALLOCATOR
# define MOZ_ALLOCATOR
#endif
@ -97,10 +97,10 @@ MFBT_API char* moz_xstrndup(const char* str, size_t strsize)
#if defined(HAVE_POSIX_MEMALIGN)
MFBT_API MOZ_WARN_UNUSED_RESULT
MFBT_API MOZ_MUST_USE
int moz_xposix_memalign(void **ptr, size_t alignment, size_t size);
MFBT_API MOZ_WARN_UNUSED_RESULT
MFBT_API MOZ_MUST_USE
int moz_posix_memalign(void **ptr, size_t alignment, size_t size);
#endif /* if defined(HAVE_POSIX_MEMALIGN) */

Просмотреть файл

@ -111,7 +111,7 @@ struct MOZ_MUST_USE_TYPE MOZ_NON_AUTOABLE already_AddRefed
aUnused << mutableAlreadyAddRefed->take();
}
MOZ_WARN_UNUSED_RESULT T* take()
MOZ_MUST_USE T* take()
{
T* rawPtr = mRawPtr;
mRawPtr = nullptr;

Просмотреть файл

@ -547,14 +547,14 @@ struct AssertionConditionType
#else
# define MOZ_ALWAYS_TRUE(expr) \
do { \
if ( ( expr ) ) { \
/* Silence MOZ_WARN_UNUSED_RESULT. */ \
if ( ( expr ) ) { \
/* Silence MOZ_MUST_USE. */ \
} \
} while (0)
# define MOZ_ALWAYS_FALSE(expr) \
do { \
if ( ( expr ) ) { \
/* Silence MOZ_WARN_UNUSED_RESULT. */ \
if ( ( expr ) ) { \
/* Silence MOZ_MUST_USE. */ \
} \
} while (0)
#endif

Просмотреть файл

@ -313,22 +313,22 @@
#endif
/**
* MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's
* MOZ_MUST_USE tells the compiler to emit a warning if a function's
* return value is not used by the caller.
*
* Place this attribute at the very beginning of a function definition. For
* Place this attribute at the very beginning of a function declaration. For
* example, write
*
* MOZ_WARN_UNUSED_RESULT int foo();
* MOZ_MUST_USE int foo();
*
* or
*
* MOZ_WARN_UNUSED_RESULT int foo() { return 42; }
* MOZ_MUST_USE int foo() { return 42; }
*/
#if defined(__GNUC__) || defined(__clang__)
# define MOZ_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
# define MOZ_MUST_USE __attribute__ ((warn_unused_result))
#else
# define MOZ_WARN_UNUSED_RESULT
# define MOZ_MUST_USE
#endif
/**

Просмотреть файл

@ -344,37 +344,37 @@ class Endian : private EndianUtils
{
protected:
/** Read a uint16_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT uint16_t readUint16(const void* aPtr)
static MOZ_MUST_USE uint16_t readUint16(const void* aPtr)
{
return read<uint16_t>(aPtr);
}
/** Read a uint32_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT uint32_t readUint32(const void* aPtr)
static MOZ_MUST_USE uint32_t readUint32(const void* aPtr)
{
return read<uint32_t>(aPtr);
}
/** Read a uint64_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT uint64_t readUint64(const void* aPtr)
static MOZ_MUST_USE uint64_t readUint64(const void* aPtr)
{
return read<uint64_t>(aPtr);
}
/** Read an int16_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT int16_t readInt16(const void* aPtr)
static MOZ_MUST_USE int16_t readInt16(const void* aPtr)
{
return read<int16_t>(aPtr);
}
/** Read an int32_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT int32_t readInt32(const void* aPtr)
static MOZ_MUST_USE int32_t readInt32(const void* aPtr)
{
return read<uint32_t>(aPtr);
}
/** Read an int64_t in ThisEndian endianness from |aPtr| and return it. */
static MOZ_WARN_UNUSED_RESULT int64_t readInt64(const void* aPtr)
static MOZ_MUST_USE int64_t readInt64(const void* aPtr)
{
return read<int64_t>(aPtr);
}
@ -423,7 +423,7 @@ protected:
* format for transmission.
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapToLittleEndian(T aValue)
MOZ_MUST_USE static T swapToLittleEndian(T aValue)
{
return maybeSwap<ThisEndian, Little>(aValue);
}
@ -453,7 +453,7 @@ protected:
* Converts a value of type T to big-endian format.
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapToBigEndian(T aValue)
MOZ_MUST_USE static T swapToBigEndian(T aValue)
{
return maybeSwap<ThisEndian, Big>(aValue);
}
@ -485,7 +485,7 @@ protected:
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapToNetworkOrder(T aValue)
MOZ_MUST_USE static T swapToNetworkOrder(T aValue)
{
return swapToBigEndian(aValue);
}
@ -508,7 +508,7 @@ protected:
* Converts a value of type T from little-endian format.
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapFromLittleEndian(T aValue)
MOZ_MUST_USE static T swapFromLittleEndian(T aValue)
{
return maybeSwap<Little, ThisEndian>(aValue);
}
@ -538,7 +538,7 @@ protected:
* Converts a value of type T from big-endian format.
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapFromBigEndian(T aValue)
MOZ_MUST_USE static T swapFromBigEndian(T aValue)
{
return maybeSwap<Big, ThisEndian>(aValue);
}
@ -569,7 +569,7 @@ protected:
* in network code.
*/
template<typename T>
MOZ_WARN_UNUSED_RESULT static T swapFromNetworkOrder(T aValue)
MOZ_MUST_USE static T swapFromNetworkOrder(T aValue)
{
return swapFromBigEndian(aValue);
}

Просмотреть файл

@ -414,7 +414,7 @@ FuzzyEqualsMultiplicative(T aValue1, T aValue2,
*
* This function isn't inlined to avoid buggy optimizations by MSVC.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
extern MFBT_API bool
IsFloat32Representable(double aFloat32);

Просмотреть файл

@ -156,7 +156,7 @@ AddUintptrToHash<8>(uint32_t aHash, uintptr_t aValue)
* convert to uint32_t, data pointers, and function pointers.
*/
template<typename A>
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, A aA)
{
/*
@ -167,7 +167,7 @@ AddToHash(uint32_t aHash, A aA)
}
template<typename A>
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, A* aA)
{
/*
@ -181,14 +181,14 @@ AddToHash(uint32_t aHash, A* aA)
}
template<>
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, uintptr_t aA)
{
return detail::AddUintptrToHash<sizeof(uintptr_t)>(aHash, aA);
}
template<typename A, typename... Args>
MOZ_WARN_UNUSED_RESULT uint32_t
MOZ_MUST_USE uint32_t
AddToHash(uint32_t aHash, A aArg, Args... aArgs)
{
return AddToHash(AddToHash(aHash, aArg), aArgs...);
@ -202,7 +202,7 @@ AddToHash(uint32_t aHash, A aArg, Args... aArgs)
* that x has already been hashed.
*/
template<typename... Args>
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashGeneric(Args... aArgs)
{
return AddToHash(0, aArgs...);
@ -240,45 +240,45 @@ HashKnownLength(const T* aStr, size_t aLength)
* If you have the string's length, you might as well call the overload which
* includes the length. It may be marginally faster.
*/
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const char* aStr)
{
return detail::HashUntilZero(reinterpret_cast<const unsigned char*>(aStr));
}
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const char* aStr, size_t aLength)
{
return detail::HashKnownLength(reinterpret_cast<const unsigned char*>(aStr), aLength);
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
inline uint32_t
HashString(const unsigned char* aStr, size_t aLength)
{
return detail::HashKnownLength(aStr, aLength);
}
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const uint16_t* aStr)
{
return detail::HashUntilZero(aStr);
}
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const uint16_t* aStr, size_t aLength)
{
return detail::HashKnownLength(aStr, aLength);
}
#ifdef MOZ_CHAR16_IS_NOT_WCHAR
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const char16_t* aStr)
{
return detail::HashUntilZero(aStr);
}
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const char16_t* aStr, size_t aLength)
{
return detail::HashKnownLength(aStr, aLength);
@ -290,13 +290,13 @@ HashString(const char16_t* aStr, size_t aLength)
* the same width!
*/
#ifdef WIN32
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const wchar_t* aStr)
{
return detail::HashUntilZero(aStr);
}
MOZ_WARN_UNUSED_RESULT inline uint32_t
MOZ_MUST_USE inline uint32_t
HashString(const wchar_t* aStr, size_t aLength)
{
return detail::HashKnownLength(aStr, aLength);
@ -309,7 +309,7 @@ HashString(const wchar_t* aStr, size_t aLength)
* This hash walks word-by-word, rather than byte-by-byte, so you won't get the
* same result out of HashBytes as you would out of HashString.
*/
MOZ_WARN_UNUSED_RESULT extern MFBT_API uint32_t
MOZ_MUST_USE extern MFBT_API uint32_t
HashBytes(const void* bytes, size_t aLength);
} /* namespace mozilla */

Просмотреть файл

@ -159,7 +159,7 @@ public:
// Returns false if the allocation failed. (If you are using an infallible
// allocation policy, use InfallibleAppend() instead.)
template<typename U>
MOZ_WARN_UNUSED_RESULT bool Append(U&& aU)
MOZ_MUST_USE bool Append(U&& aU)
{
Segment* last = mSegments.getLast();
if (!last || last->Length() == kSegmentCapacity) {

Просмотреть файл

@ -131,7 +131,7 @@ public:
{}
#endif
MOZ_WARN_UNUSED_RESULT inline bool init();
MOZ_MUST_USE inline bool init();
inline T get() const;

Просмотреть файл

@ -328,7 +328,7 @@ public:
DeleterType& get_deleter() { return del(); }
const DeleterType& get_deleter() const { return del(); }
MOZ_WARN_UNUSED_RESULT Pointer release()
MOZ_MUST_USE Pointer release()
{
Pointer p = ptr();
ptr() = nullptr;
@ -463,7 +463,7 @@ public:
DeleterType& get_deleter() { return mTuple.second(); }
const DeleterType& get_deleter() const { return mTuple.second(); }
MOZ_WARN_UNUSED_RESULT Pointer release()
MOZ_MUST_USE Pointer release()
{
Pointer p = mTuple.first();
mTuple.first() = nullptr;

Просмотреть файл

@ -268,9 +268,9 @@ class Vector final : private AllocPolicy
friend struct detail::VectorTesting;
MOZ_WARN_UNUSED_RESULT bool growStorageBy(size_t aIncr);
MOZ_WARN_UNUSED_RESULT bool convertToHeapStorage(size_t aNewCap);
MOZ_WARN_UNUSED_RESULT bool maybeCheckSimulatedOOM(size_t aRequestedSize);
MOZ_MUST_USE bool growStorageBy(size_t aIncr);
MOZ_MUST_USE bool convertToHeapStorage(size_t aNewCap);
MOZ_MUST_USE bool maybeCheckSimulatedOOM(size_t aRequestedSize);
/* magic constants */
@ -515,7 +515,7 @@ public:
* Given that the vector is empty and has no inline storage, grow to
* |capacity|.
*/
MOZ_WARN_UNUSED_RESULT bool initCapacity(size_t aRequest);
MOZ_MUST_USE bool initCapacity(size_t aRequest);
/**
* If reserve(aRequest) succeeds and |aRequest >= length()|, then appending
@ -525,7 +525,7 @@ public:
* A request to reserve an amount less than the current length does not affect
* reserved space.
*/
MOZ_WARN_UNUSED_RESULT bool reserve(size_t aRequest);
MOZ_MUST_USE bool reserve(size_t aRequest);
/**
* Destroy elements in the range [end() - aIncr, end()). Does not deallocate
@ -540,18 +540,18 @@ public:
void shrinkTo(size_t aNewLength);
/** Grow the vector by aIncr elements. */
MOZ_WARN_UNUSED_RESULT bool growBy(size_t aIncr);
MOZ_MUST_USE bool growBy(size_t aIncr);
/** Call shrinkBy or growBy based on whether newSize > length(). */
MOZ_WARN_UNUSED_RESULT bool resize(size_t aNewLength);
MOZ_MUST_USE bool resize(size_t aNewLength);
/**
* Increase the length of the vector, but don't initialize the new elements
* -- leave them as uninitialized memory.
*/
MOZ_WARN_UNUSED_RESULT bool growByUninitialized(size_t aIncr);
MOZ_MUST_USE bool growByUninitialized(size_t aIncr);
void infallibleGrowByUninitialized(size_t aIncr);
MOZ_WARN_UNUSED_RESULT bool resizeUninitialized(size_t aNewLength);
MOZ_MUST_USE bool resizeUninitialized(size_t aNewLength);
/** Shorthand for shrinkBy(length()). */
void clear();
@ -574,13 +574,13 @@ public:
* vector, instead of copying it. If it fails, |aU| is left unmoved. ("We are
* not amused.")
*/
template<typename U> MOZ_WARN_UNUSED_RESULT bool append(U&& aU);
template<typename U> MOZ_MUST_USE bool append(U&& aU);
/**
* Construct a T in-place as a new entry at the end of this vector.
*/
template<typename... Args>
MOZ_WARN_UNUSED_RESULT bool emplaceBack(Args&&... aArgs)
MOZ_MUST_USE bool emplaceBack(Args&&... aArgs)
{
if (!growByUninitialized(1))
return false;
@ -589,10 +589,10 @@ public:
}
template<typename U, size_t O, class BP>
MOZ_WARN_UNUSED_RESULT bool appendAll(const Vector<U, O, BP>& aU);
MOZ_WARN_UNUSED_RESULT bool appendN(const T& aT, size_t aN);
template<typename U> MOZ_WARN_UNUSED_RESULT bool append(const U* aBegin, const U* aEnd);
template<typename U> MOZ_WARN_UNUSED_RESULT bool append(const U* aBegin, size_t aLength);
MOZ_MUST_USE bool appendAll(const Vector<U, O, BP>& aU);
MOZ_MUST_USE bool appendN(const T& aT, size_t aN);
template<typename U> MOZ_MUST_USE bool append(const U* aBegin, const U* aEnd);
template<typename U> MOZ_MUST_USE bool append(const U* aBegin, size_t aLength);
/*
* Guaranteed-infallible append operations for use upon vectors whose
@ -636,7 +636,7 @@ public:
*
* N.B. Although a T*, only the range [0, length()) is constructed.
*/
MOZ_WARN_UNUSED_RESULT T* extractRawBuffer();
MOZ_MUST_USE T* extractRawBuffer();
/**
* If elements are stored in-place, allocate a new buffer, move this vector's
@ -654,7 +654,7 @@ public:
* If any of these elements are uninitialized (as growByUninitialized
* enables), behavior is undefined.
*/
MOZ_WARN_UNUSED_RESULT T* extractOrCopyRawBuffer();
MOZ_MUST_USE T* extractOrCopyRawBuffer();
/**
* Transfer ownership of an array of objects into the vector. The caller
@ -682,7 +682,7 @@ public:
* This is inherently a linear-time operation. Be careful!
*/
template<typename U>
MOZ_WARN_UNUSED_RESULT T* insert(T* aP, U&& aVal);
MOZ_MUST_USE T* insert(T* aP, U&& aVal);
/**
* Removes the element |aT|, which must fall in the bounds [begin, end),

Просмотреть файл

@ -35,7 +35,7 @@ public:
};
// We want to test Append(), which is fallible and marked with
// MOZ_WARN_UNUSED_RESULT. But we're using an infallible alloc policy, and so
// MOZ_MUST_USE. But we're using an infallible alloc policy, and so
// don't really need to check the result. Casting to |void| works with clang
// but not GCC, so we instead use this dummy variable which works with both
// compilers.

Просмотреть файл

@ -569,7 +569,7 @@ nsresult NS_BackgroundOutputStream(nsIOutputStream **result,
uint32_t segmentSize = 0,
uint32_t segmentCount = 0);
MOZ_WARN_UNUSED_RESULT nsresult
MOZ_MUST_USE nsresult
NS_NewBufferedInputStream(nsIInputStream **result,
nsIInputStream *str,
uint32_t bufferSize);

Просмотреть файл

@ -326,7 +326,7 @@ NS_NewLocalFileOutputStream(nsIOutputStream **result,
return rv;
}
INLINE_IF_EXTERN MOZ_WARN_UNUSED_RESULT nsresult
INLINE_IF_EXTERN MOZ_MUST_USE nsresult
NS_NewBufferedInputStream(nsIInputStream **result,
nsIInputStream *str,
uint32_t bufferSize)

Просмотреть файл

@ -661,7 +661,7 @@ CacheFileChunk::BufForReading() const
return mBuf ? mBuf : mRWBuf;
}
MOZ_WARN_UNUSED_RESULT nsresult
MOZ_MUST_USE nsresult
CacheFileChunk::EnsureBufSize(uint32_t aBufSize)
{
mFile->AssertOwnsLock();

Просмотреть файл

@ -70,7 +70,7 @@ CreateDummyChannel(nsIURI* aHostURI, NeckoOriginAttributes& aAttrs, bool aIsPriv
namespace mozilla {
namespace net {
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool
CookieServiceParent::GetOriginAttributesFromParams(const IPC::SerializedLoadContext &aLoadContext,
NeckoOriginAttributes& aAttrs,

Просмотреть файл

@ -22,7 +22,7 @@ public:
virtual ~CookieServiceParent();
protected:
MOZ_WARN_UNUSED_RESULT bool
MOZ_MUST_USE bool
GetOriginAttributesFromParams(const IPC::SerializedLoadContext &aLoadContext,
NeckoOriginAttributes& aAttrs,
bool& aIsPrivate);

Просмотреть файл

@ -35,7 +35,7 @@ public:
NeckoParent();
virtual ~NeckoParent();
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static const char *
GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
PContentParent* aBrowser,
@ -48,7 +48,7 @@ public:
*
* Returns null if successful, or an error string if failed.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
static const char*
CreateChannelLoadContext(const PBrowserOrId& aBrowser,
PContentParent* aContent,

Просмотреть файл

@ -143,7 +143,7 @@ public:
PARTIAL_RELIABLE_TIMED = 2
} Type;
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
already_AddRefed<DataChannel> Open(const nsACString& label,
const nsACString& protocol,
Type type, bool inOrder,

Просмотреть файл

@ -24,7 +24,7 @@ class SmartCardThreadList;
namespace mozilla { namespace psm {
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
::already_AddRefed<mozilla::psm::SharedCertVerifier>
GetDefaultCertVerifier();

Просмотреть файл

@ -212,7 +212,7 @@ InstallSigSysHandler(void)
* @see SandboxInfo
* @see BroadcastSetThreadSandbox
*/
static bool MOZ_WARN_UNUSED_RESULT
static bool MOZ_MUST_USE
InstallSyscallFilter(const sock_fprog *aProg, bool aUseTSync)
{
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {

Просмотреть файл

@ -39,28 +39,27 @@ public:
// Throughout, uint32_t aChunk refers only to the chunk number. Chunk data is
// stored in the Prefix structures.
MOZ_WARN_UNUSED_RESULT nsresult NewAddChunk(uint32_t aChunk) {
MOZ_MUST_USE nsresult NewAddChunk(uint32_t aChunk) {
return mAddChunks.Set(aChunk);
};
MOZ_WARN_UNUSED_RESULT nsresult NewSubChunk(uint32_t aChunk) {
MOZ_MUST_USE nsresult NewSubChunk(uint32_t aChunk) {
return mSubChunks.Set(aChunk);
};
MOZ_WARN_UNUSED_RESULT nsresult NewAddExpiration(uint32_t aChunk) {
MOZ_MUST_USE nsresult NewAddExpiration(uint32_t aChunk) {
return mAddExpirations.Set(aChunk);
};
MOZ_WARN_UNUSED_RESULT nsresult NewSubExpiration(uint32_t aChunk) {
MOZ_MUST_USE nsresult NewSubExpiration(uint32_t aChunk) {
return mSubExpirations.Set(aChunk);
};
MOZ_WARN_UNUSED_RESULT nsresult NewAddPrefix(uint32_t aAddChunk,
const Prefix& aPrefix);
MOZ_WARN_UNUSED_RESULT nsresult NewSubPrefix(uint32_t aAddChunk,
const Prefix& aPrefix,
uint32_t aSubChunk);
MOZ_WARN_UNUSED_RESULT nsresult NewAddComplete(uint32_t aChunk,
const Completion& aCompletion);
MOZ_WARN_UNUSED_RESULT nsresult NewSubComplete(uint32_t aAddChunk,
const Completion& aCompletion,
uint32_t aSubChunk);
MOZ_MUST_USE nsresult NewAddPrefix(uint32_t aAddChunk, const Prefix& aPrefix);
MOZ_MUST_USE nsresult NewSubPrefix(uint32_t aAddChunk,
const Prefix& aPrefix,
uint32_t aSubChunk);
MOZ_MUST_USE nsresult NewAddComplete(uint32_t aChunk,
const Completion& aCompletion);
MOZ_MUST_USE nsresult NewSubComplete(uint32_t aAddChunk,
const Completion& aCompletion,
uint32_t aSubChunk);
void SetLocalUpdate(void) { mLocalUpdate = true; }
bool IsLocalUpdate(void) { return mLocalUpdate; }

Просмотреть файл

@ -321,7 +321,7 @@ KeyGenRunnable::KeyGenRunnable(KeyType keyType,
{
}
MOZ_WARN_UNUSED_RESULT nsresult
MOZ_MUST_USE nsresult
GenerateKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey,
@ -347,7 +347,7 @@ GenerateKeyPair(PK11SlotInfo * slot,
}
MOZ_WARN_UNUSED_RESULT nsresult
MOZ_MUST_USE nsresult
GenerateRSAKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey)
@ -361,7 +361,7 @@ GenerateRSAKeyPair(PK11SlotInfo * slot,
&rsaParams);
}
MOZ_WARN_UNUSED_RESULT nsresult
MOZ_MUST_USE nsresult
GenerateDSAKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey)

Просмотреть файл

@ -115,7 +115,7 @@ public:
* to Next() reads another token from the input and shifts the cursor.
* Returns false if we have passed the end of the input.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool Next(Token& aToken);
/**
@ -123,21 +123,21 @@ public:
* and if so, put it into aResult, shift the cursor and return true. Otherwise, leave
* the input read cursor position intact and return false.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool Check(const TokenType aTokenType, Token& aResult);
/**
* Same as above method, just compares both token type and token value passed in aToken.
* When both the type and the value equals, shift the cursor and return true. Otherwise
* return false.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool Check(const Token& aToken);
/**
* Return false iff the last Check*() call has returned false or when we've read past
* the end of the input string.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool HasFailed() const;
/**
@ -166,13 +166,13 @@ public:
/**
* Check whitespace character is present.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckWhite() { return Check(Token::Whitespace()); }
/**
* Check there is a single character on the read cursor position. If so, shift the read
* cursor position and return true. Otherwise false.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckChar(const char aChar) { return Check(Token::Char(aChar)); }
/**
* This is a customizable version of CheckChar. aClassifier is a function called with
@ -181,29 +181,29 @@ public:
* The user classifiction function is not called when we are at or past the end and
* false is immediately returned.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckChar(bool (*aClassifier)(const char aChar));
/**
* Check for a whole expected word.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckWord(const nsACString& aWord) { return Check(Token::Word(aWord)); }
/**
* Shortcut for literal const word check with compile time length calculation.
*/
template <uint32_t N>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckWord(const char (&aWord)[N]) { return Check(Token::Word(nsDependentCString(aWord, N - 1))); }
/**
* Checks \r, \n or \r\n.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckEOL() { return Check(Token::NewLine()); }
/**
* Checks we are at the end of the input string reading. If so, shift past the end
* and returns true. Otherwise does nothing and returns false.
*/
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool CheckEOF() { return Check(Token::EndOfFile()); }
/**

Просмотреть файл

@ -127,8 +127,8 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT bool Put(KeyType aKey, const UserDataType& aData,
const fallible_t&)
MOZ_MUST_USE bool Put(KeyType aKey, const UserDataType& aData,
const fallible_t&)
{
EntryType* ent = this->PutEntry(aKey);
if (!ent) {

Просмотреть файл

@ -88,7 +88,7 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT bool Push(void* aItem, const fallible_t&);
MOZ_MUST_USE bool Push(void* aItem, const fallible_t&);
/**
* Inserts new member at the front of the deque.
@ -102,7 +102,7 @@ public:
}
}
MOZ_WARN_UNUSED_RESULT bool PushFront(void* aItem, const fallible_t&);
MOZ_MUST_USE bool PushFront(void* aItem, const fallible_t&);
/**
* Remove and return the last item in the container.

Просмотреть файл

@ -54,8 +54,8 @@ public:
void Put(KeyType aKey, already_AddRefed<PtrType> aData);
MOZ_WARN_UNUSED_RESULT bool Put(KeyType aKey, already_AddRefed<PtrType> aData,
const mozilla::fallible_t&);
MOZ_MUST_USE bool Put(KeyType aKey, already_AddRefed<PtrType> aData,
const mozilla::fallible_t&);
// Overload Remove, rather than overriding it.
using base_type::Remove;

Просмотреть файл

@ -1196,7 +1196,7 @@ public:
}
template<class Allocator>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool Assign(const nsTArray_Impl<E, Allocator>& aOther,
const mozilla::fallible_t&)
{
@ -1277,7 +1277,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* ReplaceElementsAt(index_type aStart, size_type aCount,
const Item* aArray, size_type aArrayLen,
const mozilla::fallible_t&)
@ -1298,7 +1298,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* ReplaceElementsAt(index_type aStart, size_type aCount,
const nsTArray<Item>& aArray,
const mozilla::fallible_t&)
@ -1317,7 +1317,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* ReplaceElementsAt(index_type aStart, size_type aCount,
const Item& aItem, const mozilla::fallible_t&)
{
@ -1342,7 +1342,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementsAt(index_type aIndex, const Item* aArray,
size_type aArrayLen, const mozilla::fallible_t&)
{
@ -1361,7 +1361,7 @@ protected:
public:
template<class Item, class Allocator>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementsAt(index_type aIndex,
const nsTArray_Impl<Item, Allocator>& aArray,
const mozilla::fallible_t&)
@ -1388,7 +1388,7 @@ protected:
}
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementAt(index_type aIndex, const mozilla::fallible_t&)
{
return InsertElementAt<FallibleAlloc>(aIndex);
@ -1412,7 +1412,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementAt(index_type aIndex, Item&& aItem,
const mozilla::fallible_t&)
{
@ -1469,7 +1469,7 @@ protected:
public:
template<class Item, class Comparator>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementSorted(Item&& aItem, const Comparator& aComp,
const mozilla::fallible_t&)
{
@ -1489,7 +1489,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementSorted(Item&& aItem, const mozilla::fallible_t&)
{
return InsertElementSorted<Item, FallibleAlloc>(
@ -1517,7 +1517,7 @@ protected:
public:
template<class Item>
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElements(const Item* aArray, size_type aArrayLen,
const mozilla::fallible_t&)
{
@ -1534,7 +1534,7 @@ protected:
public:
template<class Item, class Allocator>
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElements(const nsTArray_Impl<Item, Allocator>& aArray,
const mozilla::fallible_t&)
{
@ -1569,7 +1569,7 @@ protected:
public:
template<class Item, class Allocator, typename ActualAlloc = Alloc>
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElements(nsTArray_Impl<Item, Allocator>&& aArray,
const mozilla::fallible_t&)
{
@ -1593,7 +1593,7 @@ protected:
public:
template<class Item>
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElement(Item&& aItem,
const mozilla::fallible_t&)
{
@ -1620,7 +1620,7 @@ protected:
}
public:
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElements(size_type aCount,
const mozilla::fallible_t&)
{
@ -1638,7 +1638,7 @@ protected:
}
public:
/* MOZ_WARN_UNUSED_RESULT */
/* MOZ_MUST_USE */
elem_type* AppendElement(const mozilla::fallible_t&)
{
return AppendElement<FallibleAlloc>();
@ -1742,7 +1742,7 @@ protected:
}
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool SetCapacity(size_type aCapacity, const mozilla::fallible_t&)
{
return SetCapacity<FallibleAlloc>(aCapacity);
@ -1771,7 +1771,7 @@ protected:
}
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool SetLength(size_type aNewLen, const mozilla::fallible_t&)
{
return SetLength<FallibleAlloc>(aNewLen);
@ -1810,7 +1810,7 @@ protected:
}
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
bool EnsureLengthAtLeast(size_type aMinLen, const mozilla::fallible_t&)
{
return EnsureLengthAtLeast<FallibleAlloc>(aMinLen);
@ -1842,7 +1842,7 @@ protected:
}
public:
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementsAt(index_type aIndex, size_type aCount,
const mozilla::fallible_t&)
{
@ -1879,7 +1879,7 @@ protected:
public:
template<class Item>
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
elem_type* InsertElementsAt(index_type aIndex, size_type aCount,
const Item& aItem, const mozilla::fallible_t&)
{

Просмотреть файл

@ -153,7 +153,7 @@ public:
return static_cast<EntryType*>(mTable.Add(EntryType::KeyToPointer(aKey)));
}
MOZ_WARN_UNUSED_RESULT
MOZ_MUST_USE
EntryType* PutEntry(KeyType aKey, const fallible_t&)
{
return static_cast<EntryType*>(mTable.Add(EntryType::KeyToPointer(aKey),

Просмотреть файл

@ -40,9 +40,8 @@ void LossyCopyUTF16toASCII(const char16ptr_t aSource, nsACString& aDest);
void CopyASCIItoUTF16(const char* aSource, nsAString& aDest);
void CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool CopyUTF16toUTF8(const nsAString& aSource,
nsACString& aDest,
const mozilla::fallible_t&);
MOZ_MUST_USE bool CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest,
const mozilla::fallible_t&);
void CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
void CopyUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest);
@ -50,24 +49,24 @@ void CopyUTF8toUTF16(const char* aSource, nsAString& aDest);
void LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest);
void AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const nsACString& aSource,
nsAString& aDest,
const mozilla::fallible_t&);
MOZ_MUST_USE bool AppendASCIItoUTF16(const nsACString& aSource,
nsAString& aDest,
const mozilla::fallible_t&);
void LossyAppendUTF16toASCII(const char16ptr_t aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const char* aSource,
nsAString& aDest,
const mozilla::fallible_t&);
MOZ_MUST_USE bool AppendASCIItoUTF16(const char* aSource,
nsAString& aDest,
const mozilla::fallible_t&);
void AppendASCIItoUTF16(const char* aSource, nsAString& aDest);
void AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendUTF16toUTF8(const nsAString& aSource,
nsACString& aDest,
const mozilla::fallible_t&);
MOZ_MUST_USE bool AppendUTF16toUTF8(const nsAString& aSource,
nsACString& aDest,
const mozilla::fallible_t&);
void AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendUTF8toUTF16(const nsACString& aSource,
nsAString& aDest,
const mozilla::fallible_t&);
MOZ_MUST_USE bool AppendUTF8toUTF16(const nsACString& aSource,
nsAString& aDest,
const mozilla::fallible_t&);
void AppendUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest);
void AppendUTF8toUTF16(const char* aSource, nsAString& aDest);

Просмотреть файл

@ -393,12 +393,12 @@ public:
*/
void ReplaceSubstring(const self_type& aTarget, const self_type& aNewValue);
void ReplaceSubstring(const char_type* aTarget, const char_type* aNewValue);
MOZ_WARN_UNUSED_RESULT bool ReplaceSubstring(const self_type& aTarget,
const self_type& aNewValue,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool ReplaceSubstring(const char_type* aTarget,
const char_type* aNewValue,
const fallible_t&);
MOZ_MUST_USE bool ReplaceSubstring(const self_type& aTarget,
const self_type& aNewValue,
const fallible_t&);
MOZ_MUST_USE bool ReplaceSubstring(const char_type* aTarget,
const char_type* aNewValue,
const fallible_t&);
/**

Просмотреть файл

@ -361,25 +361,22 @@ public:
*/
void NS_FASTCALL Assign(char_type aChar);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(char_type aChar,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Assign(char_type aChar, const fallible_t&);
void NS_FASTCALL Assign(const char_type* aData);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const char_type* aData,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Assign(const char_type* aData,
const fallible_t&);
void NS_FASTCALL Assign(const char_type* aData, size_type aLength);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const char_type* aData,
size_type aLength,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Assign(const char_type* aData,
size_type aLength, const fallible_t&);
void NS_FASTCALL Assign(const self_type&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const self_type&,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Assign(const self_type&, const fallible_t&);
void NS_FASTCALL Assign(const substring_tuple_type&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const substring_tuple_type&,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Assign(const substring_tuple_type&,
const fallible_t&);
#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
void Assign(char16ptr_t aData)
@ -392,8 +389,8 @@ public:
Assign(static_cast<const char16_t*>(aData), aLength);
}
MOZ_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData, size_type aLength,
const fallible_t& aFallible)
MOZ_MUST_USE bool Assign(char16ptr_t aData, size_type aLength,
const fallible_t& aFallible)
{
return Assign(static_cast<const char16_t*>(aData), aLength,
aFallible);
@ -401,16 +398,16 @@ public:
#endif
void NS_FASTCALL AssignASCII(const char* aData, size_type aLength);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
size_type aLength,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL AssignASCII(const char* aData,
size_type aLength,
const fallible_t&);
void NS_FASTCALL AssignASCII(const char* aData)
{
AssignASCII(aData, mozilla::AssertedCast<size_type, size_t>(strlen(aData)));
}
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
const fallible_t& aFallible)
MOZ_MUST_USE bool NS_FASTCALL AssignASCII(const char* aData,
const fallible_t& aFallible)
{
return AssignASCII(aData,
mozilla::AssertedCast<size_type, size_t>(strlen(aData)),
@ -473,27 +470,27 @@ public:
void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
char_type aChar);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
char_type aChar,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
char_type aChar,
const fallible_t&);
void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
const char_type* aData,
size_type aLength = size_type(-1));
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
const char_type* aData,
size_type aLength,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
const char_type* aData,
size_type aLength,
const fallible_t&);
void Replace(index_type aCutStart, size_type aCutLength,
const self_type& aStr)
{
Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length());
}
MOZ_WARN_UNUSED_RESULT bool Replace(index_type aCutStart,
size_type aCutLength,
const self_type& aStr,
const fallible_t& aFallible)
MOZ_MUST_USE bool Replace(index_type aCutStart,
size_type aCutLength,
const self_type& aStr,
const fallible_t& aFallible)
{
return Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length(),
aFallible);
@ -505,10 +502,10 @@ public:
const char* aData,
size_type aLength = size_type(-1));
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
const char* aData,
size_type aLength,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
const char* aData,
size_type aLength,
const fallible_t&);
// ReplaceLiteral must ONLY be applied to an actual literal string.
// Do not attempt to use it with a regular char* pointer, or with a char
@ -524,8 +521,7 @@ public:
{
Replace(mLength, 0, aChar);
}
MOZ_WARN_UNUSED_RESULT bool Append(char_type aChar,
const fallible_t& aFallible)
MOZ_MUST_USE bool Append(char_type aChar, const fallible_t& aFallible)
{
return Replace(mLength, 0, aChar, aFallible);
}
@ -533,8 +529,8 @@ public:
{
Replace(mLength, 0, aData, aLength);
}
MOZ_WARN_UNUSED_RESULT bool Append(const char_type* aData, size_type aLength,
const fallible_t& aFallible)
MOZ_MUST_USE bool Append(const char_type* aData, size_type aLength,
const fallible_t& aFallible)
{
return Replace(mLength, 0, aData, aLength, aFallible);
}
@ -550,7 +546,7 @@ public:
{
Replace(mLength, 0, aStr);
}
MOZ_WARN_UNUSED_RESULT bool Append(const self_type& aStr, const fallible_t& aFallible)
MOZ_MUST_USE bool Append(const self_type& aStr, const fallible_t& aFallible)
{
return Replace(mLength, 0, aStr, aFallible);
}
@ -564,12 +560,12 @@ public:
ReplaceASCII(mLength, 0, aData, aLength);
}
MOZ_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, const fallible_t& aFallible)
MOZ_MUST_USE bool AppendASCII(const char* aData, const fallible_t& aFallible)
{
return ReplaceASCII(mLength, 0, aData, size_type(-1), aFallible);
}
MOZ_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, size_type aLength, const fallible_t& aFallible)
MOZ_MUST_USE bool AppendASCII(const char* aData, size_type aLength, const fallible_t& aFallible)
{
return ReplaceASCII(mLength, 0, aData, aLength, aFallible);
}
@ -640,7 +636,7 @@ public:
}
template<int N>
MOZ_WARN_UNUSED_RESULT bool AppendLiteral(const char (&aStr)[N], const fallible_t& aFallible)
MOZ_MUST_USE bool AppendLiteral(const char (&aStr)[N], const fallible_t& aFallible)
{
return AppendASCII(aStr, N - 1, aFallible);
}
@ -726,12 +722,12 @@ public:
* Also ensures that the buffer is mutable.
*/
void NS_FASTCALL SetCapacity(size_type aNewCapacity);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL SetCapacity(size_type aNewCapacity,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL SetCapacity(size_type aNewCapacity,
const fallible_t&);
void NS_FASTCALL SetLength(size_type aNewLength);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL SetLength(size_type aNewLength,
const fallible_t&);
MOZ_MUST_USE bool NS_FASTCALL SetLength(size_type aNewLength,
const fallible_t&);
void Truncate(size_type aNewLength = 0)
{
@ -991,11 +987,11 @@ protected:
* this function returns false if is unable to allocate sufficient
* memory.
*/
MOZ_WARN_UNUSED_RESULT bool ReplacePrep(index_type aCutStart,
size_type aCutLength,
size_type aNewLength);
MOZ_MUST_USE bool ReplacePrep(index_type aCutStart,
size_type aCutLength,
size_type aNewLength);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL ReplacePrepInternal(
MOZ_MUST_USE bool NS_FASTCALL ReplacePrepInternal(
index_type aCutStart,
size_type aCutLength,
size_type aNewFragLength,
@ -1014,7 +1010,7 @@ protected:
* this helper function can be called prior to directly manipulating
* the contents of mData. see, for example, BeginWriting.
*/
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL EnsureMutable(
MOZ_MUST_USE bool NS_FASTCALL EnsureMutable(
size_type aNewLen = size_type(-1));
/**