| Summary: | GCC complains about a memcpy in SmallSet.h | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Eleni Maria Stea <estea> | ||||
| Component: | Web Template Framework | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, darin, estea, ews-watchlist, mcatanzaro, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Local Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
Created attachment 429512 [details]
Patch
Comment on attachment 429512 [details]
Patch
Found this when searching for -Wclass-memaccess warnings. It will need to be rebased because I added void casts at some point to suppress this warning. Your solution is better.
Comment on attachment 429512 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429512&action=review > Source/WTF/wtf/SmallSet.h:72 > + this->m_size = other.m_size; > + this->m_capacity = other.m_capacity; > + this->m_inline = other.m_inline; We can also omit the "this->" here. |
GCC complains about a memcpy in SmallSet.h It seems that it contains an object with no trivial copy-assignment. We'd rather eplace the memcpy with assignments of the private members. Error: WTF/Headers/wtf/SmallSet.h:70:15: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class WTF::SmallSet<WTF::UniquedStringImpl*’ with no trivial copy-assignment [-Wclass-memaccess] 70 | memcpy(this, &other, sizeof(SmallSet)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WTF/Headers/wtf/SmallSet.h:44:7: note: ‘class WTF::SmallSet<WTF::UniquedStringImpl*>’ declared here 44 | class SmallSet {