From a594d06b0cf3908b31431e9d72b107f3431cfea1 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 18 Apr 2016 18:52:20 -0700 Subject: [PATCH] perf: let the compiler know our cast is alignment-safe We know everything is 64-bit aligned, so casting via (void*) squashes the compiler warning. --- lib/sp-perf-counter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sp-perf-counter.c b/lib/sp-perf-counter.c index 4f1db4b7..f08039d3 100644 --- a/lib/sp-perf-counter.c +++ b/lib/sp-perf-counter.c @@ -247,7 +247,7 @@ sp_perf_counter_flush (SpPerfCounter *self, * which means there will always be space for one header, which means we * can safely dereference the size field. */ - header = (struct perf_event_header *)(info->data + (tail & mask)); + header = (struct perf_event_header *)(gpointer)(info->data + (tail & mask)); if (header->size > head - tail) { @@ -275,7 +275,7 @@ sp_perf_counter_flush (SpPerfCounter *self, memcpy (b, info->data + (tail & mask), n_before); memcpy (b + n_before, info->data, n_after); - header = (struct perf_event_header *)b; + header = (struct perf_event_header *)(gpointer)b; } if (header->type == PERF_RECORD_SAMPLE)