Closed Bug 1483818 Opened Last year Closed Last year

dom\base\AttrArray.h(214): warning C4200: nonstandard extension used: zero-sized array in struct/union - dom\base\AttrArray.h(214): note: This member will be ignored by a defaulted constructor or copy/move assignment operator

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: jorgk-bmo, Assigned: emilio)

References

(Depends on 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #1482866 +++

 1:42.90 c:\mozilla-source\comm-central\dom\base\AttrArray.h(214): error C2220: warning treated as error - no 'object' file generated
 1:42.90 c:\mozilla-source\comm-central\dom\base\AttrArray.h(214): warning C4200: nonstandard extension used: zero-sized array in struct/union
 1:42.90 c:\mozilla-source\comm-central\dom\base\AttrArray.h(214): note: This member will be ignored by a defaulted constructor or copy/move assignment operator
I filed bug 1483820 since that has become a general problem. This is the third case.
I think that warning should be just suppressed. I could make it a 1-size array, as it used to be, but I'm not sure that's fine either...

Does this work Jorg? Though this is quite ugly, not sure where the global suppressions live.
Attachment #9001570 - Flags: feedback?(jorgk)
Other compilers don't warn about it, and it's a somewhat common technique.
Attachment #9001572 - Flags: feedback?(jorgk)
(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)
> Created attachment 9001572 [details] [diff] [review]
> Disable zero-size array warning globally in MSVC.
> 
> Other compilers don't warn about it, and it's a somewhat common technique.

I'd prefer this one, should it work and should a build peer be fine with it :).
Comment on attachment 9001570 [details] [diff] [review]
Disable warning about zero-size array in AttrArray::Impl

Works.
Attachment #9001570 - Flags: feedback?(jorgk) → feedback+
Comment on attachment 9001572 [details] [diff] [review]
Disable zero-size array warning globally in MSVC.

Works, too, but triggered a complete recompile :-(
Attachment #9001572 - Flags: feedback?(jorgk) → feedback+
Attachment #9001572 - Flags: review?(core-build-config-reviews)
(In reply to Jorg K (GMT+2) from comment #7)
> Comment on attachment 9001572 [details] [diff] [review]
> Disable zero-size array warning globally in MSVC.
> 
> Works, too, but triggered a complete recompile :-(

Thanks!
Comment on attachment 9001572 [details] [diff] [review]
Disable zero-size array warning globally in MSVC.

Sorry, spoke too early, after six minutes I got this:

 5:56.37 DataChannel.cpp
 5:56.37 c:\mozilla-source\comm-central\obj-x86_64-pc-mingw32\dist\include\AttrArray.h(214): error C2220: warning treated as error - no 'object' file generated
 5:56.37 c:\mozilla-source\comm-central\obj-x86_64-pc-mingw32\dist\include\AttrArray.h(214): warning C4200: nonstandard extension used: zero-sized array in struct/union
 5:56.37 c:\mozilla-source\comm-central\obj-x86_64-pc-mingw32\dist\include\AttrArray.h(214): note: This member will be ignored by a defaulted constructor or copy/move assignment operator
 5:56.38 mozmake[4]: *** [c:/mozilla-source/comm-central/config/rules.mk:1090: DataChannel.obj] Error 2
Attachment #9001572 - Flags: review?(core-build-config-reviews)
Attachment #9001572 - Flags: feedback-
Attachment #9001572 - Flags: feedback+
Emilio, can you please move this forward so people using MSVS C++ don't have to work with a band-aid.
 (In reply to Jorg K (GMT+2) from comment #10)
> Emilio, can you please move this forward so people using MSVS C++ don't have
> to work with a band-aid.

Yeah, sorry. I'd really prefer if we could globally disable the warning, but I guess the first patch should be enough for now.
Comment on attachment 9001570 [details] [diff] [review]
Disable warning about zero-size array in AttrArray::Impl

Impl is not trivially copiable, movable or copy-constructible, so the warning is pointless.

Fix the build for now. I'll try to disable the MSVC warning globally in a followup bug and this patch can be reverted then.
Attachment #9001570 - Flags: review?(bugs)
Attachment #9001572 - Attachment is obsolete: true
Comment on attachment 9001570 [details] [diff] [review]
Disable warning about zero-size array in AttrArray::Impl

Looks like we use similar stuff elsewhere too.
Attachment #9001570 - Flags: review?(bugs) → review+
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1d4014247f20
Disable MSVC warning C4200 about zero-size arrays in AttrArray::Impl. r=smaug
https://hg.mozilla.org/mozilla-central/rev/1d4014247f20
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Duplicate of this bug: 1483981
Assignee: nobody → emilio

We should remove this workaround because we do not support MSVC anymore.

You need to log in before you can comment on or make changes to this bug.