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

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

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

In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsapi.cpp:61:
In file included from /Users/ehsanakhgari/moz/tmp/js/src/jsclone.h:43:
/Users/ehsanakhgari/moz/tmp/js/src/jscntxt.h:2279:12: warning: cast from 'uint8 *' (aka 'unsigned char *') to 'JSContext *' increases required alignment from 1 to 8
    return (JSContext *) ((uint8 *) link - offsetof(JSContext, link));
Comment 1 User image :Ehsan Akhgari 2011-06-08 16:21:41 PDT
Created attachment 538142 [details] [diff] [review]
Patch (v1)
Comment 2 User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-06-17 16:05:07 PDT
Comment on attachment 538142 [details] [diff] [review]
Patch (v1)

>-    return (JSContext *) ((uint8 *) link - offsetof(JSContext, link));
>+    return (JSContext *) (void *) ((uint8 *) link - offsetof(JSContext, link));

Another place where uintptr_t seems better than an extra cast:

>+    return reinterpret_cast<JSContext *>(uintptr_t(link) - offsetof(JSContext, link));
Comment 3 User image :Ehsan Akhgari 2011-06-20 06:57:37 PDT
Comment 4 User image Chris Leary [:cdleary] (not checking bugmail) 2011-06-20 17:06:30 PDT
cdleary-bot mozilla-central merge info:

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