mirror of
https://github.com/isar/libmdbx.git
synced 2025-11-06 19:08:56 +08:00
mdbx: повторное "устранение" предупреждений MSVC Static Analyzer (aka Prefast).
Никаких значимых изменений, только обход "странностей" в MSVC. Как оказалось MSVC распространяет действие директивы `pragma(warning(supppress:#))` строго на следующую строку, даже если эта строка является продолжением комментария начатого в самой директиве и/или не содержит синтаксических конструкций языка. Поэтому большинство из добавленных ранее директив для подавления ложных предупреждений, перестало работать после переформатирования исходного кода.
This commit is contained in:
30
src/osal.c
30
src/osal.c
@@ -48,7 +48,8 @@ static int ntstatus2errcode(NTSTATUS status) {
|
||||
OVERLAPPED ov;
|
||||
memset(&ov, 0, sizeof(ov));
|
||||
ov.Internal = status;
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6387, "'_Param_(1)' could be '0'");
|
||||
/* Zap: '_Param_(1)' could be '0' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6387);
|
||||
return GetOverlappedResult(NULL, &ov, &dummy, FALSE) ? MDBX_SUCCESS
|
||||
: (int)GetLastError();
|
||||
}
|
||||
@@ -83,8 +84,8 @@ extern NTSTATUS NTAPI NtMapViewOfSection(
|
||||
extern NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle,
|
||||
IN OPTIONAL PVOID BaseAddress);
|
||||
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(28251,
|
||||
"Inconsistent annotation for 'NtClose'...")
|
||||
/* Zap: Inconsistent annotation for 'NtClose'... */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(28251)
|
||||
extern NTSTATUS NTAPI NtClose(HANDLE Handle);
|
||||
|
||||
extern NTSTATUS NTAPI NtAllocateVirtualMemory(
|
||||
@@ -804,8 +805,8 @@ MDBX_INTERNAL_FUNC void osal_ioring_walk(
|
||||
if (bytes & ior_WriteFile_flag) {
|
||||
data = Ptr64ToPtr(item->sgv[0].Buffer);
|
||||
bytes = ior->pagesize;
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(
|
||||
6385, "Reading invalid data from 'item->sgv'");
|
||||
/* Zap: Reading invalid data from 'item->sgv' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6385);
|
||||
while (item->sgv[i].Buffer) {
|
||||
if (data + ior->pagesize != item->sgv[i].Buffer) {
|
||||
callback(ctx, offset, data, bytes);
|
||||
@@ -852,8 +853,8 @@ osal_ioring_write(osal_ioring_t *ior, mdbx_filehandle_t fd) {
|
||||
if (bytes & ior_WriteFile_flag) {
|
||||
assert(ior->overlapped_fd && fd == ior->overlapped_fd);
|
||||
bytes = ior->pagesize;
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(
|
||||
6385, "Reading invalid data from 'item->sgv'");
|
||||
/* Zap: Reading invalid data from 'item->sgv' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6385);
|
||||
while (item->sgv[i].Buffer) {
|
||||
bytes += ior->pagesize;
|
||||
++i;
|
||||
@@ -992,8 +993,8 @@ osal_ioring_write(osal_ioring_t *ior, mdbx_filehandle_t fd) {
|
||||
size_t i = 1, bytes = item->single.iov_len - ior_WriteFile_flag;
|
||||
if (bytes & ior_WriteFile_flag) {
|
||||
bytes = ior->pagesize;
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(
|
||||
6385, "Reading invalid data from 'item->sgv'");
|
||||
/* Zap: Reading invalid data from 'item->sgv' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6385);
|
||||
while (item->sgv[i].Buffer) {
|
||||
bytes += ior->pagesize;
|
||||
++i;
|
||||
@@ -1088,8 +1089,8 @@ MDBX_INTERNAL_FUNC void osal_ioring_reset(osal_ioring_t *ior) {
|
||||
ior_put_event(ior, item->ov.hEvent);
|
||||
size_t i = 1;
|
||||
if ((item->single.iov_len & ior_WriteFile_flag) == 0) {
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(
|
||||
6385, "Reading invalid data from 'item->sgv'");
|
||||
/* Zap: Reading invalid data from 'item->sgv' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6385);
|
||||
while (item->sgv[i].Buffer)
|
||||
++i;
|
||||
}
|
||||
@@ -1108,8 +1109,8 @@ static void ior_cleanup(osal_ioring_t *ior, const size_t since) {
|
||||
osal_ioring_reset(ior);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
for (size_t i = since; i < ior->event_stack; ++i) {
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(
|
||||
6001, "Using uninitialized memory '**ior.event_pool'");
|
||||
/* Zap: Using uninitialized memory '**ior.event_pool' */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6001);
|
||||
CloseHandle(ior->event_pool[i]);
|
||||
}
|
||||
ior->event_stack = 0;
|
||||
@@ -2749,7 +2750,8 @@ retry_mapview:;
|
||||
|
||||
#endif /* POSIX / Windows */
|
||||
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6287, "Redundant code");
|
||||
/* Zap: Redundant code */
|
||||
MDBX_SUPPRESS_GOOFY_MSVC_ANALYZER(6287);
|
||||
assert(rc != MDBX_SUCCESS ||
|
||||
(map->base != nullptr && map->base != MAP_FAILED &&
|
||||
map->current == size && map->limit == limit &&
|
||||
|
||||
Reference in New Issue
Block a user