Closed Bug 1068175 Opened 11 years ago Closed 11 years ago

ActorsParent.cpp misuses NS_WARN_IF, triggering warnings for "warning: expression result unused [-Wunused-value]"

Categories

(Core :: Storage: IndexedDB, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

As shown in this Try log (with FAIL_ON_WARNINGS added back to dom/indexedDB)... https://tbpl.mozilla.org/php/getParsedLog.php?id=48212707&tree=Try#error0 ...ActorsParent.cpp misuses NS_WARN_IF (not checking its result), which triggers these build warnings: { /builds/slave/try-osx64_g-000000000000000000/build/dom/indexedDB/ActorsParent.cpp:11887:16: error: expression result unused [-Werror,-Wunused-value] NS_WARN_IF(!PBackgroundIDBFactoryRequestParent::Send__delete__(this, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../dist/include/nsDebug.h:48:38: note: expanded from macro 'NS_WARN_IF' #define NS_WARN_IF(condition) (bool)(condition) ^ /builds/slave/try-osx64_g-000000000000000000/build/dom/indexedDB/ActorsParent.cpp:12600:16: error: expression result unused [-Werror,-Wunused-value] NS_WARN_IF(!PBackgroundIDBFactoryRequestParent::Send__delete__(this, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../dist/include/nsDebug.h:48:38: note: expanded from macro 'NS_WARN_IF' #define NS_WARN_IF(condition) (bool)(condition) ^ /builds/slave/try-osx64_g-000000000000000000/build/dom/indexedDB/ActorsParent.cpp:13650:16: error: ignoring return value of function declared with const attribute [-Werror,-Wunused-value] NS_WARN_IF(NS_FAILED(mTransaction->RollbackSavepoint())); } Note that NS_WARN_IF is supposed to be used *inside* of an "if" statement -- not as a standalone statement on its own. I believe these statements really want to be capturing their result in a DebugOnly<> variable, and checking that variable with NS_WARN_IF_FALSE() (which is completely different from NS_WARN_IF. Yes, the naming is confusing.)
Flags: needinfo?(bent.mozilla)
Depends on: 1068177
No longer depends on: 1068177
Bug 994190 was backed out so this is WFM. I'll fix before relanding.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(bent.mozilla)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.