nsFeedSniffer.cpp: error: ignoring return value of function declared with attribute warn_unused_result

RESOLVED FIXED in seamonkey2.52

Status

SeaMonkey
Build Config
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: ewong, Assigned: ewong)

Tracking

unspecified
seamonkey2.52

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

a year ago
current trunk bustage:

/usr/bin/ccache /builds/slave/c-cen-t-lnx/build/gcc/bin/g++ -m32 -march=pentium-m -std=gnu++11 -o nsFeedSniffer.o -c -I/builds/slave/c-cen-t-lnx/build/objdir/dist/stl_wrappers -I/builds/slave/c-cen-t-lnx/build/objdir/dist/system_wrappers -include /builds/slave/c-cen-t-lnx/build/mozilla/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/builds/slave/c-cen-t-lnx/build/suite/feeds/src -I/builds/slave/c-cen-t-lnx/build/objdir/suite/feeds/src  -I/builds/slave/c-cen-t-lnx/build/objdir/dist/include  -I/builds/slave/c-cen-t-lnx/build/objdir/dist/include/nspr -I/builds/slave/c-cen-t-lnx/build/objdir/dist/include/nss       -fPIC  -DMOZILLA_CLIENT -include /builds/slave/c-cen-t-lnx/build/objdir/mozilla-config.h -MD -MP -MF .deps/nsFeedSniffer.o.pp  -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -msse -msse2 -mfpmath=sse -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -D_GLIBCXX_USE_CXX11_ABI=0 -pipe  -g -freorder-blocks -Os -fno-omit-frame-pointer  -Werror   /builds/slave/c-cen-t-lnx/build/suite/feeds/src/nsFeedSniffer.cpp
/builds/slave/c-cen-t-lnx/build/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../x86_64-unknown-linux-gnu/bin/as: /lib64/libz.so.1: no version information available (required by /builds/slave/c-cen-t-lnx/build/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.4/../../../../x86_64-unknown-linux-gnu/bin/as)
../../../../suite/feeds/src/nsFeedSniffer.cpp: In member function 'nsresult nsFeedSniffer::ConvertEncodedData(nsIRequest*, const uint8_t*, uint32_t)':
../../../../suite/feeds/src/nsFeedSniffer.cpp:58:50: error: ignoring return value of function declared with attribute warn_unused_result [-Werror=unused-result]
                                  contentEncoding);
                                                  ^
../../../../suite/feeds/src/nsFeedSniffer.cpp: In member function 'virtual nsresult nsFeedSniffer::GetMIMETypeFromContent(nsIRequest*, const uint8_t*, uint32_t, nsACString_internal&)':
../../../../suite/feeds/src/nsFeedSniffer.cpp:209:36: error: ignoring return value of function declared with attribute warn_unused_result [-Werror=unused-result]
   channel->GetRequestMethod(method);
                                    ^
../../../../suite/feeds/src/nsFeedSniffer.cpp:262:102: error: ignoring return value of function declared with attribute warn_unused_result [-Werror=unused-result]
                                NS_LITERAL_CSTRING("1"), false);
                                                                                                      ^
cc1plus: all warnings being treated as errors
make[4]: *** [nsFeedSniffer.o] Error 1
make[4]: Leaving directory `/builds/slave/c-cen-t-lnx/build/objdir/suite/feeds/src'
make[3]: *** [suite/feeds/src/target] Error 2
(Assignee)

Updated

a year ago
Version: SeaMonkey 2.48 Branch → unspecified
(Assignee)

Updated

a year ago
Summary: nsFeedSniffer.cpp: error: error: ignoring return value of function declared with attribute warn_unused_result → nsFeedSniffer.cpp: error: ignoring return value of function declared with attribute warn_unused_result
(Assignee)

Comment 1

a year ago
Created attachment 8844775 [details] [diff] [review]
proposed patch (v1)
Attachment #8844775 - Flags: review?(iann_bugzilla)
(Assignee)

Updated

a year ago
Assignee: nobody → ewong
Status: NEW → ASSIGNED

Comment 2

a year ago
Comment on attachment 8844775 [details] [diff] [review]
proposed patch (v1)


>+++ b/suite/feeds/src/nsFeedSniffer.cpp
>@@ -49,17 +49,18 @@ nsFeedSniffer::ConvertEncodedData(nsIReq
>   nsresult rv = NS_OK;
> 
>  mDecodedData = "";
>  nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request));
>   if (!httpChannel)
>     return NS_ERROR_NO_INTERFACE;
> 
>   nsAutoCString contentEncoding;
>-  httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
>+  nsresult rv;
Isn't rv already defined, should we be using another variable?

>+  rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
>                                  contentEncoding);
Nit: indent this line correctly too.


>@@ -201,17 +202,18 @@ nsFeedSniffer::GetMIMETypeFromContent(ns
>                                       nsACString& sniffedType)
> {
>   nsCOMPtr<nsIHttpChannel> channel(do_QueryInterface(request));
>   if (!channel)
>     return NS_ERROR_NO_INTERFACE;
> 
>   // Check that this is a GET request, since you can't subscribe to a POST...
>   nsAutoCString method;
>-  channel->GetRequestMethod(method);
>+  nsresult rv;
>+  rv = channel->GetRequestMethod(method);
rv is defined later in this method, so that will need removing?


>@@ -253,18 +255,19 @@ nsFeedSniffer::GetMIMETypeFromContent(ns
>     // check for an attachment after we have a likely feed.
>     if(HasAttachmentDisposition(channel)) {
>       sniffedType.Truncate();
>       return NS_OK;
>     }
> 
>     // set the feed header as a response header, since we have good metadata
>     // telling us that the feed is supposed to be RSS or Atom
>-    channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"),
>-                               NS_LITERAL_CSTRING("1"), false);
>+    nsresult rv;
>+    rv = channel->SetResponseHeader(NS_LITERAL_CSTRING("X-Moz-Is-Feed"),
>+                                    NS_LITERAL_CSTRING("1"), false);
You have already defined rv earlier in the method...

r=me with those addressed.
Attachment #8844775 - Flags: review?(iann_bugzilla) → review+
(Assignee)

Comment 3

a year ago
(In reply to Ian Neal from comment #2)
> Comment on attachment 8844775 [details] [diff] [review]
> proposed patch (v1)
> 
> 
> >+++ b/suite/feeds/src/nsFeedSniffer.cpp
> >@@ -49,17 +49,18 @@ nsFeedSniffer::ConvertEncodedData(nsIReq
> >   nsresult rv = NS_OK;
> > 
> >  mDecodedData = "";
> >  nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request));
> >   if (!httpChannel)
> >     return NS_ERROR_NO_INTERFACE;
> > 
> >   nsAutoCString contentEncoding;
> >-  httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
> >+  nsresult rv;
> Isn't rv already defined, should we be using another variable?

Having looked at the code, I'm sure we can use rv, since it's used
later on in line 66.

Does it make sense to do this:

  rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),
                                      contentEncoding);
  NS_ENSURE_SUCCESS(rv, rv);
(Assignee)

Comment 4

a year ago
Also, do we need something like (@ line 211):

  nsresult rv;
  rv = channel->GetRequestMethod(method);
(Assignee)

Comment 6

a year ago
Created attachment 8845267 [details] [diff] [review]
updated proposed patch (v2)
Attachment #8844775 - Attachment is obsolete: true
Attachment #8845267 - Flags: review?(iann_bugzilla)

Updated

a year ago
Attachment #8845267 - Flags: review?(iann_bugzilla) → review+
(Assignee)

Updated

a year ago
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.52
You need to log in before you can comment on or make changes to this bug.