Closed
Bug 662971
Opened 14 years ago
Closed 14 years ago
Silence the clang warnings issued because of alignment requirements increase when compiling mfbt/Util.h
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla7
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
Details
(Whiteboard: [fixed-in-tracemonkey])
Attachments
(1 file)
1003 bytes,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
These warnings drive me nuts. We get thousands of them when compiling mfbt/Util.h.
jscompartment.cpp
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jscompartment.cpp:41:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jscntxt.h:48:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsprvtd.h:57:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jspubtd.h:47:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsval.h:48:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsutil.h:48:
./../../dist/include/mozilla/Util.h:220:24: warning: cast from 'char *' to 'js::HashMap<JSFunction *, JSString *, js::DefaultHasher<JSFunction *>, js::SystemAllocPolicy>
*' increases required alignment from 1 to 8 [-Wcast-align]
T *addr() { return (T *)u.bytes; }
^~~~~~~~~~~~
./../../dist/include/mozilla/Util.h:240:32: note: in instantiation of member function 'mozilla::AlignedStorage2<js::HashMap<JSFunction *, JSString *,
js::DefaultHasher<JSFunction *>, js::SystemAllocPolicy> >::addr' requested here
T &asT() { return *storage.addr(); }
^
./../../dist/include/mozilla/Util.h:247:33: note: in instantiation of member function 'mozilla::Maybe<js::HashMap<JSFunction *, JSString *, js::DefaultHasher<JSFunction
*>, js::SystemAllocPolicy> >::asT' requested here
~Maybe() { if (constructed) asT().~T(); }
^
/Users/ehsanakhgari/moz/tmp/js/src/jscompartment.cpp:66:16: note: in instantiation of member function 'mozilla::Maybe<js::HashMap<JSFunction *, JSString *,
js::DefaultHasher<JSFunction *>, js::SystemAllocPolicy> >::~Maybe' requested here
JSCompartment::JSCompartment(JSRuntime *rt)
^
Assignee | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Comment on attachment 538144 [details] [diff] [review]
Patch (v1)
Does reinterpret_cast<T *>(u.bytes) avoid the problem? Since that C++ cast is all "trust me, I know what I'm doing" I could imagine the warning might not happen for it. If r_c<> silences the warning, use that.
But that's probably wishful thinking; if it doesn't work, this patch is perfectly fine.
Attachment #538144 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 3•14 years ago
|
||
No, unfortunately simply using reinterpret_cast doesn't tell the compiler to ignore alignment requirements. It only bypasses the type system.
Assignee | ||
Comment 4•14 years ago
|
||
Whiteboard: [fixed-in-tracemonkey]
Target Milestone: --- → mozilla7
Comment 5•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/6408e5021891
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•