diff mbox

[2/2] linux-generic: timer: Suppress cast-align warning

Message ID 1404237602-20051-2-git-send-email-taras.kondratiuk@linaro.org
State Accepted
Commit 9cb35b5b467bf6a82efa75119c0e219d69d36d81
Headers show

Commit Message

Taras Kondratiuk July 1, 2014, 6 p.m. UTC
Casting odp_buffer_hdr_t to odp_timeout_hdr_t generates -Wcast-align
warning, because these structures may have different alignment
requirements.
Suppress the warning by casting to intermediate integer type.

Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 .../linux-generic/include/odp_timer_internal.h     |    3 ++-
 platform/linux-generic/source/odp_timer.c          |    3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h
index 76f1545..c6e3de6 100644
--- a/platform/linux-generic/include/odp_timer_internal.h
+++ b/platform/linux-generic/include/odp_timer_internal.h
@@ -66,7 +66,8 @@  ODP_ASSERT(sizeof(odp_timeout_hdr_t) % sizeof(uint64_t) == 0,
  */
 static inline odp_timeout_hdr_t *odp_timeout_hdr(odp_timeout_t tmo)
 {
-	return (odp_timeout_hdr_t *)odp_buf_to_hdr((odp_buffer_t)tmo);
+	odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr((odp_buffer_t)tmo);
+	return (odp_timeout_hdr_t *)(uintptr_t)buf_hdr;
 }
 
 
diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/source/odp_timer.c
index 5a88c54..69ddbdc 100644
--- a/platform/linux-generic/source/odp_timer.c
+++ b/platform/linux-generic/source/odp_timer.c
@@ -331,7 +331,6 @@  odp_timeout_t odp_timeout_from_buffer(odp_buffer_t buf)
 
 uint64_t odp_timeout_tick(odp_timeout_t tmo)
 {
-	odp_timeout_hdr_t *tmo_hdr;
-	tmo_hdr = (odp_timeout_hdr_t *)odp_buf_to_hdr((odp_buffer_t)tmo);
+	odp_timeout_hdr_t *tmo_hdr = odp_timeout_hdr(tmo);
 	return tmo_hdr->meta.tick;
 }