Closed
Bug 659546
Opened 14 years ago
Closed 14 years ago
clang warns about alignment requirement increase in nsID::Equals after bug 164580
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla7
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
Details
Attachments
(1 file)
1.06 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
../../../../dist/include/nsID.h:77:8: warning: cast from 'const PRUint32 *' (aka 'const unsigned int *') to 'PRUint64 *' (aka 'unsigned long long *') increases required alignment from 4 to 8 [-Wcast-align] ((PRUint64*) &m0)[0] == ((PRUint64*) &other.m0)[0] && ^~~~~~~~~~~~~~~ ../../../../dist/include/nsID.h:77:32: warning: cast from 'const PRUint32 *' (aka 'const unsigned int *') to 'PRUint64 *' (aka 'unsigned long long *') increases required alignment from 4 to 8 [-Wcast-align] ((PRUint64*) &m0)[0] == ((PRUint64*) &other.m0)[0] && ^~~~~~~~~~~~~~~~~~~~~ ../../../../dist/include/nsID.h:78:8: warning: cast from 'const PRUint32 *' (aka 'const unsigned int *') to 'PRUint64 *' (aka 'unsigned long long *') increases required alignment from 4 to 8 [-Wcast-align] ((PRUint64*) &m0)[1] == ((PRUint64*) &other.m0)[1]; ^~~~~~~~~~~~~~~ ../../../../dist/include/nsID.h:78:32: warning: cast from 'const PRUint32 *' (aka 'const unsigned int *') to 'PRUint64 *' (aka 'unsigned long long *') increases required alignment from 4 to 8 [-Wcast-align] ((PRUint64*) &m0)[1] == ((PRUint64*) &other.m0)[1]; ^~~~~~~~~~~~~~~~~~~~~ We're basically relying on the correct knowledge of alignment requirements here, so we'd better silence the compiler.
Assignee | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Wow, those are really pretty compile errors. I like the aka's on the typedefs. Man.
(In reply to comment #2) > Wow, those are really pretty compile errors. I like the aka's on the > typedefs. Man. Reason #73 why clang is eventually going to kill off gcc.
Comment 4•14 years ago
|
||
Do we know that nsID is actually 64-bit aligned? Given that none of the members require 64-bit alignment, I'm not sure that the struct is actually always going to be 64-bit aligned.
Comment 5•14 years ago
|
||
It would probably be worth forcing 64-bit alignment, if only to be safe. Do we have any macros wrapping the compiler directives for this? I can't seem to find them.
Assignee | ||
Comment 6•14 years ago
|
||
One possible way to force 64-bit alignment that I know of is to wrap its members into two unions, each with a 64-bit member. But that would break the POD-ness of the type... :(
Comment 7•14 years ago
|
||
See bug 660335 for forcing alignment of nsID.
Updated•14 years ago
|
Attachment #534972 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 8•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/15bfb9729ff3
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
You need to log in
before you can comment on or make changes to this bug.
Description
•