[Webkit-unassigned] [Bug 150235] New: SameSizeAs* structs wrongly assume sizeof(ptr)==sizeof(std::unique_ptr)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Oct 16 09:54:23 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=150235
Bug ID: 150235
Summary: SameSizeAs* structs wrongly assume
sizeof(ptr)==sizeof(std::unique_ptr)
Classification: Unclassified
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore Misc.
Assignee: webkit-unassigned at lists.webkit.org
Reporter: rupsharma at ea.com
Hi,
In regard to all the static assertions, to check the sizes of the data-structures using SameSizeAs* structs, it is wrongly assumed, that sizeof (std::unique_ptr) is same as sizeof (pointer) for all compilers.
Therefore, I would suggest to list them separately while computing the sizes.
To give an example:
In WebCore\dom\ElementRareData.cpp
The structure should look like:
struct SameSizeAsElementRareData : NodeRareData {
short indices[2];
unsigned bitfields;
RegionOversetState regionOversetState;
LayoutSize sizeForResizing;
IntSize scrollOffset;
// CHANGE BEGINS HERE . Earlier it was :void* pointers[7];
void* pointers[4];
std::unique_ptr<DatasetDOMStringMap> pointer2;
std::unique_ptr<ClassList> pointer3;
std::unique_ptr<NamedNodeMap> pointer4;
// CHANGE ENDS HERE
};
Making the above change, works perfectly for us without throwing any compile-time assert at:
static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "ElementRareData should stay small");
Thanks,
Rupali
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151016/a4fddbee/attachment-0001.html>
More information about the webkit-unassigned
mailing list