Closed
Bug 518881
Opened 15 years ago
Closed 15 years ago
IPDL-generated methods should be warn_unused_result
Categories
(Core :: IPC, enhancement)
Core
IPC
Tracking
()
RESOLVED
FIXED
People
(Reporter: cjones, Assigned: cjones)
References
Details
Attachments
(4 files, 1 obsolete file)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
../../dist/include\mozilla/unused.h(54) : error C2144: syntax error : 'int' should be preceded by ';
(deleted),
text/plain
|
Details |
Any invocation of them may fail, so client code should always check their return values.
Assignee | ||
Comment 2•15 years ago
|
||
List of offenders (on linux): /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:50: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:60: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing5()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:61: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing5()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:62: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing5()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:63: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing5()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestLatency.cpp:64: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestLatencyParent::SendPing5()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestRacyRPCReplies.cpp:59: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestRacyRPCRepliesParent::Send_A()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestRPCRaces.cpp:31: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestRPCRacesParent::SendStart()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/ipc/ipdl/test/cxx/TestShutdown.cpp:11: warning: ignoring return value of ‘bool mozilla::_ipdltest::PTestShutdownParent::SendStart()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/BrowserStreamParent.cpp:87: warning: ignoring return value of ‘bool mozilla::plugins::PBrowserStreamParent::SendNPP_DestroyStream(const NPReason&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/BrowserStreamParent.cpp:99: warning: ignoring return value of ‘static bool mozilla::plugins::PBrowserStreamParent::Send__delete__(mozilla::plugins::PBrowserStreamParent*)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/BrowserStreamParent.cpp:124: warning: ignoring return value of ‘bool mozilla::plugins::PBrowserStreamParent::SendWrite(const int32_t&, const mozilla::plugins::Buffer&, const uint32_t&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/BrowserStreamParent.cpp:137: warning: ignoring return value of ‘bool mozilla::plugins::PBrowserStreamParent::CallNPP_StreamAsFile(const nsCString&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginInstanceParent.cpp:421: warning: ignoring return value of ‘static bool mozilla::plugins::PStreamNotifyParent::Send__delete__(mozilla::plugins::PStreamNotifyParent*, const NPReason&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginInstanceParent.cpp:756: warning: ignoring return value of ‘static bool mozilla::plugins::PBrowserStreamParent::Send__delete__(mozilla::plugins::PBrowserStreamParent*)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginInstanceParent.cpp:783: warning: ignoring return value of ‘static bool mozilla::plugins::PPluginStreamParent::Call__delete__(mozilla::plugins::PPluginStreamParent*, const NPReason&, const bool&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginInstanceParent.cpp:877: warning: ignoring return value of ‘static bool mozilla::plugins::PStreamNotifyParent::Send__delete__(mozilla::plugins::PStreamNotifyParent*, const NPReason&)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginScriptableObjectParent.cpp:674: warning: ignoring return value of ‘static bool mozilla::plugins::PPluginScriptableObjectParent::Send__delete__(mozilla::plugins::PPluginScriptableObjectParent*)’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginScriptableObjectParent.cpp:694: warning: ignoring return value of ‘bool mozilla::plugins::PPluginScriptableObjectParent::SendUnprotect()’, declared with attribute warn_unused_result /home/cjones/mozilla/mozilla-central/dom/plugins/PluginModuleParent.cpp:394: warning: ignoring return value of ‘static bool mozilla::plugins::PPluginInstanceParent::Call__delete__(mozilla::plugins::PPluginInstanceParent*)’, declared with attribute warn_unused_result I'll fix these with followup patches.
Attachment #439450 -
Flags: review?(bent.mozilla)
Assignee | ||
Comment 3•15 years ago
|
||
Assignee | ||
Comment 4•15 years ago
|
||
Oops, I forgot that |(void) foo();| doesn't suppress the unused-result warning. This patch adds a |mozilla::unused()| escape hatch. Verified locally that it optimizes away.
Attachment #439450 -
Attachment is obsolete: true
Attachment #439462 -
Flags: review?(bent.mozilla)
Attachment #439450 -
Flags: review?(bent.mozilla)
Assignee | ||
Comment 5•15 years ago
|
||
bent, please feel free to steal if you wish.
Attachment #439463 -
Flags: review?(benjamin)
Assignee | ||
Comment 6•15 years ago
|
||
I should add that I kept the bool return value for child-side methods because I think I layer remoting might want them, in concert with the fatal-error-handling implementation I have in my head. It's easy to change this in the future if my use case doesn't come to fruition.
Comment 7•15 years ago
|
||
Comment on attachment 439463 [details] [diff] [review] Fix unused result warnings in dom/plugins This is ok, although I think the unused() function is ugly. Can we avoid the extra parens by using an operator?: unused << SendNPP_DestroyStream(reason);
Attachment #439463 -
Flags: review?(benjamin) → review+
Updated•15 years ago
|
Attachment #439462 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 8•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/bd3cfb73386c http://hg.mozilla.org/mozilla-central/rev/31901556ee90 http://hg.mozilla.org/mozilla-central/rev/5f91d6364706
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 10•15 years ago
|
||
I'm pretty sure that this: extern const unused_t unused NS_COM_GLUE; should be something like this: extern const unused_t NS_COM_GLUE unused; Note: I was surprised to find that attachment 439462 [details] [diff] [review] didn't have the unused.h/.cpp additions that got landed in http://hg.mozilla.org/mozilla-central/rev/bd3cfb73386c
Comment 12•15 years ago
|
||
(In reply to comment #10) > I'm pretty sure that this: > > extern const unused_t unused NS_COM_GLUE; > > should be something like this: > > extern const unused_t NS_COM_GLUE unused; > Yes, please change it, it failed to compile with Sun Studio.
Comment 13•15 years ago
|
||
After checking around on the other uses of NS_COM_GLUE, pushed a bustage fix: http://hg.mozilla.org/mozilla-central/rev/39544b4cb578
Updated•5 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•