mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Silence jsvector.h strict-aliasing warning
This commit is contained in:
parent
a96f860128
commit
510429ab11
@ -229,6 +229,21 @@ class Vector : AllocPolicy
|
||||
union {
|
||||
BufferPtrs ptrs;
|
||||
char mBuf[sInlineBytes];
|
||||
|
||||
#if __GNUC__
|
||||
/*
|
||||
* GCC thinks there is a strict aliasing warning since mBuf is a char
|
||||
* array but we read and write to it as a T array. This is not an error
|
||||
* since there are no reads and writes to the mBuf memory except those
|
||||
* that treat it as a T array. Sadly,
|
||||
* #pragma GCC diagnostic ignore "-Wstrict-aliasing"
|
||||
* doesn't silence the warning. Type punning is allowed through a union
|
||||
* of the involved types, so, for now, this error can be silenced by
|
||||
* adding each offending T to this union. (This won't work for non-POD
|
||||
* T's, but there don't seem to be any with warnings yet...)
|
||||
*/
|
||||
jschar unused1_;
|
||||
#endif
|
||||
} u;
|
||||
|
||||
/* Only valid when usingInlineStorage() */
|
||||
|
Loading…
Reference in New Issue
Block a user