diff options
| author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-18 09:49:31 -0800 | 
|---|---|---|
| committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-18 09:49:31 -0800 | 
| commit | 8df9f97cdaba7bd846c42321f9c2618c9e0ea12d (patch) | |
| tree | af981fd49dad869770fe30ce31b8e72df01dea18 /src | |
| parent | 9366f25136bcd471ce867abd4f737e2cb4bfebb1 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pugixml.cpp | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 72cab1f..cac51a5 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -424,7 +424,8 @@ PUGI__NS_BEGIN  	#define PUGI__GETPAGE_IMPL(header) (header).get_page()  #else  	#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  	#define PUGI__GETPAGE(n) PUGI__GETPAGE_IMPL((n)->header) | 
