mirror of
https://github.com/upx/upx.git
synced 2024-11-23 04:39:59 +00:00
all: minor clang-tidy cleanups
This commit is contained in:
parent
07a3b75b3e
commit
33f4f3a5a1
@ -23,7 +23,6 @@ Checks: >
|
|||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
-clang-analyzer-optin.performance.Padding,
|
-clang-analyzer-optin.performance.Padding,
|
||||||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||||
-clang-analyzer-security.insecureAPI.rand,
|
|
||||||
-clang-analyzer-security.insecureAPI.strcpy,
|
-clang-analyzer-security.insecureAPI.strcpy,
|
||||||
clang-diagnostic-*,
|
clang-diagnostic-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
|
@ -313,7 +313,6 @@ struct CheckSignedness {
|
|||||||
static inline void checkU(void) noexcept {
|
static inline void checkU(void) noexcept {
|
||||||
COMPILE_TIME_ASSERT(sizeof(U) == sizeof(T));
|
COMPILE_TIME_ASSERT(sizeof(U) == sizeof(T));
|
||||||
COMPILE_TIME_ASSERT(alignof(U) == alignof(T));
|
COMPILE_TIME_ASSERT(alignof(U) == alignof(T));
|
||||||
COMPILE_TIME_ASSERT(U_is_signed ? ((U) 0 - 1 < 0) : ((U) 0 - 1 > 0));
|
|
||||||
constexpr U all_bits = (U) (U(0) - U(1));
|
constexpr U all_bits = (U) (U(0) - U(1));
|
||||||
COMPILE_TIME_ASSERT(U_is_signed ? (all_bits < 0) : (all_bits > 0));
|
COMPILE_TIME_ASSERT(U_is_signed ? (all_bits < 0) : (all_bits > 0));
|
||||||
}
|
}
|
||||||
@ -520,8 +519,14 @@ void upx_compiler_sanity_check(void) noexcept {
|
|||||||
CheckIntegral<size_t>::check();
|
CheckIntegral<size_t>::check();
|
||||||
CheckIntegral<upx_off_t>::check();
|
CheckIntegral<upx_off_t>::check();
|
||||||
CheckIntegral<upx_ptraddr_t>::check();
|
CheckIntegral<upx_ptraddr_t>::check();
|
||||||
|
CheckIntegral<upx_sptraddr_t>::check();
|
||||||
CheckIntegral<upx_uintptr_t>::check();
|
CheckIntegral<upx_uintptr_t>::check();
|
||||||
|
|
||||||
|
CheckSignedness<char, false>::check(); // -funsigned-char
|
||||||
|
CheckSignedness<signed char, true>::check();
|
||||||
|
CheckSignedness<unsigned char, false>::check();
|
||||||
|
CheckSignedness<short, true>::check();
|
||||||
|
CheckSignedness<unsigned short, false>::check();
|
||||||
CheckSignedness<long long, true>::check();
|
CheckSignedness<long long, true>::check();
|
||||||
CheckSignedness<ptrdiff_t, true>::check();
|
CheckSignedness<ptrdiff_t, true>::check();
|
||||||
CheckSignedness<intptr_t, true>::check();
|
CheckSignedness<intptr_t, true>::check();
|
||||||
|
@ -260,7 +260,9 @@ const char *upx_getenv(const char *envvar) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// random value from libc; quality is not important for UPX
|
// random value from libc; quality is not important for UPX
|
||||||
int upx_rand(void) noexcept { return ::rand(); }
|
int upx_rand(void) noexcept {
|
||||||
|
return ::rand(); // NOLINT(clang-analyzer-security.insecureAPI.rand)
|
||||||
|
}
|
||||||
|
|
||||||
void upx_rand_init(void) noexcept {
|
void upx_rand_init(void) noexcept {
|
||||||
unsigned seed = 0;
|
unsigned seed = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user