Last Comment Bug 662969 - Silence the clang warnings issued because of alignment requirements increase when compiling jsparse.h
: Silence the clang warnings issued because of alignment requirements increase ...
Status: RESOLVED FIXED
[fixed-in-tracemonkey]
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla7
Assigned To: :Ehsan Akhgari
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-08 16:23 PDT by :Ehsan Akhgari
Modified: 2011-06-20 17:06 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (v1) (984 bytes, patch)
2011-06-08 16:24 PDT, :Ehsan Akhgari
jwalden+bmo: review+
Details | Diff | Splinter Review

Description :Ehsan Akhgari 2011-06-08 16:23:59 PDT
These warnings drive me nuts.  We get thousands of them when compiling jsparse.h.

In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsatom.cpp:58:
/Users/ehsanakhgari/moz/tmp/js/src/jsparse.h:654:16: warning: cast from 'char *' to 'JSParseNode *' increases required alignment from 1 to 8 [-Wcast-align]
        return (JSParseNode *)((char *)pn_tail - offsetof(JSParseNode, pn_next));
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 1 :Ehsan Akhgari 2011-06-08 16:24:41 PDT
Created attachment 538143 [details] [diff] [review]
Patch (v1)
Comment 2 Jeff Walden [:Waldo] (remove +bmo to email) 2011-06-17 16:07:16 PDT
Comment on attachment 538143 [details] [diff] [review]
Patch (v1)

>-        return (JSParseNode *)((char *)pn_tail - offsetof(JSParseNode, pn_next));
>+        return (JSParseNode *)(void *)((char *)pn_tail - offsetof(JSParseNode, pn_next));

More uintptr_t:

>+        return (JSParseNode *)(uintptr_t(pn_tail) - offsetof(JSParseNode, pn_next));

(reinterpret_cast<> butts up against the JS line length limit in this case, hence why I wouldn't use it.)
Comment 3 :Ehsan Akhgari 2011-06-20 06:58:05 PDT
http://hg.mozilla.org/tracemonkey/rev/f25adc3d6d65
Comment 4 Chris Leary [:cdleary] (not checking bugmail) 2011-06-20 17:06:37 PDT
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/f25adc3d6d65

Note You need to log in before you can comment on or make changes to this bug.