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, uint32_t AddSubtree(ProxyAccessible* aParent,
const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx, const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
uint32_t aIdxInParent); uint32_t aIdxInParent);
MOZ_WARN_UNUSED_RESULT bool CheckDocTree() const; MOZ_MUST_USE bool CheckDocTree() const;
xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy); xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
nsTArray<DocAccessibleParent*> mChildDocs; nsTArray<DocAccessibleParent*> mChildDocs;

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

@ -142,7 +142,7 @@ public:
virtual bool TextIsOnlyWhitespace() override; virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override; virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) 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 bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsIContent *GetBindingParent() const override; virtual nsIContent *GetBindingParent() const override;
virtual nsXBLBinding *GetXBLBinding() const override; virtual nsXBLBinding *GetXBLBinding() const override;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -36,7 +36,7 @@ public:
base_type::SetLength(newLen + sExtra); base_type::SetLength(newLen + sExtra);
} }
MOZ_WARN_UNUSED_RESULT MOZ_MUST_USE
bool SetLength(size_type newLen, const mozilla::fallible_t&) bool SetLength(size_type newLen, const mozilla::fallible_t&)
{ {
return base_type::SetLength(newLen + sExtra, mozilla::fallible); 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 // (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 // intersection, returns an empty rectangle with x/y set to the std::max of the x/y
// of *this and aRect. // 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; Sub result;
result.x = std::max<T>(x, aRect.x); result.x = std::max<T>(x, aRect.x);
@ -134,7 +134,7 @@ struct BaseRect {
// this and aRect2. // this and aRect2.
// Thus, empty input rectangles are ignored. // Thus, empty input rectangles are ignored.
// If both rectangles are empty, returns this. // 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()) { if (IsEmpty()) {
return aRect; return aRect;
@ -147,7 +147,7 @@ struct BaseRect {
// Returns the smallest rectangle that contains both the points (including // Returns the smallest rectangle that contains both the points (including
// edges) of both aRect1 and aRect2. // edges) of both aRect1 and aRect2.
// Thus, empty input rectangles are allowed to affect the result. // 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; Sub result;
result.x = std::min(x, aRect.x); 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 * Clamp aPoint to this rectangle. It is allowed to end up on any
* edge of the rectangle. * 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)), return Point(std::max(x, std::min(XMost(), aPoint.x)),
std::max(y, std::min(YMost(), aPoint.y))); 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 * aRect then the dimensions that don't fit will be shrunk so that they
* do fit. The resulting rect is returned. * 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), Sub rect(std::max(aRect.x, x),
std::max(aRect.y, y), 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 aFromAPP the APP to scale from
* @param aToAPP the APP to scale to * @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; ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
MOZ_WARN_UNUSED_RESULT inline nsPoint MOZ_MUST_USE inline nsPoint
RemoveResolution(const float resolution) const; RemoveResolution(const float resolution) const;
MOZ_WARN_UNUSED_RESULT inline nsPoint MOZ_MUST_USE inline nsPoint
ApplyResolution(const float resolution) const; ApplyResolution(const float resolution) const;
}; };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -127,7 +127,7 @@ struct Zone : public JS::shadow::Zone,
{ {
explicit Zone(JSRuntime* rt); explicit Zone(JSRuntime* rt);
~Zone(); ~Zone();
MOZ_WARN_UNUSED_RESULT bool init(bool isSystem); MOZ_MUST_USE bool init(bool isSystem);
void findOutgoingEdges(js::gc::ComponentFinder<JS::Zone>& finder); void findOutgoingEdges(js::gc::ComponentFinder<JS::Zone>& finder);
@ -151,7 +151,7 @@ struct Zone : public JS::shadow::Zone,
bool isTooMuchMalloc() const { return gcMallocBytes <= 0; } bool isTooMuchMalloc() const { return gcMallocBytes <= 0; }
void onTooMuchMalloc(); 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) { void* reallocPtr = nullptr) {
if (!js::CurrentThreadCanAccessRuntime(runtime_)) if (!js::CurrentThreadCanAccessRuntime(runtime_))
return nullptr; return nullptr;
@ -380,7 +380,7 @@ struct Zone : public JS::shadow::Zone,
} }
// Creates a HashNumber based on getUniqueId. Returns false on OOM. // 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; uint64_t uid;
if (!getUniqueId(cell, &uid)) if (!getUniqueId(cell, &uid))
return false; 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 an existing UID in |uidp|, or creates a new UID for this Cell and
// puts that into |uidp|. Returns false on OOM. // 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(uidp);
MOZ_ASSERT(js::CurrentThreadCanAccessZone(this)); 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. // 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)); MOZ_ASSERT(js::CurrentThreadCanAccessZone(this));
return uniqueIds_.has(cell); 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 // 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 // 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> template<typename T, size_t N>
class InfallibleVector class InfallibleVector
{ {

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

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

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

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

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

@ -32,7 +32,7 @@ class FixedList
{ } { }
// Dynamic memory allocation requires the ability to report failure. // 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; length_ = length;
if (length == 0) if (length == 0)
return true; return true;
@ -57,7 +57,7 @@ class FixedList
length_ -= num; 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; size_t newlength = length_ + num;
if (newlength < length_) if (newlength < length_)
return false; return false;

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

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

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

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

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

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

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

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

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

@ -617,7 +617,7 @@ class BaseAssemblerX64 : public BaseAssembler
m_formatter.oneByteOp64(OP_MOVSXD_GvEv, offset, base, index, scale, dst); m_formatter.oneByteOp64(OP_MOVSXD_GvEv, offset, base, index, scale, dst);
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
movl_ripr(RegisterID dst) movl_ripr(RegisterID dst)
{ {
m_formatter.oneByteRipOp(OP_MOV_GvEv, 0, (RegisterID)dst); m_formatter.oneByteRipOp(OP_MOV_GvEv, 0, (RegisterID)dst);
@ -626,7 +626,7 @@ class BaseAssemblerX64 : public BaseAssembler
return label; return label;
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
movl_rrip(RegisterID src) movl_rrip(RegisterID src)
{ {
m_formatter.oneByteRipOp(OP_MOV_EvGv, 0, (RegisterID)src); m_formatter.oneByteRipOp(OP_MOV_EvGv, 0, (RegisterID)src);
@ -635,7 +635,7 @@ class BaseAssemblerX64 : public BaseAssembler
return label; return label;
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
movq_ripr(RegisterID dst) movq_ripr(RegisterID dst)
{ {
m_formatter.oneByteRipOp64(OP_MOV_GvEv, 0, 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); m_formatter.oneByteOp64(OP_LEA, offset, base, dst);
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
leaq_rip(RegisterID dst) leaq_rip(RegisterID dst)
{ {
m_formatter.oneByteRipOp64(OP_LEA, 0, 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); twoByteOpInt64Simd("vmovq", VEX_PD, OP2_MOVD_VdEd, src, invalid_xmm, dst);
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
vmovsd_ripr(XMMRegisterID dst) vmovsd_ripr(XMMRegisterID dst)
{ {
return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_VsdWsd, invalid_xmm, 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) vmovss_ripr(XMMRegisterID dst)
{ {
return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_VsdWsd, invalid_xmm, 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) vmovsd_rrip(XMMRegisterID src)
{ {
return twoByteRipOpSimd("vmovsd", VEX_SD, OP2_MOVSD_WsdVsd, invalid_xmm, 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) vmovss_rrip(XMMRegisterID src)
{ {
return twoByteRipOpSimd("vmovss", VEX_SS, OP2_MOVSD_WsdVsd, invalid_xmm, 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) vmovdqa_rrip(XMMRegisterID src)
{ {
return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_WdqVdq, invalid_xmm, 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) vmovaps_rrip(XMMRegisterID src)
{ {
return twoByteRipOpSimd("vmovdqa", VEX_PS, OP2_MOVAPS_WsdVsd, invalid_xmm, 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) vmovaps_ripr(XMMRegisterID dst)
{ {
return twoByteRipOpSimd("vmovaps", VEX_PS, OP2_MOVAPS_VsdWsd, invalid_xmm, 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) vmovdqa_ripr(XMMRegisterID dst)
{ {
return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_VdqWdq, invalid_xmm, dst); return twoByteRipOpSimd("vmovdqa", VEX_PD, OP2_MOVDQ_VdqWdq, invalid_xmm, dst);
@ -759,7 +759,7 @@ class BaseAssemblerX64 : public BaseAssembler
private: private:
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
twoByteRipOpSimd(const char* name, VexOperandType ty, TwoByteOpcodeID opcode, twoByteRipOpSimd(const char* name, VexOperandType ty, TwoByteOpcodeID opcode,
XMMRegisterID src0, XMMRegisterID dst) 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) cmpl_im_disp32(int32_t rhs, int32_t offset, RegisterID base)
{ {
spew("cmpl $0x%x, " MEM_o32b, rhs, ADDR_o32b(offset, base)); spew("cmpl $0x%x, " MEM_o32b, rhs, ADDR_o32b(offset, base));
@ -1521,7 +1521,7 @@ public:
return r; return r;
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
cmpl_im_disp32(int32_t rhs, const void* addr) cmpl_im_disp32(int32_t rhs, const void* addr)
{ {
spew("cmpl $0x%x, %p", rhs, addr); spew("cmpl $0x%x, %p", rhs, addr);
@ -2236,7 +2236,7 @@ public:
// Flow control: // Flow control:
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
call() call()
{ {
m_formatter.oneByteOp(OP_CALL_rel32); m_formatter.oneByteOp(OP_CALL_rel32);
@ -2260,7 +2260,7 @@ public:
// Comparison of EAX against a 32-bit immediate. The immediate is patched // 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 // 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. // 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() cmp_eax()
{ {
m_formatter.oneByteOp(OP_CMP_EAXIv); m_formatter.oneByteOp(OP_CMP_EAXIv);
@ -2285,7 +2285,7 @@ public:
m_formatter.immediate32(diff - 5); m_formatter.immediate32(diff - 5);
} }
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
jmp() jmp()
{ {
m_formatter.oneByteOp(OP_JMP_rel32); m_formatter.oneByteOp(OP_JMP_rel32);
@ -2328,7 +2328,7 @@ public:
} }
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
jCC(Condition cond) jCC(Condition cond)
{ {
m_formatter.twoByteOp(jccRel32(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); m_buffer.putInt64Unchecked(imm);
} }
MOZ_WARN_UNUSED_RESULT JmpSrc MOZ_MUST_USE JmpSrc
immediateRel32() immediateRel32()
{ {
m_buffer.putIntUnchecked(0); m_buffer.putIntUnchecked(0);

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

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

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

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

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

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

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

@ -1318,11 +1318,11 @@ class MOZ_STACK_CLASS AutoStableStringChars
: s_(cx), state_(Uninitialized) : s_(cx), state_(Uninitialized)
{} {}
MOZ_WARN_UNUSED_RESULT MOZ_MUST_USE
bool init(JSContext* cx, JSString* s); bool init(JSContext* cx, JSString* s);
/* Like init(), but Latin1 chars are inflated to TwoByte. */ /* Like init(), but Latin1 chars are inflated to TwoByte. */
MOZ_WARN_UNUSED_RESULT MOZ_MUST_USE
bool initTwoByte(JSContext* cx, JSString* s); bool initTwoByte(JSContext* cx, JSString* s);
bool isLatin1() const { return state_ == Latin1; } 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 // 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 // may be the passed pointer, relocated by GC. If no GC could occur, it's just
// passed through. We root nothing unless necessary. // 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) SetNewObjectMetadata(ExclusiveContext* cxArg, JSObject* obj)
{ {
MOZ_ASSERT(!cxArg->compartment()->hasObjectPendingMetadata()); MOZ_ASSERT(!cxArg->compartment()->hasObjectPendingMetadata());

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

@ -1672,7 +1672,7 @@ js::GetPCCountScriptCount(JSContext* cx)
enum MaybeComma {NO_COMMA, COMMA}; 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) AppendJSONProperty(StringBuffer& buf, const char* name, MaybeComma comma = COMMA)
{ {
if (comma && !buf.append(',')) if (comma && !buf.append(','))

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

@ -1372,7 +1372,7 @@ class StringSegmentRange
: stack(cx, StringVector(cx)), cur(cx) : 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()); MOZ_ASSERT(stack.empty());
return settle(str); return settle(str);
} }
@ -1386,7 +1386,7 @@ class StringSegmentRange
return cur; return cur;
} }
MOZ_WARN_UNUSED_RESULT bool popFront() { MOZ_MUST_USE bool popFront() {
MOZ_ASSERT(!empty()); MOZ_ASSERT(!empty());
if (stack.empty()) { if (stack.empty()) {
cur = nullptr; cur = nullptr;

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

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

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

@ -72,7 +72,7 @@ class StringBuffer
return cb.ref<TwoByteCharBuffer>(); return cb.ref<TwoByteCharBuffer>();
} }
MOZ_WARN_UNUSED_RESULT bool inflateChars(); MOZ_MUST_USE bool inflateChars();
public: public:
explicit StringBuffer(ExclusiveContext* cx) explicit StringBuffer(ExclusiveContext* cx)
@ -85,12 +85,12 @@ class StringBuffer
cb.construct<Latin1CharBuffer>(cx); cb.construct<Latin1CharBuffer>(cx);
} }
MOZ_WARN_UNUSED_RESULT bool reserve(size_t len) { MOZ_MUST_USE bool reserve(size_t len) {
if (len > reserved_) if (len > reserved_)
reserved_ = len; reserved_ = len;
return isLatin1() ? latin1Chars().reserve(len) : twoByteChars().reserve(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); return isLatin1() ? latin1Chars().resize(len) : twoByteChars().resize(len);
} }
bool empty() const { bool empty() const {
@ -103,7 +103,7 @@ class StringBuffer
return isLatin1() ? latin1Chars()[idx] : twoByteChars()[idx]; return isLatin1() ? latin1Chars()[idx] : twoByteChars()[idx];
} }
MOZ_WARN_UNUSED_RESULT bool ensureTwoByteChars() { MOZ_MUST_USE bool ensureTwoByteChars() {
if (isLatin1() && !inflateChars()) if (isLatin1() && !inflateChars())
return false; return false;
@ -113,7 +113,7 @@ class StringBuffer
return true; return true;
} }
MOZ_WARN_UNUSED_RESULT bool append(const char16_t c) { MOZ_MUST_USE bool append(const char16_t c) {
if (isLatin1()) { if (isLatin1()) {
if (c <= JSString::MAX_LATIN1_CHAR) if (c <= JSString::MAX_LATIN1_CHAR)
return latin1Chars().append(Latin1Char(c)); return latin1Chars().append(Latin1Char(c));
@ -122,44 +122,44 @@ class StringBuffer
} }
return twoByteChars().append(c); 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); 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)); 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); 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); 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); 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); 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); return isLatin1() ? latin1Chars().appendN(c, n) : twoByteChars().appendN(c, n);
} }
inline MOZ_WARN_UNUSED_RESULT bool append(JSString* str); inline MOZ_MUST_USE bool append(JSString* str);
inline MOZ_WARN_UNUSED_RESULT bool append(JSLinearString* str); inline MOZ_MUST_USE bool append(JSLinearString* str);
inline MOZ_WARN_UNUSED_RESULT bool appendSubstring(JSString* base, size_t off, size_t len); inline MOZ_MUST_USE 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 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); return append(reinterpret_cast<const Latin1Char*>(chars), len);
} }
template <size_t ArrayLength> 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'. */ 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 * within the specified limits), else returns false on failure (there is a
* reference loop/the reference chain has exceeded the specified limits). * 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 // If we fail this assertion then either a consumer failed to break a
// reference loop/chain, or else they called Reference() more than once // reference loop/chain, or else they called Reference() more than once
MOZ_ASSERT(*mRefCounter >= 0); MOZ_ASSERT(*mRefCounter >= 0);

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

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

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

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

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

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

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

@ -313,22 +313,22 @@
#endif #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. * 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 * example, write
* *
* MOZ_WARN_UNUSED_RESULT int foo(); * MOZ_MUST_USE int foo();
* *
* or * or
* *
* MOZ_WARN_UNUSED_RESULT int foo() { return 42; } * MOZ_MUST_USE int foo() { return 42; }
*/ */
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
# define MOZ_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) # define MOZ_MUST_USE __attribute__ ((warn_unused_result))
#else #else
# define MOZ_WARN_UNUSED_RESULT # define MOZ_MUST_USE
#endif #endif
/** /**

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

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

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

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

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

@ -156,7 +156,7 @@ AddUintptrToHash<8>(uint32_t aHash, uintptr_t aValue)
* convert to uint32_t, data pointers, and function pointers. * convert to uint32_t, data pointers, and function pointers.
*/ */
template<typename A> template<typename A>
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, A aA) AddToHash(uint32_t aHash, A aA)
{ {
/* /*
@ -167,7 +167,7 @@ AddToHash(uint32_t aHash, A aA)
} }
template<typename A> template<typename A>
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, A* aA) AddToHash(uint32_t aHash, A* aA)
{ {
/* /*
@ -181,14 +181,14 @@ AddToHash(uint32_t aHash, A* aA)
} }
template<> template<>
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
AddToHash(uint32_t aHash, uintptr_t aA) AddToHash(uint32_t aHash, uintptr_t aA)
{ {
return detail::AddUintptrToHash<sizeof(uintptr_t)>(aHash, aA); return detail::AddUintptrToHash<sizeof(uintptr_t)>(aHash, aA);
} }
template<typename A, typename... Args> template<typename A, typename... Args>
MOZ_WARN_UNUSED_RESULT uint32_t MOZ_MUST_USE uint32_t
AddToHash(uint32_t aHash, A aArg, Args... aArgs) AddToHash(uint32_t aHash, A aArg, Args... aArgs)
{ {
return AddToHash(AddToHash(aHash, aArg), 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. * that x has already been hashed.
*/ */
template<typename... Args> template<typename... Args>
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
HashGeneric(Args... aArgs) HashGeneric(Args... aArgs)
{ {
return AddToHash(0, 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 * If you have the string's length, you might as well call the overload which
* includes the length. It may be marginally faster. * 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) HashString(const char* aStr)
{ {
return detail::HashUntilZero(reinterpret_cast<const unsigned 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) HashString(const char* aStr, size_t aLength)
{ {
return detail::HashKnownLength(reinterpret_cast<const unsigned char*>(aStr), aLength); return detail::HashKnownLength(reinterpret_cast<const unsigned char*>(aStr), aLength);
} }
MOZ_WARN_UNUSED_RESULT MOZ_MUST_USE
inline uint32_t inline uint32_t
HashString(const unsigned char* aStr, size_t aLength) HashString(const unsigned char* aStr, size_t aLength)
{ {
return detail::HashKnownLength(aStr, aLength); return detail::HashKnownLength(aStr, aLength);
} }
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
HashString(const uint16_t* aStr) HashString(const uint16_t* aStr)
{ {
return detail::HashUntilZero(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) HashString(const uint16_t* aStr, size_t aLength)
{ {
return detail::HashKnownLength(aStr, aLength); return detail::HashKnownLength(aStr, aLength);
} }
#ifdef MOZ_CHAR16_IS_NOT_WCHAR #ifdef MOZ_CHAR16_IS_NOT_WCHAR
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
HashString(const char16_t* aStr) HashString(const char16_t* aStr)
{ {
return detail::HashUntilZero(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) HashString(const char16_t* aStr, size_t aLength)
{ {
return detail::HashKnownLength(aStr, aLength); return detail::HashKnownLength(aStr, aLength);
@ -290,13 +290,13 @@ HashString(const char16_t* aStr, size_t aLength)
* the same width! * the same width!
*/ */
#ifdef WIN32 #ifdef WIN32
MOZ_WARN_UNUSED_RESULT inline uint32_t MOZ_MUST_USE inline uint32_t
HashString(const wchar_t* aStr) HashString(const wchar_t* aStr)
{ {
return detail::HashUntilZero(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) HashString(const wchar_t* aStr, size_t aLength)
{ {
return detail::HashKnownLength(aStr, 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 * 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. * 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); HashBytes(const void* bytes, size_t aLength);
} /* namespace mozilla */ } /* namespace mozilla */

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

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

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

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

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

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

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

@ -268,9 +268,9 @@ class Vector final : private AllocPolicy
friend struct detail::VectorTesting; friend struct detail::VectorTesting;
MOZ_WARN_UNUSED_RESULT bool growStorageBy(size_t aIncr); MOZ_MUST_USE bool growStorageBy(size_t aIncr);
MOZ_WARN_UNUSED_RESULT bool convertToHeapStorage(size_t aNewCap); MOZ_MUST_USE bool convertToHeapStorage(size_t aNewCap);
MOZ_WARN_UNUSED_RESULT bool maybeCheckSimulatedOOM(size_t aRequestedSize); MOZ_MUST_USE bool maybeCheckSimulatedOOM(size_t aRequestedSize);
/* magic constants */ /* magic constants */
@ -515,7 +515,7 @@ public:
* Given that the vector is empty and has no inline storage, grow to * Given that the vector is empty and has no inline storage, grow to
* |capacity|. * |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 * 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 * A request to reserve an amount less than the current length does not affect
* reserved space. * 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 * Destroy elements in the range [end() - aIncr, end()). Does not deallocate
@ -540,18 +540,18 @@ public:
void shrinkTo(size_t aNewLength); void shrinkTo(size_t aNewLength);
/** Grow the vector by aIncr elements. */ /** 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(). */ /** 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 * Increase the length of the vector, but don't initialize the new elements
* -- leave them as uninitialized memory. * -- 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); 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()). */ /** Shorthand for shrinkBy(length()). */
void clear(); void clear();
@ -574,13 +574,13 @@ public:
* vector, instead of copying it. If it fails, |aU| is left unmoved. ("We are * vector, instead of copying it. If it fails, |aU| is left unmoved. ("We are
* not amused.") * 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. * Construct a T in-place as a new entry at the end of this vector.
*/ */
template<typename... Args> template<typename... Args>
MOZ_WARN_UNUSED_RESULT bool emplaceBack(Args&&... aArgs) MOZ_MUST_USE bool emplaceBack(Args&&... aArgs)
{ {
if (!growByUninitialized(1)) if (!growByUninitialized(1))
return false; return false;
@ -589,10 +589,10 @@ public:
} }
template<typename U, size_t O, class BP> template<typename U, size_t O, class BP>
MOZ_WARN_UNUSED_RESULT bool appendAll(const Vector<U, O, BP>& aU); MOZ_MUST_USE bool appendAll(const Vector<U, O, BP>& aU);
MOZ_WARN_UNUSED_RESULT bool appendN(const T& aT, size_t aN); MOZ_MUST_USE 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_MUST_USE bool append(const U* aBegin, const U* aEnd);
template<typename U> MOZ_WARN_UNUSED_RESULT bool append(const U* aBegin, size_t aLength); template<typename U> MOZ_MUST_USE bool append(const U* aBegin, size_t aLength);
/* /*
* Guaranteed-infallible append operations for use upon vectors whose * 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. * 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 * 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 * If any of these elements are uninitialized (as growByUninitialized
* enables), behavior is undefined. * 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 * 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! * This is inherently a linear-time operation. Be careful!
*/ */
template<typename U> 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), * 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 // 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 // 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 // but not GCC, so we instead use this dummy variable which works with both
// compilers. // compilers.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -212,7 +212,7 @@ InstallSigSysHandler(void)
* @see SandboxInfo * @see SandboxInfo
* @see BroadcastSetThreadSandbox * @see BroadcastSetThreadSandbox
*/ */
static bool MOZ_WARN_UNUSED_RESULT static bool MOZ_MUST_USE
InstallSyscallFilter(const sock_fprog *aProg, bool aUseTSync) InstallSyscallFilter(const sock_fprog *aProg, bool aUseTSync)
{ {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { 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 // Throughout, uint32_t aChunk refers only to the chunk number. Chunk data is
// stored in the Prefix structures. // 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); 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); 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); 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); return mSubExpirations.Set(aChunk);
}; };
MOZ_WARN_UNUSED_RESULT nsresult NewAddPrefix(uint32_t aAddChunk, MOZ_MUST_USE nsresult NewAddPrefix(uint32_t aAddChunk, const Prefix& aPrefix);
const Prefix& aPrefix); MOZ_MUST_USE nsresult NewSubPrefix(uint32_t aAddChunk,
MOZ_WARN_UNUSED_RESULT nsresult NewSubPrefix(uint32_t aAddChunk, const Prefix& aPrefix,
const Prefix& aPrefix, uint32_t aSubChunk);
uint32_t aSubChunk); MOZ_MUST_USE nsresult NewAddComplete(uint32_t aChunk,
MOZ_WARN_UNUSED_RESULT nsresult NewAddComplete(uint32_t aChunk, const Completion& aCompletion);
const Completion& aCompletion); MOZ_MUST_USE nsresult NewSubComplete(uint32_t aAddChunk,
MOZ_WARN_UNUSED_RESULT nsresult NewSubComplete(uint32_t aAddChunk, const Completion& aCompletion,
const Completion& aCompletion, uint32_t aSubChunk);
uint32_t aSubChunk);
void SetLocalUpdate(void) { mLocalUpdate = true; } void SetLocalUpdate(void) { mLocalUpdate = true; }
bool IsLocalUpdate(void) { return mLocalUpdate; } 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, GenerateKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey, SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey, SECKEYPublicKey ** publicKey,
@ -347,7 +347,7 @@ GenerateKeyPair(PK11SlotInfo * slot,
} }
MOZ_WARN_UNUSED_RESULT nsresult MOZ_MUST_USE nsresult
GenerateRSAKeyPair(PK11SlotInfo * slot, GenerateRSAKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey, SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey) SECKEYPublicKey ** publicKey)
@ -361,7 +361,7 @@ GenerateRSAKeyPair(PK11SlotInfo * slot,
&rsaParams); &rsaParams);
} }
MOZ_WARN_UNUSED_RESULT nsresult MOZ_MUST_USE nsresult
GenerateDSAKeyPair(PK11SlotInfo * slot, GenerateDSAKeyPair(PK11SlotInfo * slot,
SECKEYPrivateKey ** privateKey, SECKEYPrivateKey ** privateKey,
SECKEYPublicKey ** publicKey) SECKEYPublicKey ** publicKey)

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

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

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

@ -127,8 +127,8 @@ public:
} }
} }
MOZ_WARN_UNUSED_RESULT bool Put(KeyType aKey, const UserDataType& aData, MOZ_MUST_USE bool Put(KeyType aKey, const UserDataType& aData,
const fallible_t&) const fallible_t&)
{ {
EntryType* ent = this->PutEntry(aKey); EntryType* ent = this->PutEntry(aKey);
if (!ent) { 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. * 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. * Remove and return the last item in the container.

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

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

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

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

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

@ -153,7 +153,7 @@ public:
return static_cast<EntryType*>(mTable.Add(EntryType::KeyToPointer(aKey))); return static_cast<EntryType*>(mTable.Add(EntryType::KeyToPointer(aKey)));
} }
MOZ_WARN_UNUSED_RESULT MOZ_MUST_USE
EntryType* PutEntry(KeyType aKey, const fallible_t&) EntryType* PutEntry(KeyType aKey, const fallible_t&)
{ {
return static_cast<EntryType*>(mTable.Add(EntryType::KeyToPointer(aKey), 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 CopyASCIItoUTF16(const char* aSource, nsAString& aDest);
void CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest); void CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool CopyUTF16toUTF8(const nsAString& aSource, MOZ_MUST_USE bool CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest,
nsACString& aDest, const mozilla::fallible_t&);
const mozilla::fallible_t&);
void CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest); void CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
void CopyUTF16toUTF8(const char16ptr_t aSource, nsACString& 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 LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest);
void AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest); void AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const nsACString& aSource, MOZ_MUST_USE bool AppendASCIItoUTF16(const nsACString& aSource,
nsAString& aDest, nsAString& aDest,
const mozilla::fallible_t&); const mozilla::fallible_t&);
void LossyAppendUTF16toASCII(const char16ptr_t aSource, nsACString& aDest); void LossyAppendUTF16toASCII(const char16ptr_t aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const char* aSource, MOZ_MUST_USE bool AppendASCIItoUTF16(const char* aSource,
nsAString& aDest, nsAString& aDest,
const mozilla::fallible_t&); const mozilla::fallible_t&);
void AppendASCIItoUTF16(const char* aSource, nsAString& aDest); void AppendASCIItoUTF16(const char* aSource, nsAString& aDest);
void AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest); void AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendUTF16toUTF8(const nsAString& aSource, MOZ_MUST_USE bool AppendUTF16toUTF8(const nsAString& aSource,
nsACString& aDest, nsACString& aDest,
const mozilla::fallible_t&); const mozilla::fallible_t&);
void AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest); void AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
MOZ_WARN_UNUSED_RESULT bool AppendUTF8toUTF16(const nsACString& aSource, MOZ_MUST_USE bool AppendUTF8toUTF16(const nsACString& aSource,
nsAString& aDest, nsAString& aDest,
const mozilla::fallible_t&); const mozilla::fallible_t&);
void AppendUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest); void AppendUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest);
void AppendUTF8toUTF16(const char* aSource, nsAString& 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 self_type& aTarget, const self_type& aNewValue);
void ReplaceSubstring(const char_type* aTarget, const char_type* aNewValue); void ReplaceSubstring(const char_type* aTarget, const char_type* aNewValue);
MOZ_WARN_UNUSED_RESULT bool ReplaceSubstring(const self_type& aTarget, MOZ_MUST_USE bool ReplaceSubstring(const self_type& aTarget,
const self_type& aNewValue, const self_type& aNewValue,
const fallible_t&); const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool ReplaceSubstring(const char_type* aTarget, MOZ_MUST_USE bool ReplaceSubstring(const char_type* aTarget,
const char_type* aNewValue, const char_type* aNewValue,
const fallible_t&); const fallible_t&);
/** /**

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

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