Skip to content

Commit 42e5b8a

Browse files
committed
Fix AuditMode errors
1 parent a2763e4 commit 42e5b8a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/inc/til/hash.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33

44
#pragma once
55

6+
#pragma warning(push)
7+
// std::hash() doesn't test for `nullptr`, nor do we want to.
8+
#pragma warning(disable: 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null (f.23).
9+
// Misdiagnosis: static_cast<const void*> is used to differentiate between 2 overloads of til::hasher::write.
10+
#pragma warning(disable: 26474) // Don't cast between pointer types when the conversion could be implicit (type.1).
11+
// We don't want to unnecessarily modify wyhash from its original.
12+
#pragma warning(disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
13+
#pragma warning(disable: 26494) // Variable '...' is uninitialized. Always initialize an object (type.5).
14+
#pragma warning(disable: 26496) // The variable '...' does not change after construction, mark it as const (con.4).
15+
616
#if defined(_M_X64) && !defined(_M_ARM64EC)
717
#define TIL_HASH_X64
818
#elif defined(_M_ARM64) || defined(_M_ARM64EC)
@@ -229,7 +239,7 @@ namespace til
229239
void operator()(hasher& h, float v) const noexcept
230240
{
231241
v = v == 0.0f ? 0.0f : v; // map -0 to 0
232-
h.write(static_cast<const void*>(&v), sizeof v);
242+
h.write(static_cast<const void*>(&v), sizeof(v));
233243
}
234244
};
235245

@@ -276,3 +286,5 @@ namespace til
276286
return h.finalize();
277287
}
278288
}
289+
290+
#pragma warning(pop)

0 commit comments

Comments
 (0)