Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium
authorJim Blandy <jimb@mozilla.com>
Thu, 19 Mar 2015 00:46:40 -0700
changeset 256781 79bdb9d8ca5bf2effdc988ba8b9982a2d9fc8455
parent 256780 5de65d408dbccab3f52af0c04377b0f790bc7dac
child 256782 55db417e2e0927be2b0ca957283a1f3f4005cde1
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-esr52@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1145051
milestone40.0a1
Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium
configure.in
dom/base/FragmentOrElement.h
dom/base/nsContentUtils.h
dom/base/nsGenericDOMDataNode.h
dom/base/nsHTMLContentSerializer.h
dom/base/nsIContent.h
dom/base/nsTextFragment.h
dom/base/nsXHTMLContentSerializer.h
dom/base/nsXMLContentSerializer.h
dom/bindings/MozMap.h
dom/ipc/nsIContentParent.h
ipc/ipdl/ipdl/cxx/cgen.py
js/src/configure.in
memory/mozalloc/mozalloc.h
mfbt/Attributes.h
netwerk/sctp/datachannel/DataChannel.h
toolkit/components/url-classifier/HashStore.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsDeque.h
xpcom/glue/nsTHashtable.h
xpcom/string/nsReadableUtils.h
xpcom/string/nsTString.h
xpcom/string/nsTSubstring.h
xpcom/xpcom-config.h.in
--- a/configure.in
+++ b/configure.in
@@ -3431,23 +3431,16 @@ dnl See if compiler supports some gcc-st
 
 AC_CACHE_CHECK(for __attribute__((always_inline)),
                ac_cv_attribute_always_inline,
                [AC_TRY_COMPILE([inline void f(void) __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
 
 dnl ========================================================
 dnl =  Internationalization checks
 dnl ========================================================
 dnl
 dnl Internationalization and Locale support is different
@@ -3469,37 +3462,31 @@ AC_HAVE_FUNCS(localeconv)
 fi # ! SKIP_COMPILER_CHECKS
 
 TARGET_XPCOM_ABI=
 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
     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.
 
 if test -n "$SKIP_COMPILER_CHECKS"; then
    dnl Windows has malloc.h
    AC_DEFINE(MALLOC_H, [<malloc.h>])
    AC_DEFINE(HAVE_FORCEINLINE)
    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
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(External Packages)
 
 MOZ_ARG_WITH_STRING(libxul-sdk,
--- a/dom/base/FragmentOrElement.h
+++ b/dom/base/FragmentOrElement.h
@@ -181,18 +181,18 @@ public:
   {
     return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
   }
   virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
                               bool aNotify) override;
   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,
                              nsBindingManager* aOldBindingManager = nullptr) override;
   virtual ShadowRoot *GetShadowRoot() const override;
   virtual ShadowRoot *GetContainingShadow() const override;
   virtual nsTArray<nsIContent*> &DestInsertionPoints() override;
   virtual nsTArray<nsIContent*> *GetExistingDestInsertionPoints() const override;
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1272,18 +1272,19 @@ public:
    * added to the result.
    *
    * @param aNode Node to get textual contents of.
    * @param aDeep If true child elements of aNode are recursivly descended
    *              into to find text children.
    * @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.
    */
   static bool AppendNodeTextContent(nsINode* aNode, bool aDeep,
                                     nsAString& aResult, const mozilla::fallible_t&);
 
   /**
@@ -1748,18 +1749,19 @@ public:
    */
   static void RemoveNewlines(nsString &aString);
 
   /**
    * Convert Windows and Mac platform linebreaks to \n.
    * @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
    * to aBuf's null-terminator.  aBuf must not be null. Ownership of the string
    * is not transferred.
    */
   static void PopulateStringFromStringBuffer(nsStringBuffer* aBuf,
                                              nsAString& aResultString);
--- a/dom/base/nsGenericDOMDataNode.h
+++ b/dom/base/nsGenericDOMDataNode.h
@@ -137,18 +137,19 @@ public:
   {
     return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
   }
   virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
                               bool aNotify) override;
   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;
 
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
 #endif
 
--- a/dom/base/nsHTMLContentSerializer.h
+++ b/dom/base/nsHTMLContentSerializer.h
@@ -31,26 +31,26 @@ class nsHTMLContentSerializer final : pu
 
   NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement,
                               nsAString& aStr) override;
 
   NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument,
                                  nsAString& aStr) override;
  protected:
 
-  NS_WARN_UNUSED_RESULT
+  MOZ_WARN_UNUSED_RESULT
   virtual bool SerializeHTMLAttributes(nsIContent* aContent,
                                        nsIContent *aOriginalElement,
                                        nsAString& aTagPrefix,
                                        const nsAString& aTagNamespaceURI,
                                        nsIAtom* aTagName,
                                        int32_t aNamespace,
                                        nsAString& aStr);
 
-  NS_WARN_UNUSED_RESULT
+  MOZ_WARN_UNUSED_RESULT
   virtual bool AppendAndTranslateEntities(const nsAString& aStr,
                                           nsAString& aOutputStr) override;
 
 };
 
 nsresult
 NS_NewHTMLContentSerializer(nsIContentSerializer** aSerializer);
 
--- a/dom/base/nsIContent.h
+++ b/dom/base/nsIContent.h
@@ -540,18 +540,18 @@ public:
    * NOTE: This asserts and returns for elements
    */
   virtual void AppendTextTo(nsAString& aResult) = 0;
 
   /**
    * 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.
    * Note: most callers should use nsIFrame::IsFocusable() instead as it 
    *       checks visibility and other layout factors as well.
    * Tabbable is indicated by a nonnegative tabindex & is a subset of focusable.
    * For example, only the selected radio button in a group is in the 
    * tab order, unless the radio group has no selection in which case
--- a/dom/base/nsTextFragment.h
+++ b/dom/base/nsTextFragment.h
@@ -129,18 +129,19 @@ public:
       aString.AllocFailed(aString.Length() + GetLength());
     }
   }
 
   /**
    * 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) {
         return false;
       }
 
       return true;
     } else {
@@ -162,18 +163,19 @@ public:
 
   /**
    * Append a substring of the contents of this string fragment to aString.
    * @param aString the string in which to append
    * @param aOffset where to start the substring in this text fragment
    * @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);
       if (!ok) {
         return false;
       }
 
       return true;
--- a/dom/base/nsXHTMLContentSerializer.h
+++ b/dom/base/nsXHTMLContentSerializer.h
@@ -41,23 +41,23 @@ class nsXHTMLContentSerializer : public 
  protected:
 
 
   virtual bool CheckElementStart(nsIContent * aContent,
                           bool & aForceFormat,
                           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;
 
   virtual bool CheckElementEnd(nsIContent * aContent,
                           bool & aForceFormat,
                           nsAString& aStr) override;
 
@@ -70,35 +70,35 @@ class nsXHTMLContentSerializer : public 
   virtual bool LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aName) override;
 
   bool HasLongLines(const nsString& text, int32_t& aLastNewlineOffset);
 
   // functions to check if we enter in or leave from a preformated content
   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,
                            const nsAString& aTagNamespaceURI,
                            nsIAtom* aTagName,
                            nsAString& aStr,
                            uint32_t aSkipAttr,
                            bool aAddNSAttr) override;
 
   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;
 
   nsresult EscapeURI(nsIContent* aContent,
                      const nsAString& aURI,
                      nsAString& aEscapedURI);
 
 private:
--- a/dom/base/nsXMLContentSerializer.h
+++ b/dom/base/nsXMLContentSerializer.h
@@ -67,92 +67,92 @@ class nsXMLContentSerializer : public ns
                                  nsAString& aStr) override;
 
  protected:
   virtual ~nsXMLContentSerializer();
 
   /**
    * 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);
 
   /**
    * Appends a string by replacing all line-endings
    * 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);
 
   /**
    * 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);
 
   /**
    * 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,
           const nsASingleFragmentString::const_char_iterator aSequenceStart,
           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,
           const nsASingleFragmentString::const_char_iterator aSequenceStart,
           bool &aMayIgnoreStartOfLineWhitespaceSequence,
           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,
           const nsASingleFragmentString::const_char_iterator aSequenceStart,
           bool &aMayIgnoreStartOfLineWhitespaceSequence,
           bool &aSequenceStartAfterAWhiteSpace,
           nsAString &aOutputStr);
 
   /**
    * 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);
 
 
   /**
    * 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);
 
   /**
    * retrieve the text content of the node and append it to the given string
    * It doesn't increment the column position
    */
   nsresult AppendTextData(nsIContent* aNode,
@@ -192,27 +192,27 @@ class nsXMLContentSerializer : public ns
    * GenerateNewPrefix generates a new prefix and writes it to aPrefix
    */
   void GenerateNewPrefix(nsAString& aPrefix);
 
   uint32_t ScanNamespaceDeclarations(nsIContent* aContent,
                                      nsIContent *aOriginalElement,
                                      const nsAString& aTagNamespaceURI);
 
-  NS_WARN_UNUSED_RESULT
+  MOZ_WARN_UNUSED_RESULT
   virtual bool SerializeAttributes(nsIContent* aContent,
                                    nsIContent *aOriginalElement,
                                    nsAString& aTagPrefix,
                                    const nsAString& aTagNamespaceURI,
                                    nsIAtom* aTagName,
                                    nsAString& aStr,
                                    uint32_t aSkipAttr,
                                    bool aAddNSAttr);
 
-  NS_WARN_UNUSED_RESULT
+  MOZ_WARN_UNUSED_RESULT
   bool SerializeAttr(const nsAString& aPrefix,
                      const nsAString& aName,
                      const nsAString& aValue,
                      nsAString& aStr,
                      bool aDoEscapeEntities);
 
   bool IsJavaScript(nsIContent * aContent,
                       nsIAtom* aAttrNameAtom,
@@ -231,28 +231,28 @@ class nsXMLContentSerializer : public ns
                                    bool & aForceFormat,
                                    nsAString& aStr,
                                    nsresult& aResult);
 
   /**
    * 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,
                                        nsAString& aStr);
 
   /**
    * This method can be redefine to serialize additional things just after
    * 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; };
 
   /**
    * This method can be redefined to check if the element can be serialized.
    * It is called when the serialization of the end tag is asked 
    * (AppendElementEnd)
@@ -291,26 +291,26 @@ class nsXMLContentSerializer : public ns
    * Returns true if a line break should be inserted after an element close tag
    */
   virtual bool LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aName);
 
   /**
    * 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);
 
   // Functions to check if we enter in or leave from a preformated content
   virtual void MaybeEnterInPreContent(nsIContent* aNode);
   virtual void MaybeLeaveFromPreContent(nsIContent* aNode);
 
   bool ShouldMaintainPreLevel() const;
--- a/dom/bindings/MozMap.h
+++ b/dom/bindings/MozMap.h
@@ -12,16 +12,17 @@
 
 #ifndef mozilla_dom_MozMap_h
 #define mozilla_dom_MozMap_h
 
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsStringGlue.h"
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/Move.h"
 
 namespace mozilla {
 namespace dom {
 
 namespace binding_detail {
 template<typename DataType>
 class MozMapEntry : public nsStringHashKey
@@ -95,17 +96,18 @@ public:
   // with a dependency on BindingUtils.h here for the SequenceTracer bits.
   typedef PLDHashOperator (* Enumerator)(DataType* aValue, void* aClosure);
   void EnumerateValues(Enumerator aEnumerator, void *aClosure)
   {
     ValueEnumClosure args = { aEnumerator, aClosure };
     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) {
       return nullptr;
     }
     return &ent->mData;
   }
 
--- a/dom/ipc/nsIContentParent.h
+++ b/dom/ipc/nsIContentParent.h
@@ -2,16 +2,17 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_nsIContentParent_h
 #define mozilla_dom_nsIContentParent_h
 
+#include "mozilla/Attributes.h"
 #include "mozilla/dom/ipc/IdType.h"
 
 #include "nsFrameMessageManager.h"
 #include "nsISupports.h"
 #include "mozilla/dom/CPOWManagerGetter.h"
 
 #define NS_ICONTENTPARENT_IID                                   \
   { 0xeeec9ebf, 0x8ecf, 0x4e38,                                 \
@@ -50,28 +51,30 @@ public:
   nsIContentParent();
 
   BlobParent* GetOrCreateActorForBlob(File* aBlob);
 
   virtual ContentParentId ChildID() = 0;
   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,
     const IPCTabContext& context,
     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();
 
 protected: // methods
   bool CanOpenBrowser(const IPCTabContext& aContext);
 
 protected: // IPDL methods
--- a/ipc/ipdl/ipdl/cxx/cgen.py
+++ b/ipc/ipdl/ipdl/cxx/cgen.py
@@ -178,16 +178,18 @@ class CxxCodeGen(CodePrinter, Visitor):
 
         if md.T:
             self.write('template<')
             self.write('typename ')
             md.T.accept(self)
             self.println('>')
             self.printdent()
 
+        if md.warn_unused:
+            self.write('MOZ_WARN_UNUSED_RESULT ')
         if md.inline:
             self.write('inline ')
         if md.never_inline:
             self.write('MOZ_NEVER_INLINE ')
         if md.static:
             self.write('static ')
         if md.virtual:
             self.write('virtual ')
@@ -208,18 +210,16 @@ class CxxCodeGen(CodePrinter, Visitor):
         self.writeDeclList(md.params)
         self.write(')')
 
         if md.const:
             self.write(' const')
         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')
 
 
     def visitMethodDefn(self, md):
         if md.decl.pure:
             return
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2654,23 +2654,16 @@ dnl See if compiler supports some gcc-st
 
 AC_CACHE_CHECK(for __attribute__((always_inline)),
                ac_cv_attribute_always_inline,
                [AC_TRY_COMPILE([inline void f(void) __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
 
 dnl ========================================================
 dnl =  Internationalization checks
 dnl ========================================================
 dnl
 dnl Internationalization and Locale support is different
@@ -2691,37 +2684,31 @@ fi
 AC_HAVE_FUNCS(localeconv)
 fi # ! SKIP_COMPILER_CHECKS
 
 TARGET_XPCOM_ABI=
 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.
 
 if test -n "$SKIP_COMPILER_CHECKS"; then
    dnl Windows has malloc.h
    AC_DEFINE(MALLOC_H, [<malloc.h>])
    AC_DEFINE(HAVE_FORCEINLINE)
    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.
 dnl ========================================================
 
 # app update channel is 'default' when not supplied.
 MOZ_ARG_ENABLE_STRING([update-channel],
 [  --enable-update-channel=CHANNEL
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -33,18 +33,18 @@
 #elif defined(HAVE_FORCEINLINE)
 #  define MOZALLOC_INLINE __forceinline
 #else
 #  define MOZALLOC_INLINE inline
 #endif
 
 /* 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
 
 #if defined(__cplusplus)
 extern "C" {
 #endif /* ifdef __cplusplus */
 
@@ -93,21 +93,21 @@ MFBT_API size_t moz_malloc_size_of(const
 
 #if defined(HAVE_STRNDUP)
 MFBT_API char* moz_xstrndup(const char* str, size_t strsize)
     MOZ_ALLOCATOR;
 #endif /* if defined(HAVE_STRNDUP) */
 
 
 #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) */
 
 
 #if defined(HAVE_MEMALIGN)
 MFBT_API void* moz_xmemalign(size_t boundary, size_t size)
     MOZ_ALLOCATOR;
 #endif /* if defined(HAVE_MEMALIGN) */
 
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -307,18 +307,16 @@
  *   void *my_allocator(size_t bytes) MOZ_ALLOCATOR { ... }
  */
 #if defined(__GNUC__) || defined(__clang__)
 #  define MOZ_ALLOCATOR __attribute__ ((malloc, warn_unused_result))
 #else
 #  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.
  *
  * Place this attribute at the very beginning of a function definition. For
  * example, write
  *
  *   MOZ_WARN_UNUSED_RESULT int foo();
@@ -328,16 +326,18 @@
  *   MOZ_WARN_UNUSED_RESULT int foo() { return 42; }
  */
 #if defined(__GNUC__) || defined(__clang__)
 #  define MOZ_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
 #else
 #  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)
  * as C++11 attributes. Since such attributes are legal pretty much everywhere
  * and have subtly different semantics depending on their placement, the
  * following is a guide on where to place the attributes.
  *
  * Attributes that apply to a struct or class precede the name of the class:
--- a/netwerk/sctp/datachannel/DataChannel.h
+++ b/netwerk/sctp/datachannel/DataChannel.h
@@ -139,24 +139,25 @@ public:
 #endif
 
   typedef enum {
     RELIABLE=0,
     PARTIAL_RELIABLE_REXMIT = 1,
     PARTIAL_RELIABLE_TIMED = 2
   } Type;
 
+  MOZ_WARN_UNUSED_RESULT
   already_AddRefed<DataChannel> Open(const nsACString& label,
                                      const nsACString& protocol,
                                      Type type, bool inOrder,
                                      uint32_t prValue,
                                      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
   void CloseInt(DataChannel *aChannel);
   void CloseAll();
 
   int32_t SendMsg(uint16_t stream, const nsACString &aMsg)
     {
--- a/toolkit/components/url-classifier/HashStore.h
+++ b/toolkit/components/url-classifier/HashStore.h
@@ -34,38 +34,38 @@ public:
       mAddPrefixes.Length() == 0 &&
       mSubPrefixes.Length() == 0 &&
       mAddCompletes.Length() == 0 &&
       mSubCompletes.Length() == 0;
   }
 
   // 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; }
 
   ChunkSet& AddChunks() { return mAddChunks; }
   ChunkSet& SubChunks() { return mSubChunks; }
 
   // Expirations for chunks.
   ChunkSet& AddExpirations() { return mAddExpirations; }
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -123,18 +123,18 @@ public:
    */
   void Put(KeyType aKey, const UserDataType& aData)
   {
     if (!Put(aKey, aData, mozilla::fallible)) {
       NS_ABORT_OOM(this->mTable.EntrySize() * this->mTable.EntryCount());
     }
   }
 
-  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) {
       return false;
     }
 
     ent->mData = aData;
 
--- a/xpcom/glue/nsDeque.h
+++ b/xpcom/glue/nsDeque.h
@@ -84,31 +84,31 @@ public:
    */
   void Push(void* aItem)
   {
     if (!Push(aItem, mozilla::fallible)) {
       NS_ABORT_OOM(mSize * sizeof(void*));
     }
   }
 
-  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.
    *
    * @param   item to store in deque
    */
   void PushFront(void* aItem)
   {
     if (!PushFront(aItem, mozilla::fallible)) {
       NS_ABORT_OOM(mSize * sizeof(void*));
     }
   }
 
-  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.
    *
    * @return  the item that was the last item in container
    */
   void* Pop();
 
--- a/xpcom/glue/nsTHashtable.h
+++ b/xpcom/glue/nsTHashtable.h
@@ -151,17 +151,18 @@ public:
   {
     NS_ASSERTION(mTable.IsInitialized(),
                  "nsTHashtable was not initialized properly.");
 
     return static_cast<EntryType*>  // infallible add
       (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.");
 
     return static_cast<EntryType*>
       (PL_DHashTableAdd(&mTable, EntryType::KeyToPointer(aKey),
                         mozilla::fallible));
   }
--- a/xpcom/string/nsReadableUtils.h
+++ b/xpcom/string/nsReadableUtils.h
@@ -35,44 +35,44 @@ Distance(const nsReadingIterator<char>& 
 
 void LossyCopyUTF16toASCII(const nsAString& aSource, nsACString& aDest);
 void CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
 
 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);
 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);
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
 inline void AppendUTF16toUTF8(char16ptr_t aSource, nsACString& aDest)
 {
   return AppendUTF16toUTF8(static_cast<const char16_t*>(aSource), aDest);
--- a/xpcom/string/nsTString.h
+++ b/xpcom/string/nsTString.h
@@ -388,22 +388,22 @@ public:
 #endif
   /**
    * Replace all occurrences of aTarget with aNewValue.
    * The complexity of this function is O(n+m), n being the length of the string
    * and m being the length of aNewValue.
    */
   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&);
 
 
   /**
    *  This method trims characters found in aTrimSet from
    *  either end of the underlying string.
    *
    *  @param   aSet -- contains chars to be trimmed from both ends
    *  @param   aEliminateLeading
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -352,69 +352,69 @@ public:
     return LowerCaseEqualsASCII(aStr, N - 1);
   }
 
   /**
    * assignment
    */
 
   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)
   {
     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);
   }
 
   void Assign(char16ptr_t aData, size_type aLength)
   {
     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);
   }
 #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)),
                        aFallible);
   }
 
   // AssignLiteral must ONLY be applied to an actual literal string, or
   // a char array *constant* declared without an explicit size.
@@ -467,113 +467,113 @@ public:
 
 
   /**
    * buffer manipulation
    */
 
   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);
   }
   void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
                            const substring_tuple_type& aTuple);
 
   void NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
                                 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
   // array variable. Use Replace or ReplaceASCII for those.
   template<int N>
   void ReplaceLiteral(index_type aCutStart, size_type aCutLength,
                       const char_type (&aStr)[N])
   {
     ReplaceLiteral(aCutStart, aCutLength, aStr, N - 1);
   }
 
   void Append(char_type aChar)
   {
     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);
   }
   void Append(const char_type* aData, size_type aLength = size_type(-1))
   {
     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);
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   void Append(char16ptr_t aData, size_type aLength = size_type(-1))
   {
     Append(static_cast<const char16_t*>(aData), aLength);
   }
 #endif
 
   void Append(const self_type& aStr)
   {
     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);
   }
   void Append(const substring_tuple_type& aTuple)
   {
     Replace(mLength, 0, aTuple);
   }
 
   void AppendASCII(const char* aData, size_type aLength = size_type(-1))
   {
     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);
   }
 
   /**
    * Append a formatted string to the current string. Uses the format
    * codes documented in prprf.h
    */
@@ -634,17 +634,17 @@ public:
 #ifdef CharT_is_PRUnichar
   template<int N>
   void AppendLiteral(const char (&aStr)[N])
   {
     AppendASCII(aStr, N - 1);
   }
 
   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);
   }
 #endif
 
   self_type& operator+=(char_type aChar)
   {
     Append(aChar);
@@ -720,22 +720,22 @@ public:
   /**
    * Attempts to set the capacity to the given size in number of
    * characters, without affecting the length of the string.
    * There is no need to include room for the null terminator: it is
    * the job of the string class.
    * 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)
   {
     NS_ASSERTION(aNewLength <= mLength, "Truncate cannot make string longer");
     SetLength(aNewLength);
   }
 
 
@@ -990,32 +990,32 @@ protected:
    *
    * would cause mData to look like "ab____f" where the characters
    * indicated by '_' have an unspecified value and can be freely
    * modified.  this function will null-terminate mData upon return.
    *
    * 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;
     if (aCutStart == mLength && Capacity() > newTotalLen) {
       mFlags &= ~F_VOIDED;
       mData[newTotalLen] = char_type(0);
       mLength = newTotalLen;
       return true;
     }
     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,
     size_type aNewTotalLength);
 
   /**
    * returns the number of writable storage units starting at mData.
    * the value does not include space for the null-terminator character.
@@ -1024,17 +1024,17 @@ protected:
    *       is 0-sized).
    */
   size_type NS_FASTCALL Capacity() const;
 
   /**
    * 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));
 
   /**
    * returns true if this string overlaps with the given string fragment.
    */
   bool IsDependentOn(const char_type* aStart, const char_type* aEnd) const
   {
     /**
--- a/xpcom/xpcom-config.h.in
+++ b/xpcom/xpcom-config.h.in
@@ -13,15 +13,12 @@
 #undef CPP_THROW_NEW
 
 /* Define if the c++ compiler can resolve ambiguity with |using| */
 #undef HAVE_CPP_AMBIGUITY_RESOLVING_USING
 
 /* 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
 
 #endif /* _XPCOM_CONFIG_H_ */