Closed Bug 1447849 Opened 6 years ago Closed 6 years ago

Eliminate the anonymous union from XPTTypeDescriptor

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

For bug 1438688, I need to statically initialize all of the data types in xpt_struct.h. It turns out that the approach I was using for unions is C99 and not C++. While for some reason Clang and GCC are okay with that, MSVC is not.

One of the unions is a gnarly anonymous union in XPTTypeDescriptor. However, every arm of this union is either 1 or 2 uint8_t, so I think it is reasonable to eliminate the union and replace it with two fields, mData1 and mData2. I've fixed up the places that read this data to use accessor methods with nice asserts about the tag on the variant, so if anything I think that part is nicer.

The code in xpt_struct.cpp that writes to this data is maybe less nice, but I'm deleting it in bug 1438688 so I think that's okay. We also lose some detail in the comments about the relationship between what is stored in memory compared to what is stored on disk, but I think that's okay, too.
Comment on attachment 8961250 [details]
Bug 1447849 - Eliminate the anonymous union from XPTTypeDescriptor.

https://reviewboard.mozilla.org/r/230026/#review235736

Fair enough.
Attachment #8961250 - Flags: review?(n.nethercote) → review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d1e7d52a4765
Eliminate the anonymous union from XPTTypeDescriptor. r=njn
https://hg.mozilla.org/mozilla-central/rev/d1e7d52a4765
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: