Silence 'cast increases required alignment of target type' warnings
These warnings are emitted on some GCC versions when targeting ARM; the alignment is guaranteed to be correct due to how page offsets are set up but the compiler doesn't know.
This commit is contained in:
parent
9366f25136
commit
8df9f97cda
@ -424,7 +424,8 @@ PUGI__NS_BEGIN
|
|||||||
#define PUGI__GETPAGE_IMPL(header) (header).get_page()
|
#define PUGI__GETPAGE_IMPL(header) (header).get_page()
|
||||||
#else
|
#else
|
||||||
#define PUGI__GETHEADER_IMPL(object, page, flags) (((reinterpret_cast<char*>(object) - reinterpret_cast<char*>(page)) << 8) | (flags))
|
#define PUGI__GETHEADER_IMPL(object, page, flags) (((reinterpret_cast<char*>(object) - reinterpret_cast<char*>(page)) << 8) | (flags))
|
||||||
#define PUGI__GETPAGE_IMPL(header) const_cast<impl::xml_memory_page*>(reinterpret_cast<const impl::xml_memory_page*>(reinterpret_cast<const char*>(&header) - (header >> 8)))
|
// this macro casts pointers through void* to avoid 'cast increases required alignment of target type' warnings
|
||||||
|
#define PUGI__GETPAGE_IMPL(header) static_cast<impl::xml_memory_page*>(const_cast<void*>(static_cast<const void*>(reinterpret_cast<const char*>(&header) - (header >> 8))))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PUGI__GETPAGE(n) PUGI__GETPAGE_IMPL((n)->header)
|
#define PUGI__GETPAGE(n) PUGI__GETPAGE_IMPL((n)->header)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user