Closed
Bug 1441677
Opened 7 years ago
Closed 7 years ago
Modernize xpt_struct.h
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(7 files, 1 obsolete file)
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
n.nethercote
:
review+
|
Details |
(deleted),
patch
|
Details | Diff | Splinter Review |
I'm going to make a bunch of changes to xpt_struct.h in bug 1438688, so I think it makes sense to go through and do some clean ups before that.
This includes a few things:
- Cleaning up whitespace: making the file 2-space indented, getting rid of the extra space that tries to line up member names, and moving the * next to the type instead of the field name.
- Moving things out of the file that aren't used there to where they are used: an include of xpt_arena.h, various macros that are only used for loading a file.
- Removing things that aren't used at all: various macros, and the minor_version field of XPTHeader.
- There's a ton of macros related to bit flags that I have turned into constants and functions. Most access of these flags goes through the helper classes in xptinfo.h, so this doesn't require too many changes.
I have deliberately not spent any time cleaning up xpt_arena.h, xpt_arena.cpp, xpt_xdr.h, xpt_xdr.cpp, and xpt_struct.cpp because if bug 1438688 works out those files can get deleted entirely. Hopefully that's not too weird.
I decided to not change the member names to the mFoo form, because it doesn't bother me all that much and there are a lot of fields.
Combined, this makes the file about 60 lines shorter.
(In reply to Andrew McCreight [:mccr8] from comment #0)
> - Cleaning up whitespace: making the file 2-space indented, getting rid of
> the extra space that tries to line up member names, and moving the * next to
> the type instead of the field name.
Suggestion: Why not just run `mach clang-format`?
Assignee | ||
Comment 2•7 years ago
|
||
(In reply to Gerald Squelart [:gerald] from comment #1)
> Suggestion: Why not just run `mach clang-format`?
I didn't know how to run clang format. The file's not that big so I just did it by hand.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 9•7 years ago
|
||
Assignee | ||
Comment 10•7 years ago
|
||
Attachment #8954562 -
Attachment is obsolete: true
Comment 11•7 years ago
|
||
> I didn't know how to run clang format. The file's not that big so I just did
> it by hand.
./mach clang-format -p path/to/files
Comment 12•7 years ago
|
||
mozreview-review |
Comment on attachment 8954553 [details]
Bug 1441677, part 1 - Fix spacing in xpt_struct.h.
https://reviewboard.mozilla.org/r/223594/#review229702
Attachment #8954553 -
Flags: review?(n.nethercote) → review+
Comment 13•7 years ago
|
||
mozreview-review |
Comment on attachment 8954554 [details]
Bug 1441677, part 2 - Move things only used in xpt_struct.cpp there.
https://reviewboard.mozilla.org/r/223596/#review229704
Attachment #8954554 -
Flags: review?(n.nethercote) → review+
Comment 14•7 years ago
|
||
mozreview-review |
Comment on attachment 8954555 [details]
Bug 1441677, part 3 - Use a function to get the tag of an XPT type.
https://reviewboard.mozilla.org/r/223598/#review229708
Attachment #8954555 -
Flags: review?(n.nethercote) → review+
Comment 15•7 years ago
|
||
mozreview-review |
Comment on attachment 8954556 [details]
Bug 1441677, part 4 - Use functions to check XPTInterfaceDescriptor::flags.
https://reviewboard.mozilla.org/r/223600/#review229716
Attachment #8954556 -
Flags: review?(n.nethercote) → review+
Comment 16•7 years ago
|
||
mozreview-review |
Comment on attachment 8954557 [details]
Bug 1441677, part 5 - Demacroize nsXPTMethodInfo masks.
https://reviewboard.mozilla.org/r/223602/#review229718
::: xpcom/reflect/xptinfo/xptinfo.h:184
(Diff revision 1)
> // NO DATA - this a flyweight wrapper
> public:
> MOZ_IMPLICIT nsXPTMethodInfo(const XPTMethodDescriptor& desc)
> {*(XPTMethodDescriptor*)this = desc;}
>
> - bool IsGetter() const {return 0 != (XPT_MD_IS_GETTER(flags) );}
> + bool IsGetter() const {return 0 != (flags & kGetterMask);}
Use `!!` instead of `0 !=` ?
Attachment #8954557 -
Flags: review?(n.nethercote) → review+
Comment 17•7 years ago
|
||
mozreview-review |
Comment on attachment 8954558 [details]
Bug 1441677, part 6 - Get rid of macros for nsXPTParamInfo flags.
https://reviewboard.mozilla.org/r/223604/#review229720
::: xpcom/reflect/xptinfo/xptinfo.h:126
(Diff revision 1)
> public:
> MOZ_IMPLICIT nsXPTParamInfo(const XPTParamDescriptor& desc)
> {*(XPTParamDescriptor*)this = desc;}
>
>
> - bool IsIn() const {return 0 != (XPT_PD_IS_IN(flags));}
> + bool IsIn() const {return 0 != (flags & kInMask);}
Again, use `!!` instead?
::: xpcom/reflect/xptinfo/xptinfo.h:148
(Diff revision 1)
> // converts it to an 'in', and sets the XPT_PD_DIPPER flag on it. For this
> // reason, dipper types are sometimes referred to as 'out parameters
> // masquerading as in'. The burden of maintaining this illusion falls mostly
> // on XPConnect, which creates the empty containers, and harvest the results
> // after the call.
> - bool IsDipper() const {return 0 != (XPT_PD_IS_DIPPER(flags));}
> + bool IsDipper() const {return 0 != (flags & kDipperMask);}
ditto
Attachment #8954558 -
Flags: review?(n.nethercote) → review+
Comment 18•7 years ago
|
||
Nice cleanups.
Assignee | ||
Comment 19•7 years ago
|
||
Sure, I'll use !! everywhere. I wasn't sure what was the right thing to do, so I just left it alone.
(In reply to Nicholas Nethercote [:njn] from comment #18)
> Nice cleanups.
Thanks. And thanks for the fast reviews.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 22•7 years ago
|
||
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fbe29e607536
part 1 - Fix spacing in xpt_struct.h. r=njn
https://hg.mozilla.org/integration/autoland/rev/61913a1d556e
part 2 - Move things only used in xpt_struct.cpp there. r=njn
https://hg.mozilla.org/integration/autoland/rev/5abfcbcd30d1
part 3 - Use a function to get the tag of an XPT type. r=njn
https://hg.mozilla.org/integration/autoland/rev/10ea4ebc9d54
part 4 - Use functions to check XPTInterfaceDescriptor::flags. r=njn
https://hg.mozilla.org/integration/autoland/rev/c35703f90f60
part 5 - Demacroize nsXPTMethodInfo masks. r=njn
https://hg.mozilla.org/integration/autoland/rev/ded8385fa298
part 6 - Get rid of macros for nsXPTParamInfo flags. r=njn
Comment 23•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fbe29e607536
https://hg.mozilla.org/mozilla-central/rev/61913a1d556e
https://hg.mozilla.org/mozilla-central/rev/5abfcbcd30d1
https://hg.mozilla.org/mozilla-central/rev/10ea4ebc9d54
https://hg.mozilla.org/mozilla-central/rev/c35703f90f60
https://hg.mozilla.org/mozilla-central/rev/ded8385fa298
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•