diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2021-07-03 16:50:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-03 07:50:05 -0700 |
commit | 70223babb056f3e03cc32034f5dd1b3d719d56dd (patch) | |
tree | b1d5bfd365854e4e847badc0d46fd4a867c40d7a /src | |
parent | 05330ba5085013663454c05d55ddb8e6c157a552 (diff) | |
download | rneovim-70223babb056f3e03cc32034f5dd1b3d719d56dd.tar.gz rneovim-70223babb056f3e03cc32034f5dd1b3d719d56dd.tar.bz2 rneovim-70223babb056f3e03cc32034f5dd1b3d719d56dd.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/macros.h | 2 |
1 files changed, 2 insertions, 0 deletions
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]))))) |