From 291945b12d15bf02c0fa63f46822e8c78325eab2 Mon Sep 17 00:00:00 2001 From: Cheng Li Date: Thu, 8 Oct 2020 11:22:34 -0700 Subject: [PATCH] td_var: avoid arithmetic on a pointer to void cast (#1096) Issue 1096 shows that a compiler complains an `arithmetic on a pointer to void` error when `-Wpointer-arith` is turned on in Makefile. Although there are many violating instances, we only fix the one in `parse.h` because it is shared across many core source code files. This patch fixes the `arithmetic on a pointer to void` issue by casting it to a uintptr_t type first and perform manipulation, and then cast it back to void* type. Signed-off-by: Cheng Li --- parse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse.h b/parse.h index 1d2cbf74..e6663ed4 100644 --- a/parse.h +++ b/parse.h @@ -125,7 +125,7 @@ static inline void *td_var(void *to, const struct fio_option *o, else ret = to; - return ret + offset; + return (void *) ((uintptr_t) ret + offset); } static inline int parse_is_percent(unsigned long long val) -- 2.25.1