gecko-dev/xpcom/glue
Nicholas Nethercote 34dcc7b852 Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm.
This change avoids lots of false positives for Coverity's CHECKED_RETURN
warning, caused by NS_WARN_IF's current use in both statement-style and
expression-style.

In the case where the code within the NS_WARN_IF has side-effects, I made the
following change.

> NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));
> -->
> Unused << NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));

In the case where the code within the NS_WARN_IF lacks side-effects, I made the
following change.

> NS_WARN_IF(!condWithoutSideEffects);
> -->
> NS_WARNING_ASSERTION(condWithoutSideEffects, "msg");

This has two improvements.
- The condition is not evaluated in non-debug builds.
- The sense of the condition is inverted to the familiar "this condition should
  be true" sense used in assertions.

A common variation on the side-effect-free case is the following.

> nsresult rv = Fn();
> NS_WARN_IF_(NS_FAILED(rv));
> -->
> DebugOnly<nsresult rv> = Fn();
> NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Fn failed");

--HG--
extra : rebase_source : 58788245021096efa8372a9dc1d597a611d45611
2016-09-02 17:12:24 +10:00
..
standalone Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
staticruntime Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
tests/gtest Bug 1292892 part 1 - Stop using JSRuntime outside SpiderMonkey. r=bz,terrence,fitzgen,kanru 2016-08-11 14:39:22 +02:00
AppData.cpp Bug 1035125 Part 9: Link Chromium sandbox into firefox.exe instead of having a separate DLL. r=aklotz,glandium 2016-05-15 16:41:40 +01:00
AppData.h
AutoRestore.h Bug 1272831 - Add AutoRestore::SavedValue() to retrieve the saved value. r=froydnj 2016-05-14 09:47:14 +08:00
BlockingResourceBase.cpp Bug 1270938 - Add stack traces for blocking resource base warnings. r=froydnj 2016-05-23 14:59:30 -07:00
BlockingResourceBase.h
CondVar.h
DeadlockDetector.h
EnumeratedArrayCycleCollection.h
FileUtils.cpp
FileUtils.h
GenericFactory.cpp
GenericFactory.h
GenericModule.cpp
IntentionalCrash.h
MainThreadUtils.h Bug 1295053 (part 1) - Don't use NS_METHOD for xpcom thread utility functions. r=froydnj. 2016-08-15 14:29:43 +10:00
Monitor.h
moz.build Bug 1262826 - specialize nsTHashtable<nsPtrHashKey<T>> to share a common implementation; r=erahm 2016-08-22 18:45:47 -04:00
Mutex.h
nsArrayEnumerator.cpp
nsArrayEnumerator.h
nsArrayUtils.cpp
nsArrayUtils.h
nsBaseHashtable.h Bug 1288038 - Make fallible nsBaseHashtable::Put use fallible nsTHashtable::PutEntry. r=froydnj r=sfink 2016-08-03 09:18:35 +08:00
nsCategoryCache.cpp
nsCategoryCache.h Bug 1278925 - micro-optimize nsCOMArray appending with already_AddRefed AppendElement; r=erahm 2016-06-20 18:38:10 -04:00
nsClassHashtable.h Bug 1290524: Allow nsClassHashTable::LookupOrAdd to provide arguments to construct the new object. 2016-07-30 15:03:11 -07:00
nsClassInfoImpl.cpp
nsCOMArray.cpp Bug 1295197 - use non-null-checked operator new in xpcom/; r=erahm 2016-08-22 18:40:10 -04:00
nsCOMArray.h Bug 1289890 - Change nsCOMArray::ReplaceObjectAt() return type from "bool" to "void", since it always succeeds. r=froyndnj 2016-08-02 16:20:00 +02:00
nsComponentManagerUtils.cpp Bug 1262400 - remove outer pointers from nsCreateInstance* classes; r=erahm 2016-04-14 11:30:59 -04:00
nsComponentManagerUtils.h Bug 1262400 - remove outer pointers from nsCreateInstance* classes; r=erahm 2016-04-14 11:30:59 -04:00
nsCOMPtr.cpp Bug 1279998 - Remove NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS. r=froydnj 2016-08-01 11:16:19 -07:00
nsCOMPtr.h Bug 1279998 - Remove NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS. r=froydnj 2016-08-01 11:16:19 -07:00
nsCRTGlue.cpp Bug 1293384 - Part 2: Rename Snprintf.h header to Sprintf.h. r=froydnj 2016-08-14 23:43:21 -07:00
nsCRTGlue.h
nsCycleCollectionNoteChild.h
nsCycleCollectionNoteRootCallback.h
nsCycleCollectionParticipant.cpp
nsCycleCollectionParticipant.h Bug 1277775 - Replace MOZ_CONSTEXPR{_VAR,_TMPL} with constexpr. r=froydnj 2016-07-08 14:39:53 -07:00
nsCycleCollectionTraversalCallback.h
nsDataHashtable.h Bug 1291707 part 2 - Add GetAndRemove to nsDataHashtable. r=froydnj 2016-08-23 10:31:26 +10:00
nsDebug.h Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm. 2016-09-02 17:12:24 +10:00
nsDeque.cpp Bug 1264199: P0. Fix nsDequeue/MediaQueue methods constness. r=jwwang 2016-04-25 12:13:55 +10:00
nsDeque.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
nsEnumeratorUtils.cpp
nsEnumeratorUtils.h
nsHashKeys.h Bug 1262826 - specialize nsTHashtable<nsPtrHashKey<T>> to share a common implementation; r=erahm 2016-08-22 18:45:47 -04:00
nsIClassInfoImpl.h Bug 1295053 (part 5) - Remove an unnecessary use of NS_CALLBACK in ClassInfoData. r=froydnj. 2016-08-16 07:56:26 +10:00
nsID.cpp Bug 1293384 - Part 1: Rename snprintf_literal to SprintfLiteral. r=froydnj 2016-08-14 23:44:00 -07:00
nsID.h Bug 1242963 - nsID stringification helper for logging; r=froydnj 2015-10-08 13:11:04 -04:00
nsIInterfaceRequestorUtils.cpp
nsIInterfaceRequestorUtils.h
nsINIParser.cpp
nsINIParser.h
nsInterfaceHashtable.h
nsISupportsImpl.cpp
nsISupportsImpl.h Bug 956338 - Add checks to WeakPtr/nsWeakReference and related classes to assert single-thread usage. r=nfroyd 2016-08-01 13:16:16 +02:00
nsISupportsUtils.h
nsIWeakReferenceUtils.h
nsJSThingHashtable.h
nsMemory.cpp
nsMemory.h
nsPointerHashKeys.h Bug 1262826 - specialize nsTHashtable<nsPtrHashKey<T>> to share a common implementation; r=erahm 2016-08-22 18:45:47 -04:00
nsProxyRelease.cpp Bug 1247972 - specialize NS_ProxyRelease for nsISupports to be out-of-line; r=erahm 2016-06-29 18:56:41 -04:00
nsProxyRelease.h Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj 2016-08-24 14:47:04 +08:00
nsQuickSort.cpp
nsQuickSort.h
nsRefPtrHashtable.h Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj. 2016-04-27 14:16:50 +10:00
nsServiceManagerUtils.h
nsStringAPI.cpp Bug 1277155 - Part 1: Remove snprintf() polyfills for VS2013 in Sprintf.h and #defines. r=froydnj r=mhowell 2016-06-27 20:45:03 -07:00
nsStringAPI.h Bug 1277106 - Part 2: Expand MOZ_UTF16() strings to u"" string literals. r=Waldo 2016-07-20 22:03:25 -07:00
nsStringGlue.h
nsTArray-inl.h Bug 1271751 - part 6 - make ShiftData actually move its elements rather than copying; r=erahm 2016-07-08 16:59:05 -04:00
nsTArray.cpp Bug 1159244 - Add release mode bounds checking with custom annotations to nsTArray, r=froydnj 2016-08-15 13:29:45 -04:00
nsTArray.h Bug 1264642 - Part 6. Mark JSStructuredCloneData as MOZ_NON_MEMMOVABLE and add specializations in nsTArray.h. r=froydnj 2016-08-23 00:40:47 +08:00
nsTArrayForwardDeclare.h Bug 1288077: Cleanup forward declarations of array types, r=froydnj 2016-07-20 17:29:36 +02:00
nsTextFormatter.cpp Bug 1296231 - Fix some missing "Missing varargs cleanup" and "Resource leaks" r=froydnj 2016-08-18 10:46:05 +02:00
nsTextFormatter.h
nsTHashtable.h Bug 1262826 - specialize nsTHashtable<nsPtrHashKey<T>> to share a common implementation; r=erahm 2016-08-22 18:45:47 -04:00
nsThreadUtils.cpp Bug 1299389 - Replace some raw pointers in nsThreadManager. r=froydnj. 2016-06-10 16:04:49 +10:00
nsThreadUtils.h Bug 1299727 - Rename NS_WARN_IF_FALSE as NS_WARNING_ASSERTION. r=erahm. 2016-09-01 15:01:16 +10:00
nsTObserverArray.cpp
nsTObserverArray.h Bug 1287706 part 5 - Add RemoveElementsBy method to nsTArray and nsTObserverArray to allow filtering elements by predicate function. r=froydnj 2016-07-28 12:00:06 +10:00
nsTPriorityQueue.h
nsTWeakRef.h
nsVersionComparator.cpp
nsVersionComparator.h
nsWeakReference.cpp Bug 956338 - Add checks to WeakPtr/nsWeakReference and related classes to assert single-thread usage. r=nfroyd 2016-08-01 13:16:16 +02:00
nsWeakReference.h Bug 956338 - Add checks to WeakPtr/nsWeakReference and related classes to assert single-thread usage. r=nfroyd 2016-08-01 13:16:16 +02:00
nsXPTCUtils.h
objs.mozbuild Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
Observer.h
PLDHashTable.cpp Bug 1295197 - use non-null-checked operator new in xpcom/; r=erahm 2016-08-22 18:40:10 -04:00
PLDHashTable.h Bug 1277775 - Replace MOZ_CONSTEXPR{_VAR,_TMPL} with constexpr. r=froydnj 2016-07-08 14:39:53 -07:00
ReentrantMonitor.h