From 70223babb056f3e03cc32034f5dd1b3d719d56dd Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 3 Jul 2021 16:50:05 +0200 Subject: PVS/V1051: Ignore "modulo by 1" warning for ARRAY_SIZE. (#14943) The warning is triggered by the second division when arr is a char array since sizeof(char) is 1. A modulo by 1 may normally indicate a logic error, but in this case it's intended. --- src/nvim/macros.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/macros.h b/src/nvim/macros.h index e718254fb9..48a16ed42a 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -133,6 +133,8 @@ /// error. A mechanism to detect many (though not all) of those errors at /// compile time is implemented. It works by the second division producing /// a division by zero in those cases (-Wdiv-by-zero in GCC). +/// +/// -V:ARRAY_SIZE:1063 #define ARRAY_SIZE(arr) \ ((sizeof(arr)/sizeof((arr)[0])) \ / ((size_t)(!(sizeof(arr) % sizeof((arr)[0]))))) -- cgit