Closed
Bug 889136
Opened 11 years ago
Closed 11 years ago
MSVC build warning: "usrsctp.h(241) : warning C4200: nonstandard extension used : zero-sized array in struct/union", and similar
Categories
(Core :: WebRTC, defect)
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
1.16 KB,
patch
|
jesup
:
review+
|
Details | Diff | Splinter Review |
Quoting a log from an attempt to mark netwerk/sctp/datachannel as FAIL_ON_WARNINGS:
{
DataChannel.cpp
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(241) : error C2220: warning treated as error - no 'object' file generated
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(241) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(350) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(400) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(615) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(626) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(695) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(700) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
e:\builds\moz2_slave\try-w32-0000000000000000000000\build\netwerk\sctp\src\usrsctp.h(765) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
}
https://tbpl.mozilla.org/php/getParsedLog.php?id=24802161&tree=Try
This is in a third-party library, so rather than trying to fix the code, it might be saner to just disable this warning for this chunk of code. (Fortunately, this is pretty easy in MSVC.)
Assignee | ||
Comment 1•11 years ago
|
||
This patch wraps datachannel's #include of (third-party header) usrsctp.h with "#pragma warning disable" for the warning in question.
See e.g. http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsINode.h?mark=310-314,327-330&rev=731a5fcf1328#310 for another place where we use this technique.
This suppresses the warning, and it lets us build on windows with FAIL_ON_WARNINGS in the datachannel directory as shown by this try push:
https://tbpl.mozilla.org/?tree=Try&rev=5fc593544f85
Assignee | ||
Comment 2•11 years ago
|
||
(first version had the commit message split into 2 lines; merged into 1 line here.)
Attachment #770064 -
Attachment is obsolete: true
Attachment #770064 -
Flags: review?(rjesup)
Attachment #770065 -
Flags: review?(rjesup)
Comment 3•11 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #1)
> See e.g.
> http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsINode.h?mark=310-314,327-330&rev=731a5fcf1328#310
> for another place where we use this technique.
As an aside, this should be replaced with MOZ_THIS_IN_INITIALIZER_LIST().
Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #3)
> (In reply to Daniel Holbert [:dholbert] from comment #1)
> > See e.g.
> > http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsINode.h?mark=310-314,327-330&rev=731a5fcf1328#310
> > for another place where we use this technique.
>
> As an aside, this should be replaced with MOZ_THIS_IN_INITIALIZER_LIST().
Sure. I was just linking to it to demonstrate the #pragma syntax for disabling MSVC warnings, but yes, that particular warning (4355) is frequent enough that we have a macro to handle it now. Feel free to file a separate bug on using the macro there. :)
Updated•11 years ago
|
Attachment #770065 -
Flags: review?(rjesup) → review+
Assignee | ||
Comment 5•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Flags: in-testsuite-
Comment 6•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•