CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2024-04-20 12:29:32 +02:00
parent 1d2b276425
commit e4de14612f
9 changed files with 22 additions and 34 deletions

View File

@ -22,7 +22,7 @@ Checks: >
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-security.insecureAPI.strcpy,
clang-diagnostics-*,
clang-diagnostic-*,
performance-*,
-performance-avoid-endl,
-performance-unnecessary-value-param,

View File

@ -17,8 +17,8 @@ env:
UPX_CMAKE_CONFIG_FLAGS: -Wdev --warn-uninitialized
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1
UPX_DEBUG_TEST_LIBC_QSORT: 1
# 2024-04-14
ZIG_DIST_VERSION: 0.12.0-dev.3653+e45bdc6bd
# 2024-04-20
ZIG_DIST_VERSION: 0.12.0
jobs:
job-rebuild-and-verify-stubs:

View File

@ -16,7 +16,7 @@ Checks: >
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.uninitialized.Assign,
-clang-analyzer-security.insecureAPI.strcpy,
clang-diagnostics-*,
clang-diagnostic-*,
performance-*,
FormatStyle: file
HeaderFilterRegex: '.*'

View File

@ -14,7 +14,7 @@ Checks: >
-bugprone-suspicious-include,
clang-analyzer-*,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
clang-diagnostics-*,
clang-diagnostic-*,
performance-*,
FormatStyle: file
HeaderFilterRegex: '.*'

View File

@ -15,7 +15,7 @@ Checks: >
clang-analyzer-*,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
clang-diagnostics-*,
clang-diagnostic-*,
performance-*,
FormatStyle: file
HeaderFilterRegex: '.*'

View File

@ -18,7 +18,7 @@ Checks: >
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-deadcode.DeadStores,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
clang-diagnostics-*,
clang-diagnostic-*,
performance-*,
-performance-no-int-to-ptr,
FormatStyle: file

View File

@ -370,28 +370,6 @@ static noinline double u64_f64_sub_div(upx_uint64_t a, upx_uint64_t b) {
return (a - b) / 1000000.0;
}
// extra debugging; floating point edge cases cause portability problems in practice
static noinline bool shall_test_float_division_by_zero(void) {
static bool result = false; // default is false
static upx_std_once_flag init_done;
upx_std_call_once(init_done, []() noexcept {
static const char envvar[] = "UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO";
const char *e = upx_getenv(envvar);
bool force = (e && e[0] && strcmp(e, "2") == 0);
if (force)
result = true;
else if (is_envvar_true(envvar)) {
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring %s: __FAST_MATH__\n", envvar);
#else
result = true;
#endif
}
});
return result;
}
template <class Int, class Float>
struct TestFloat {
static constexpr Int X = 1000000;
@ -407,10 +385,16 @@ struct TestFloat {
assert_noexcept(sub_div(3 * X, X, Float(X)) == Float(2));
assert_noexcept(sub_div_x(3 * X, X) == Float(2));
// extra debugging; floating point edge cases cause portability problems in practice
if (shall_test_float_division_by_zero()) {
static const char envvar[] = "UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO";
if (is_envvar_true(envvar)) {
#if defined(__FAST_MATH__)
// warning: comparison with NaN always evaluates to false in fast floating point modes
fprintf(stderr, "upx: WARNING: ignoring %s: __FAST_MATH__\n", envvar);
#else
assert_noexcept(std::isnan(div(0, Float(0))));
assert_noexcept(std::isinf(div(1, Float(0))));
assert_noexcept(std::isinf(div(Int(-1), Float(0))));
#endif
}
}
};

View File

@ -364,11 +364,15 @@ struct TestTriBool {
static_assert(std::is_trivially_copyable<T>::value);
static_assert(sizeof(typename T::value_type) == sizeof(typename T::underlying_type));
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
#if defined(__m68k__) && defined(__atarist__) && defined(__GNUC__)
// broken compiler or broken ABI
#elif __GNUC__ == 7 && defined(__i386__) && !defined(__clang__)
#elif defined(__i386__) && defined(__clang__) && (__clang_major__ < 9)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// gcc-7 "long long" enum align bug/ABI problem on i386
// i386: "long long" enum align bug/ABI problem on older compilers
static_assert(alignof(T) <= alignof(typename T::underlying_type));
#elif defined(__i386__) && defined(__GNUC__) && (__GNUC__ == 7) && !defined(__clang__)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// i386: "long long" enum align bug/ABI problem on older compilers
static_assert(alignof(T) <= alignof(typename T::underlying_type));
#else
static_assert(sizeof(T) == sizeof(typename T::underlying_type));

View File

@ -55,7 +55,7 @@
#endif
#endif
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
#if defined(__clang__) && defined(__FAST_MATH__)
// warning: comparison with NaN always evaluates to false in fast floating point modes
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
#endif