Closed
Bug 778129
Opened 12 years ago
Closed 12 years ago
GLContextProviderEGL.cpp fails to compile on mingw-w64
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: jacek, Assigned: jacek)
Details
Attachments
(1 file)
999 bytes,
patch
|
snorp
:
review+
|
Details | Diff | Splinter Review |
Because on win64 sizeof(long) != sizeof(void*), GCC is strict about preventing pointer to any int with smaller size to avoid common mistakes. Thus, the cast must be made more carefully.
Attachment #646557 -
Flags: review?(snorp)
Assignee | ||
Comment 1•12 years ago
|
||
James, ping
Comment 2•12 years ago
|
||
(In reply to Jacek Caban from comment #0) > Created attachment 646557 [details] [diff] [review] > fix v1.0 > > Because on win64 sizeof(long) != sizeof(void*), GCC is strict about > preventing pointer to any int with smaller size to avoid common mistakes. > Thus, the cast must be made more carefully. Sorry for the late reply. Slipped off my radar somehow. Anyway, I think the sizeof(long) != sizeof(void*) thing is true elsewhere but the cast works. This cast to uintptr_t looks incorrect to me, considering that's not what GLuint is. Can you paste the error you get? Surely it's just a warning? Bringing in some other folks who probably have an opinion...
Assignee | ||
Comment 3•12 years ago
|
||
Yes, it's an error and it looks like this: mozilla-central/gfx/gl/GLContextProviderEGL.cpp:938:34: error: cast from ‘void*’ to ‘GLuint {aka unsigned int}’ loses precision [-fpermissive] I've fixed a few such cases in the codebase, and it's nothing really special here... The trick is to always cast pointers to integers of the same size. Although GLUint is not the same as uintptr_t, it's not a problem, because there will be an implicit cast. So instead of one cast that both changes pointer to integer and loses precision, we have an explicit cast that does safe pointer to integer cast and then implicit cast (in assignment expression) that loses integer precision.
Comment 4•12 years ago
|
||
Comment on attachment 646557 [details] [diff] [review] fix v1.0 Alright, I'm convinced :)
Attachment #646557 -
Flags: review?(snorp) → review+
Comment 5•12 years ago
|
||
Do you need me to check this in for you?
Assignee | ||
Comment 6•12 years ago
|
||
Thanks for the review. I will commit it myself.
Assignee | ||
Comment 7•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/111ee5107308
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/111ee5107308
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•