Bug 736501 - Use -Werror=unused-result, r=ted/mayhemer/njn

--HG--
extra : rebase_source : 121cddcd66f9be9b80840b47aecbe95307bae0ab
This commit is contained in:
Benjamin Smedberg 2012-05-01 09:24:38 -04:00
Родитель ab0b4264bb
Коммит 29018cbaa7
6 изменённых файлов: 32 добавлений и 15 удалений

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

@ -1748,11 +1748,15 @@ if test "$GNU_CC"; then
# -Werror=return-type - catches missing returns, zero false positives
# -Wtype-limits - catches overflow bugs, few false positives
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
#
# -Werror=unused-result - enforces __attribute__((warn_unused_result));
# Seldom used in system headers, but frequently in Mozilla code to
# enforce checking of fallible methods.
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
MOZ_C_SUPPORTS_WARNING(-W, error=unused-result, ac_c_has_werror_unused_result)
# Turn off the following warnings that -Wall/-pedantic turn on:
# -Wno-unused - lots of violations in third-party code
@ -1815,11 +1819,13 @@ if test "$GNU_CXX"; then
# -Werror=return-type - catches missing returns, zero false positives
# -Wtype-limits - catches overflow bugs, few false positives
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
#
# -Werror=unused-result - see above
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
MOZ_CXX_SUPPORTS_WARNING(-W, error=unused-result, ac_cxx_has_werror_unused_result)
# Turn off the following warnings that -Wall/-pedantic turn on:
# -Wno-ctor-dtor-privacy - ???

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

@ -444,7 +444,7 @@ ContentParent::ContentParent()
nsCString buildID(gAppData->buildID);
//Sending all information to content process
SendAppInfo(version, buildID);
unused << SendAppInfo(version, buildID);
}
}
@ -730,10 +730,10 @@ ContentParent::Observe(nsISupports* aSubject,
unused << SendPMemoryReportRequestConstructor();
}
else if (!strcmp(aTopic, "child-gc-request")){
SendGarbageCollect();
unused << SendGarbageCollect();
}
else if (!strcmp(aTopic, "child-cc-request")){
SendCycleCollect();
unused << SendCycleCollect();
}
else if (!strcmp(aTopic, "last-pb-context-exited")) {
unused << SendLastPrivateDocShellDestroyed();

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

@ -47,6 +47,7 @@
#include "nsCoreAnimationSupport.h"
#endif
#include "mozilla/unused.h"
#include "npfunctions.h"
#include "nsAutoPtr.h"
#include "nsDataHashtable.h"
@ -305,7 +306,7 @@ public:
nsresult HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled);
#endif
void DidComposite() { SendNPP_DidComposite(); }
void DidComposite() { unused << SendNPP_DidComposite(); }
private:
// Create an appropriate platform surface for a background of size

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

@ -1634,12 +1634,16 @@ if test "$GNU_CC"; then
# -Werror=return-type - catches missing returns, zero false positives
# -Wtype-limits - catches overflow bugs, few false positives
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
#
# -Werror=unused-result - enforces __attribute__((warn_unused_result));
# Seldom used in system headers, but frequently in Mozilla code to
# enforce checking of fallible methods.
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
MOZ_C_SUPPORTS_WARNING(-W, error=unused-result, ac_c_has_werror_unused_result)
# Turn off the following warnings that -Wall/-pedantic turn on:
# -Wno-unused - lots of violations in third-party code
# -Wno-overlength-strings - we exceed the minimum maximum length frequently
@ -1698,11 +1702,13 @@ if test "$GNU_CXX"; then
# -Werror=return-type - catches missing returns, zero false positives
# -Wtype-limits - catches overflow bugs, few false positives
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
#
# -Werror=unused-result - see above
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
MOZ_CXX_SUPPORTS_WARNING(-W, error=unused-result, ac_cxx_has_werror_unused_result)
# Turn off the following warnings that -Wall/-pedantic turn on:
# -Wno-ctor-dtor-privacy - ???

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

@ -3,6 +3,9 @@
#include "nscore.h"
#include "nsXULAppAPI.h"
#include "nsExceptionHandler.h"
#include "mozilla/unused.h"
using mozilla::unused;
/*
* This pure virtual call example is from MSDN
@ -63,9 +66,9 @@ void Crash(PRInt16 how)
break;
}
case CRASH_OOM: {
(void) moz_xmalloc((size_t) -1);
(void) moz_xmalloc((size_t) -1);
(void) moz_xmalloc((size_t) -1);
unused << moz_xmalloc((size_t) -1);
unused << moz_xmalloc((size_t) -1);
unused << moz_xmalloc((size_t) -1);
break;
}
default:

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

@ -39,6 +39,7 @@
#include "OfflineCacheUpdateParent.h"
#include "nsOfflineCacheUpdate.h"
#include "nsIApplicationCache.h"
#include "mozilla/unused.h"
#if defined(PR_LOGGING)
//
@ -142,7 +143,7 @@ OfflineCacheUpdateParent::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate, PRU
LOG(("OfflineCacheUpdateParent::StateEvent [%p]", this));
SendNotifyStateEvent(state);
unused << SendNotifyStateEvent(state);
if (state == nsIOfflineCacheUpdateObserver::STATE_FINISHED) {
// Tell the child the particulars after the update has finished.
@ -153,7 +154,7 @@ OfflineCacheUpdateParent::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate, PRU
bool succeeded;
aUpdate->GetSucceeded(&succeeded);
SendFinish(succeeded, isUpgrade);
unused << SendFinish(succeeded, isUpgrade);
}
return NS_OK;
@ -172,7 +173,7 @@ OfflineCacheUpdateParent::ApplicationCacheAvailable(nsIApplicationCache *aApplic
nsCString cacheGroupId;
aApplicationCache->GetGroupID(cacheGroupId);
SendAssociateDocuments(cacheGroupId, cacheClientId);
unused << SendAssociateDocuments(cacheGroupId, cacheClientId);
return NS_OK;
}