Use MOZ_STATIC_ASSERT and fix typo in "need to rearrange the mBits bitfield" compile-time error-check

RESOLVED FIXED in mozilla22

Status

()

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
mozilla22
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
nsLineBox.h currently has the following code:
149 #if NS_STYLE_CLEAR_LAST_VALUE > 15
150 need to rearrange the mBits bitfield;
151 #endif
https://mxr.mozilla.org/mozilla-central/source/layout/generic/nsLineBox.h#149

which apparently is intended to break the build if NS_STYLE_CLEAR_LAST_VALUE is larger than 15 (larger than what we can represent with 4 bits).

There is, however, no "mBits bitfield" (and never was).  We mean to say "mFlags", which is of type FlagBits (and which contains the 4 bits to store our "clear" value).  And while we're fixing that, we might as well make this a MOZ_STATIC_ASSERT.
(Assignee)

Comment 1

6 years ago
(In reply to Daniel Holbert [:dholbert] from comment #0)
> There is, however, no "mBits bitfield" (and never was).

(for reference: the CVS commit that added this line was:
 http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&root=/cvsroot&subdir=mozilla/layout/generic&command=DIFF_FRAMESET&file=nsLineBox.h&rev2=1.20&rev1=1.19
and even at that point, the bitfield in question was FlagBits mFlags -- there was no no mBits.)
(Assignee)

Updated

6 years ago
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
(Assignee)

Comment 2

6 years ago
Created attachment 730901 [details] [diff] [review]
fix

This moves the check to be a static assert in the nsLineBox constructor. (This is a sensible location for the assertion, since we're asserting about a member-var of nsLineBox)
Attachment #730901 - Flags: review?(matspal)
Comment on attachment 730901 [details] [diff] [review]
fix

r=mats
Attachment #730901 - Flags: review?(matspal) → review+
(Assignee)

Comment 4

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/ccf927340e8e
Flags: in-testsuite-
OS: Linux → All
Hardware: x86_64 → All
https://hg.mozilla.org/mozilla-central/rev/ccf927340e8e
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.