Closed Bug 1392641 Opened 4 years ago Closed 4 years ago

netwerk/ ignores return values from a functions declared with warn_unused_result

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: tjr, Assigned: tjr)

References

(Blocks 1 open bug)

Details

(Whiteboard: [tor][necko-active])

Attachments

(1 file)

/home/worker/workspace/build/src/netwerk/base/BackgroundFileSaver.cpp:911:40: error: ignoring return value of function declared with attribute warn_unused_result [-Werror=unused-result]
             nssCertList->AddCert(nssCert);
Summary: BackgroundFileSaver.cpp ignores a return value from a function declared with warn_unused_result → netwerk/ ignores return values from a functions declared with warn_unused_result
Whiteboard: [tor] → [tor][necko-active]
Comment on attachment 8899874 [details]
Bug 1392641 Check return value for functions declared with warn_unused_result

https://reviewboard.mozilla.org/r/171208/#review177904

::: netwerk/system/win32/nsNotifyAddrListener.cpp:217
(Diff revision 2)
>                      sha1.update(combined.get(), combined.Length());
>                      uint8_t digest[SHA1Sum::kHashSize];
>                      sha1.finish(digest);
>                      nsCString newString(reinterpret_cast<char*>(digest),
>                                          SHA1Sum::kHashSize);
> -                    Base64Encode(newString, output);
> +                    rv = Base64Encode(newString, output);

I think you should move the 'rv' declaration to happen just before this (only) use of it. We tend to try to keep the declarations close to the users.
Attachment #8899874 - Flags: review?(daniel) → review+
Comment on attachment 8899874 [details]
Bug 1392641 Check return value for functions declared with warn_unused_result

https://reviewboard.mozilla.org/r/171208/#review177906

Just one minor comment.
Comment on attachment 8899874 [details]
Bug 1392641 Check return value for functions declared with warn_unused_result

https://reviewboard.mozilla.org/r/171208/#review178170

::: netwerk/system/win32/nsNotifyAddrListener.cpp:217
(Diff revision 3)
>                      uint8_t digest[SHA1Sum::kHashSize];
>                      sha1.finish(digest);
>                      nsCString newString(reinterpret_cast<char*>(digest),
>                                          SHA1Sum::kHashSize);
> -                    Base64Encode(newString, output);
> +                    nsresult rv;
> +                    rv = Base64Encode(newString, output);

(nit): nsresult rv = Base64Encode...
Comment on attachment 8899874 [details]
Bug 1392641 Check return value for functions declared with warn_unused_result

https://reviewboard.mozilla.org/r/171208/#review178174
Attachment #8899874 - Flags: review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/56ae3de7d69c
Check return value for functions declared with warn_unused_result r=bagder,nwgh
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/56ae3de7d69c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.