From 12db6dad9f8a0d8e76f00fe88e135da012d08bc4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 3 May 2018 11:16:32 +0300 Subject: [PATCH] Workaround 'opposite expression on both sides of &' cppcheck style warning * mallocx.c (GC_posix_memalign): Replace (align-1)&align with align_minus_one&align where align_minus_one local variable is set to align-1. --- mallocx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallocx.c b/mallocx.c index 390661ba..7626c720 100644 --- a/mallocx.c +++ b/mallocx.c @@ -533,7 +533,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb) GC_API int GC_CALL GC_posix_memalign(void **memptr, size_t align, size_t lb) { /* Check alignment properly. */ - if (((align - 1) & align) != 0 || align < sizeof(void *)) { + size_t align_minus_one = align - 1; /* to workaround a cppcheck warning */ + if (align < sizeof(void *) || (align_minus_one & align) != 0) { # ifdef MSWINCE return ERROR_INVALID_PARAMETER; # else -- 2.50.1