Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium

--HG--
extra : rebase_source : d210822225d307f3e3685cb5f95b461c48c0be7e
This commit is contained in:
Jim Blandy 2015-03-19 00:46:40 -07:00
parent a778e9f970
commit 6afdd6c96b
24 changed files with 158 additions and 175 deletions

View File

@ -3436,13 +3436,6 @@ AC_CACHE_CHECK(for __attribute__((always_inline)),
ac_cv_attribute_always_inline=yes,
ac_cv_attribute_always_inline=no)])
AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
ac_cv_attribute_warn_unused,
[AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
[],
ac_cv_attribute_warn_unused=yes,
ac_cv_attribute_warn_unused=no)])
dnl End of C++ language/feature checks
AC_LANG_C
@ -3474,17 +3467,6 @@ if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
fi
dnl Mozilla specific options
dnl ========================================================
dnl The macros used for command line options
dnl are defined in build/autoconf/altoptions.m4.
if test "$ac_cv_attribute_warn_unused" = yes ; then
AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
else
AC_DEFINE(NS_WARN_UNUSED_RESULT,)
fi
dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
dnl features that Windows actually does support.
@ -3495,6 +3477,11 @@ if test -n "$SKIP_COMPILER_CHECKS"; then
AC_DEFINE(HAVE_LOCALECONV)
fi # SKIP_COMPILER_CHECKS
dnl Mozilla specific options
dnl ========================================================
dnl The macros used for command line options
dnl are defined in build/autoconf/altoptions.m4.
dnl ========================================================
dnl =
dnl = Check for external package dependencies

View File

@ -186,8 +186,8 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override NS_WARN_UNUSED_RESULT;
MOZ_WARN_UNUSED_RESULT
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsIContent *GetBindingParent() const override;
virtual nsXBLBinding *GetXBLBinding() const override;
virtual void SetXBLBinding(nsXBLBinding* aBinding,

View File

@ -1277,8 +1277,9 @@ public:
* @param aResult the result. Out param.
* @return false on out of memory errors, true otherwise.
*/
MOZ_WARN_UNUSED_RESULT
static bool GetNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult) NS_WARN_UNUSED_RESULT;
nsAString& aResult);
/**
* Same as GetNodeTextContents but appends the result rather than sets it.
@ -1753,8 +1754,9 @@ public:
* @param aString the string to convert the newlines inside [in/out]
*/
static void PlatformToDOMLineBreaks(nsString &aString);
static NS_WARN_UNUSED_RESULT bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
MOZ_WARN_UNUSED_RESULT
static bool PlatformToDOMLineBreaks(nsString &aString,
const mozilla::fallible_t&);
/**
* Populates aResultString with the contents of the string-buffer aBuf, up

View File

@ -142,8 +142,9 @@ public:
virtual bool TextIsOnlyWhitespace() override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_WARN_UNUSED_RESULT
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) override NS_WARN_UNUSED_RESULT;
const mozilla::fallible_t&) override;
virtual void DestroyContent() override;
virtual void SaveSubtreeState() override;

View File

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

View File

@ -545,8 +545,8 @@ public:
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
virtual bool AppendTextTo(nsAString& aResult,
const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT = 0;
MOZ_WARN_UNUSED_RESULT
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
/**
* Check if this content is focusable and in the current tab order.

View File

@ -134,8 +134,9 @@ public:
* Append the contents of this string fragment to aString
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_WARN_UNUSED_RESULT
bool AppendTo(nsAString& aString,
const mozilla::fallible_t& aFallible) const NS_WARN_UNUSED_RESULT {
const mozilla::fallible_t& aFallible) const {
if (mState.mIs2b) {
bool ok = aString.Append(m2b, mState.mLength, aFallible);
if (!ok) {
@ -167,8 +168,9 @@ public:
* @param aLength the length of the substring
* @return false if an out of memory condition is detected, true otherwise
*/
MOZ_WARN_UNUSED_RESULT
bool AppendTo(nsAString& aString, int32_t aOffset, int32_t aLength,
const mozilla::fallible_t& aFallible) const NS_WARN_UNUSED_RESULT
const mozilla::fallible_t& aFallible) const
{
if (mState.mIs2b) {
bool ok = aString.Append(m2b + aOffset, aLength, aFallible);

View File

@ -46,13 +46,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
nsAString& aStr,
nsresult& aResult) override;
NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
virtual bool AppendEndOfElementStart(nsIContent *aOriginalElement,
nsIAtom * aName,
int32_t aNamespaceID,
nsAString& aStr) override;
NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
virtual bool AfterElementStart(nsIContent* aContent,
nsIContent* aOriginalElement,
nsAString& aStr) override;
@ -75,7 +75,7 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
virtual void MaybeEnterInPreContent(nsIContent* aNode) override;
virtual void MaybeLeaveFromPreContent(nsIContent* aNode) override;
NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
virtual bool SerializeAttributes(nsIContent* aContent,
nsIContent *aOriginalElement,
nsAString& aTagPrefix,
@ -87,13 +87,13 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
bool IsFirstChildOfOL(nsIContent* aElement);
NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
bool SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr);
bool IsShorthandAttr(const nsIAtom* aAttrName,
const nsIAtom* aElementName);
NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
virtual bool AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) override;

View File

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

View File

@ -17,6 +17,7 @@
#include "nsHashKeys.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "mozilla/Attributes.h"
#include "mozilla/Move.h"
namespace mozilla {
@ -100,7 +101,8 @@ public:
this->EnumerateEntries(ValueEnumerator, &args);
}
DataType* AddEntry(const nsAString& aKey) NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
DataType* AddEntry(const nsAString& aKey)
{
EntryType* ent = this->PutEntry(aKey, fallible);
if (!ent) {

View File

@ -7,6 +7,7 @@
#ifndef mozilla_dom_nsIContentParent_h
#define mozilla_dom_nsIContentParent_h
#include "mozilla/Attributes.h"
#include "mozilla/dom/ipc/IdType.h"
#include "nsFrameMessageManager.h"
@ -55,10 +56,12 @@ public:
virtual bool IsForApp() = 0;
virtual bool IsForBrowser() = 0;
MOZ_WARN_UNUSED_RESULT
virtual PBlobParent* SendPBlobConstructor(
PBlobParent* aActor,
const BlobConstructorParams& aParams) NS_WARN_UNUSED_RESULT = 0;
const BlobConstructorParams& aParams) = 0;
MOZ_WARN_UNUSED_RESULT
virtual PBrowserParent* SendPBrowserConstructor(
PBrowserParent* actor,
const TabId& aTabId,
@ -66,7 +69,7 @@ public:
const uint32_t& chromeFlags,
const ContentParentId& aCpId,
const bool& aIsForApp,
const bool& aIsForBrowser) NS_WARN_UNUSED_RESULT = 0;
const bool& aIsForBrowser) = 0;
virtual bool IsContentParent() { return false; }
ContentParent* AsContentParent();

View File

@ -183,6 +183,8 @@ class CxxCodeGen(CodePrinter, Visitor):
self.println('>')
self.printdent()
if md.warn_unused:
self.write('MOZ_WARN_UNUSED_RESULT ')
if md.inline:
self.write('inline ')
if md.never_inline:
@ -213,8 +215,6 @@ class CxxCodeGen(CodePrinter, Visitor):
if md.ret and md.only_for_definition:
self.write(' -> ')
md.ret.accept(self)
if md.warn_unused:
self.write(' NS_WARN_UNUSED_RESULT')
if md.pure:
self.write(' = 0')

View File

@ -2659,13 +2659,6 @@ AC_CACHE_CHECK(for __attribute__((always_inline)),
ac_cv_attribute_always_inline=yes,
ac_cv_attribute_always_inline=no)])
AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
ac_cv_attribute_warn_unused,
[AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
[],
ac_cv_attribute_warn_unused=yes,
ac_cv_attribute_warn_unused=no)])
dnl End of C++ language/feature checks
AC_LANG_C
@ -2696,17 +2689,6 @@ if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
fi
dnl Mozilla specific options
dnl ========================================================
dnl The macros used for command line options
dnl are defined in build/autoconf/altoptions.m4.
if test "$ac_cv_attribute_warn_unused" = yes ; then
AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
else
AC_DEFINE(NS_WARN_UNUSED_RESULT,)
fi
dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
dnl features that Windows actually does support.
@ -2717,6 +2699,11 @@ if test -n "$SKIP_COMPILER_CHECKS"; then
AC_DEFINE(HAVE_LOCALECONV)
fi # SKIP_COMPILER_CHECKS
dnl Mozilla specific options
dnl ========================================================
dnl The macros used for command line options
dnl are defined in build/autoconf/altoptions.m4.
dnl ========================================================
dnl = Mozilla update channel, used for disabling features
dnl = not wanted for release.

View File

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

View File

@ -312,8 +312,6 @@
# define MOZ_ALLOCATOR
#endif
#ifdef __cplusplus
/**
* MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's
* return value is not used by the caller.
@ -333,6 +331,8 @@
# define MOZ_WARN_UNUSED_RESULT
#endif
#ifdef __cplusplus
/*
* The following macros are attributes that support the static analysis plugin
* included with Mozilla, and will be implemented (when such support is enabled)

View File

@ -144,6 +144,7 @@ public:
PARTIAL_RELIABLE_TIMED = 2
} Type;
MOZ_WARN_UNUSED_RESULT
already_AddRefed<DataChannel> Open(const nsACString& label,
const nsACString& protocol,
Type type, bool inOrder,
@ -151,7 +152,7 @@ public:
DataChannelListener *aListener,
nsISupports *aContext,
bool aExternalNegotiated,
uint16_t aStream) NS_WARN_UNUSED_RESULT;
uint16_t aStream);
void Close(DataChannel *aChannel);
// CloseInt() must be called with mLock held

View File

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

View File

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

View File

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

View File

@ -156,7 +156,8 @@ public:
(PL_DHashTableAdd(&mTable, EntryType::KeyToPointer(aKey)));
}
EntryType* PutEntry(KeyType aKey, const fallible_t&) NS_WARN_UNUSED_RESULT
MOZ_WARN_UNUSED_RESULT
EntryType* PutEntry(KeyType aKey, const fallible_t&)
{
NS_ASSERTION(mTable.IsInitialized(),
"nsTHashtable was not initialized properly.");

View File

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

View File

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

View File

@ -357,22 +357,22 @@ public:
*/
void NS_FASTCALL Assign(char_type aChar);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(char_type aChar,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(char_type aChar,
const fallible_t&);
void NS_FASTCALL Assign(const char_type* aData);
void NS_FASTCALL Assign(const char_type* aData, size_type aLength);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const char_type* aData,
size_type aLength,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const char_type* aData,
size_type aLength,
const fallible_t&);
void NS_FASTCALL Assign(const self_type&);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const self_type&,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const self_type&,
const fallible_t&);
void NS_FASTCALL Assign(const substring_tuple_type&);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const substring_tuple_type&,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const substring_tuple_type&,
const fallible_t&);
#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
void Assign(char16ptr_t aData)
@ -380,8 +380,8 @@ public:
Assign(static_cast<const char16_t*>(aData));
}
NS_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData,
const fallible_t& aFallible)
{
return Assign(static_cast<const char16_t*>(aData), aFallible);
}
@ -391,8 +391,8 @@ public:
Assign(static_cast<const char16_t*>(aData), aLength);
}
NS_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData, size_type aLength,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData, size_type aLength,
const fallible_t& aFallible)
{
return Assign(static_cast<const char16_t*>(aData), aLength,
aFallible);
@ -400,16 +400,16 @@ public:
#endif
void NS_FASTCALL AssignASCII(const char* aData, size_type aLength);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
size_type aLength,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
size_type aLength,
const fallible_t&);
void NS_FASTCALL AssignASCII(const char* aData)
{
AssignASCII(aData, mozilla::AssertedCast<size_type, size_t>(strlen(aData)));
}
NS_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
const fallible_t& aFallible)
{
return AssignASCII(aData,
mozilla::AssertedCast<size_type, size_t>(strlen(aData)),
@ -472,27 +472,27 @@ public:
void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
char_type aChar);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
char_type aChar,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
char_type aChar,
const fallible_t&);
void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
const char_type* aData,
size_type aLength = size_type(-1));
NS_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
const char_type* aData,
size_type aLength,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
size_type aCutLength,
const char_type* aData,
size_type aLength,
const fallible_t&);
void Replace(index_type aCutStart, size_type aCutLength,
const self_type& aStr)
{
Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length());
}
NS_WARN_UNUSED_RESULT bool Replace(index_type aCutStart,
size_type aCutLength,
const self_type& aStr,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Replace(index_type aCutStart,
size_type aCutLength,
const self_type& aStr,
const fallible_t& aFallible)
{
return Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length(),
aFallible);
@ -504,10 +504,10 @@ public:
const char* aData,
size_type aLength = size_type(-1));
NS_WARN_UNUSED_RESULT bool NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
const char* aData,
size_type aLength,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
const char* aData,
size_type aLength,
const fallible_t&);
// ReplaceLiteral must ONLY be applied to an actual literal string.
// Do not attempt to use it with a regular char* pointer, or with a char
@ -523,8 +523,8 @@ public:
{
Replace(mLength, 0, aChar);
}
NS_WARN_UNUSED_RESULT bool Append(char_type aChar,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Append(char_type aChar,
const fallible_t& aFallible)
{
return Replace(mLength, 0, aChar, aFallible);
}
@ -532,8 +532,8 @@ public:
{
Replace(mLength, 0, aData, aLength);
}
NS_WARN_UNUSED_RESULT bool Append(const char_type* aData, size_type aLength,
const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Append(const char_type* aData, size_type aLength,
const fallible_t& aFallible)
{
return Replace(mLength, 0, aData, aLength, aFallible);
}
@ -549,7 +549,7 @@ public:
{
Replace(mLength, 0, aStr);
}
NS_WARN_UNUSED_RESULT bool Append(const self_type& aStr, const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool Append(const self_type& aStr, const fallible_t& aFallible)
{
return Replace(mLength, 0, aStr, aFallible);
}
@ -563,12 +563,12 @@ public:
ReplaceASCII(mLength, 0, aData, aLength);
}
NS_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, const fallible_t& aFallible)
{
return ReplaceASCII(mLength, 0, aData, size_type(-1), aFallible);
}
NS_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, size_type aLength, const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool AppendASCII(const char* aData, size_type aLength, const fallible_t& aFallible)
{
return ReplaceASCII(mLength, 0, aData, aLength, aFallible);
}
@ -639,7 +639,7 @@ public:
}
template<int N>
NS_WARN_UNUSED_RESULT bool AppendLiteral(const char (&aStr)[N], const fallible_t& aFallible)
MOZ_WARN_UNUSED_RESULT bool AppendLiteral(const char (&aStr)[N], const fallible_t& aFallible)
{
return AppendASCII(aStr, N - 1, aFallible);
}
@ -725,12 +725,12 @@ public:
* Also ensures that the buffer is mutable.
*/
void NS_FASTCALL SetCapacity(size_type aNewCapacity);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL SetCapacity(size_type aNewCapacity,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL SetCapacity(size_type aNewCapacity,
const fallible_t&);
void NS_FASTCALL SetLength(size_type aNewLength);
NS_WARN_UNUSED_RESULT bool NS_FASTCALL SetLength(size_type aNewLength,
const fallible_t&);
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL SetLength(size_type aNewLength,
const fallible_t&);
void Truncate(size_type aNewLength = 0)
{
@ -995,9 +995,9 @@ protected:
* this function returns false if is unable to allocate sufficient
* memory.
*/
NS_WARN_UNUSED_RESULT bool ReplacePrep(index_type aCutStart,
size_type aCutLength,
size_type aNewLength)
MOZ_WARN_UNUSED_RESULT bool ReplacePrep(index_type aCutStart,
size_type aCutLength,
size_type aNewLength)
{
aCutLength = XPCOM_MIN(aCutLength, mLength - aCutStart);
uint32_t newTotalLen = mLength - aCutLength + aNewLength;
@ -1010,7 +1010,7 @@ protected:
return ReplacePrepInternal(aCutStart, aCutLength, aNewLength, newTotalLen);
}
NS_WARN_UNUSED_RESULT bool NS_FASTCALL ReplacePrepInternal(
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL ReplacePrepInternal(
index_type aCutStart,
size_type aCutLength,
size_type aNewFragLength,
@ -1029,7 +1029,7 @@ protected:
* this helper function can be called prior to directly manipulating
* the contents of mData. see, for example, BeginWriting.
*/
NS_WARN_UNUSED_RESULT bool NS_FASTCALL EnsureMutable(
MOZ_WARN_UNUSED_RESULT bool NS_FASTCALL EnsureMutable(
size_type aNewLen = size_type(-1));
/**

View File

@ -18,9 +18,6 @@
/* Define if a dyanmic_cast to void* gives the most derived object */
#undef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
/* Define to either __attribute__((warn_unused_result)) or nothing */
#undef NS_WARN_UNUSED_RESULT
/* Define to a string describing the XPCOM ABI in use */
#undef TARGET_XPCOM_ABI