Closed
Bug 827032
Opened 13 years ago
Closed 13 years ago
Enable FAIL_ON_WARNINGS on MSVC in netwerk/
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: emk, Assigned: emk)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
28.13 KB,
patch
|
jduell.mcbugs
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #698306 -
Flags: review?(jduell.mcbugs)
Assignee | ||
Updated•13 years ago
|
Blocks: buildwarning
Assignee | ||
Comment 1•13 years ago
|
||
Comment on attachment 698306 [details] [diff] [review]
patch
Sorry, this patch caused a link error.
Attachment #698306 -
Attachment is obsolete: true
Attachment #698306 -
Flags: review?(jduell.mcbugs)
Assignee | ||
Comment 2•13 years ago
|
||
Added explicit template instantiation.
Attachment #698385 -
Flags: review?(jduell.mcbugs)
Assignee | ||
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
Comment on attachment 698385 [details] [diff] [review]
patch v2
Review of attachment 698385 [details] [diff] [review]:
-----------------------------------------------------------------
This is more of a quick drive-by than a formal review for now, but I've got some questions.
::: netwerk/base/src/DashboardTypes.h
@@ +21,5 @@
> struct DNSCacheEntries
> {
> nsCString hostname;
> nsTArray<nsCString> hostaddr;
> + uint16_t family;
Why do we need to move from 8 bit to 16 here?
::: netwerk/base/src/nsSocketTransport2.cpp
@@ +695,5 @@
> , mFD(nullptr)
> , mFDref(0)
> , mFDconnected(false)
> + , mInput(This())
> + , mOutput(This())
What's the warning here? Seems very weird we need a method to return 'this' instead of just passing it.
::: netwerk/protocol/http/SpdySession3.cpp
@@ +495,5 @@
> mInputFrameDataStream = nullptr;
> }
>
> +template<typename T> void
> +SpdySession3::EnsureBuffer(nsAutoArrayPtr<T> &buf,
What's the issue with ensureBuffer that needs to be fixed? I.e. what's the warning here?
::: netwerk/protocol/http/SpdyStream3.cpp
@@ +64,5 @@
>
> LOG3(("SpdyStream3::SpdyStream3 %p", this));
>
> mRemoteWindow = spdySession->GetServerInitialWindow();
> + mTxInlineFrame = new uint8_t[mTxInlineFrameSize];
I'll want :mcmanus to look over this change. Maybe make a patch that splits out the SPDY stuff and assign him that review.
::: netwerk/protocol/http/nsHttpAuthCache.cpp
@@ +53,2 @@
> {
> + mObserver = new AppDataClearObserver(this);
I guess this is the same weird issue with msvc not liking constructors in construction lists?
Attachment #698385 -
Flags: review?(jduell.mcbugs) → feedback+
Assignee | ||
Comment 5•13 years ago
|
||
(In reply to Jason Duell (:jduell) from comment #4)
> ::: netwerk/base/src/DashboardTypes.h
> @@ +21,5 @@
> > struct DNSCacheEntries
> > {
> > nsCString hostname;
> > nsTArray<nsCString> hostaddr;
> > + uint16_t family;
>
> Why do we need to move from 8 bit to 16 here?
Because nsHostRecord (and every other places in the tree) defines address family as uint_16. MSVC complains about the discrepancy when compiling CacheEntryEnumerator in nsHostResolver.cpp.
This change doesn't increase the structure size because DNSCacheEntries has very inefficient layout :)
> ::: netwerk/base/src/nsSocketTransport2.cpp
> @@ +695,5 @@
> > , mFD(nullptr)
> > , mFDref(0)
> > , mFDconnected(false)
> > + , mInput(This())
> > + , mOutput(This())
>
> What's the warning here? Seems very weird we need a method to return 'this'
> instead of just passing it.
MSVC warns C4355 if "this" pointer is used in the initializer list.
http://msdn.microsoft.com/en-us/library/3c594ae3%28v=vs.80%29.aspx
Another workaround is #pragma's written in bug 826959.
> ::: netwerk/protocol/http/SpdySession3.cpp
> @@ +495,5 @@
> > mInputFrameDataStream = nullptr;
> > }
> >
> > +template<typename T> void
> > +SpdySession3::EnsureBuffer(nsAutoArrayPtr<T> &buf,
>
> What's the issue with ensureBuffer that needs to be fixed? I.e. what's the
> warning here?
MSVC warns at the following line in SpdyStream3::ParseHttpRequestHeaders if mTxInlineFrame is the array of (signed) char:
> mTxInlineFrame[16] = 7 << 5;
Indeed 7 << 5 (= 0xF0) is out of the range of (signed) char.
I couldn't suppress the warning using the cast such as:
mTxInlineFrame[16] = static_cast<char>(7 << 5);
> ::: netwerk/protocol/http/SpdyStream3.cpp
> @@ +64,5 @@
> >
> > LOG3(("SpdyStream3::SpdyStream3 %p", this));
> >
> > mRemoteWindow = spdySession->GetServerInitialWindow();
> > + mTxInlineFrame = new uint8_t[mTxInlineFrameSize];
>
> I'll want :mcmanus to look over this change. Maybe make a patch that splits
> out the SPDY stuff and assign him that review.
If I could somehow suppress the above warning, SPDY changes would not be needed.
> ::: netwerk/protocol/http/nsHttpAuthCache.cpp
> @@ +53,2 @@
> > {
> > + mObserver = new AppDataClearObserver(this);
>
> I guess this is the same weird issue with msvc not liking constructors in
> construction lists?
Yes. the difference is mObserver had a default constructor, so I could move the initialization in the function body.
Comment 6•13 years ago
|
||
> Because nsHostRecord (and every other places in the tree) defines address
> family as uint_16
OK, fine.
> MSVC warns C4355 if "this" pointer is used in the initializer list.
We should simply disable this warning. Ideally we should do it for all of Mozilla, using a compiler flag (sounds like '/ignore:4355' might do it). I suggest we open a separate bug just for that--I'm not sure who to ask for review on msvc compiler flag changes (ask on #developers). If for some reason that doesn't get accepted (it ought to: apparently the msvc team is disabling this warning anyway for newer vc++ versions: see http://connect.microsoft.com/VisualStudio/feedback/details/718050 ), then let's use this pragma in each file instead of a This() method:
#pragma warning(disable : 4355)
> MSVC warns at the following line in SpdyStream3::ParseHttpRequestHeaders...
> Indeed 7 << 5 (= 0xF0) is out of the range of (signed) char.
Sounds like we should run this by :mcmanus then--might be a bug.
Assignee | ||
Comment 7•13 years ago
|
||
(In reply to Jason Duell (:jduell) from comment #6)
> We should simply disable this warning. Ideally we should do it for all of
> Mozilla, using a compiler flag (sounds like '/ignore:4355' might do it). I
> suggest we open a separate bug just for that--I'm not sure who to ask for
> review on msvc compiler flag changes (ask on #developers). If for some
> reason that doesn't get accepted (it ought to: apparently the msvc team is
> disabling this warning anyway for newer vc++ versions: see
> http://connect.microsoft.com/VisualStudio/feedback/details/718050 ), then
> let's use this pragma in each file instead of a This() method:
>
> #pragma warning(disable : 4355)
OK, I have repurposed bug 826959.
Comment 8•13 years ago
|
||
(In reply to Jason Duell (:jduell) from comment #6)
> > MSVC warns C4355 if "this" pointer is used in the initializer list.
>
> We should simply disable this warning.
I still think this is a useful warning. And, it is easy to work around when it is spurious:
#include "base/compiler_specific.h"
[...]
Whatever::Whatever()
: ALLOW_THIS_IN_INITIALIZER_LIST(this)
{
}
> #pragma warning(disable : 4355)
Please use the ALLOW_THIS_IN_INITIALIZER_LIST macro instead of the pragma, as it is more self-documenting.
> > MSVC warns at the following line in SpdyStream3::ParseHttpRequestHeaders...
> > Indeed 7 << 5 (= 0xF0) is out of the range of (signed) char.
>
> Sounds like we should run this by :mcmanus then--might be a bug.
Yep. Please file a bug.
Assignee | ||
Comment 9•13 years ago
|
||
(In reply to Brian Smith (:bsmith) from comment #8)
> (In reply to Jason Duell (:jduell) from comment #6)
> > Sounds like we should run this by :mcmanus then--might be a bug.
>
> Yep. Please file a bug.
Filed bug 827824.
Assignee | ||
Comment 10•13 years ago
|
||
(In reply to Brian Smith (:bsmith) from comment #8)
> #include "base/compiler_specific.h"
> [...]
> Whatever::Whatever()
> : ALLOW_THIS_IN_INITIALIZER_LIST(this)
> {
> }
>
> > #pragma warning(disable : 4355)
>
> Please use the ALLOW_THIS_IN_INITIALIZER_LIST macro instead of the pragma,
> as it is more self-documenting.
How do I define ALLOW_THIS_IN_INITIALIZER_LIST()?
#define ALLOW_THIS_IN_INITIALIZER_LIST(...) \
#pragma warning(push) \
#pragma warning(disable : 4355) \
... \
#pragma warning(pop)
is not possible.
Comment 11•13 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #10)
> (In reply to Brian Smith (:bsmith) from comment #8)
> > #include "base/compiler_specific.h"
> > [...]
> > Whatever::Whatever()
> > : ALLOW_THIS_IN_INITIALIZER_LIST(this)
> > {
> > }
> >
> > > #pragma warning(disable : 4355)
> >
> > Please use the ALLOW_THIS_IN_INITIALIZER_LIST macro instead of the pragma,
> > as it is more self-documenting.
>
> How do I define ALLOW_THIS_IN_INITIALIZER_LIST()?
just #include "base/compiler_specific.h" like in my example. (This macro actually come from Chromium. We should probably put a copy in MFBT.)
Comment 12•13 years ago
|
||
> Please use the ALLOW_THIS_IN_INITIALIZER_LIST macro instead of the pragma
OK, I'm fine with that as a workaround should bug 826959 get shot down.
Comment 13•13 years ago
|
||
Actually go ahead and use ALLOW_THIS_IN_INITIALIZER_LIST so we can get this landed, and bug 826959 can remove all uses of it in the tree if we go that route.
No longer depends on: 826959
Assignee | ||
Comment 14•13 years ago
|
||
(In reply to Brian Smith (:bsmith) from comment #11)
> just #include "base/compiler_specific.h" like in my example. (This macro
> actually come from Chromium. We should probably put a copy in MFBT.)
Oh, I'd never thought "base/compiler_specific.h" would be the real header name. Thanks.
Assignee | ||
Comment 15•13 years ago
|
||
Attachment #698385 -
Attachment is obsolete: true
Attachment #699260 -
Flags: review?(jduell.mcbugs)
Assignee | ||
Comment 16•13 years ago
|
||
Comment 17•13 years ago
|
||
Congrats on top 3!
http://people.mozilla.org/~catlee/highscores/highscores.html
(Bug 829932)
Comment 18•13 years ago
|
||
:-)
Comment 19•13 years ago
|
||
Comment on attachment 699260 [details] [diff] [review]
patch v3
Review of attachment 699260 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks Masatoshi!
Attachment #699260 -
Flags: review?(jduell.mcbugs) → review+
Assignee | ||
Comment 20•13 years ago
|
||
Flags: in-testsuite-
Comment 21•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in
before you can comment on or make changes to this bug.
Description
•