CI and cmake updates

This commit is contained in:
Markus F.X.J. Oberhumer
2024-08-07 13:37:38 +02:00
parent b4db17ab3c
commit a9cb354225
10 changed files with 75 additions and 65 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ endif # /usr/bin/env
# make clang-format
#***********************************************************************
# automatically format some C++ source code files
# automatically format most C++ source code files
ifneq ($(wildcard /usr/bin/env),)
ifeq ($(shell uname),Linux)
+2
View File
@@ -1117,8 +1117,10 @@ void upx_compiler_sanity_check(void) noexcept {
0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0,
0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0};
constexpr const byte *d = dd + 7;
#if !defined(upx_fake_alignas_16)
assert_noexcept(ptr_is_aligned<16>(dd));
assert_noexcept(ptr_is_aligned(dd, 16));
#endif
static_assert(upx::compile_time::get_be16(d) == 0xfffe);
static_assert(upx::compile_time::get_be24(d) == 0xfffefd);
static_assert(upx::compile_time::get_be32(d) == 0xfffefdfc);
+7 -8
View File
@@ -106,14 +106,12 @@ TEST_CASE("mem_size") {
// ptr util
**************************************************************************/
int ptr_diff_bytes(const void *a, const void *b) {
if very_unlikely (a == nullptr) {
int ptr_diff_bytes(const void *a, const void *b) may_throw {
if very_unlikely (a == nullptr)
throwCantPack("ptr_diff_bytes null 1; take care");
}
if very_unlikely (b == nullptr) {
if very_unlikely (b == nullptr)
throwCantPack("ptr_diff_bytes null 2; take care");
}
ptrdiff_t d = (const charptr) a - (const charptr) b;
upx_sptraddr_t d = ptraddr_diff(a, b);
if (a >= b) {
if very_unlikely (!mem_size_valid_bytes(d))
throwCantPack("ptr_diff_bytes-1; take care");
@@ -121,10 +119,11 @@ int ptr_diff_bytes(const void *a, const void *b) {
if very_unlikely (!mem_size_valid_bytes(0ll - d))
throwCantPack("ptr_diff_bytes-2; take care");
}
assert_noexcept(d == ((const charptr) a - (const charptr) b));
return ACC_ICONV(int, d);
}
unsigned ptr_udiff_bytes(const void *a, const void *b) {
unsigned ptr_udiff_bytes(const void *a, const void *b) may_throw {
int d = ptr_diff_bytes(a, b);
if very_unlikely (d < 0)
throwCantPack("ptr_udiff_bytes; take care");
@@ -1026,7 +1025,7 @@ TEST_CASE("get_ratio") {
// compat
**************************************************************************/
#if defined(__wasi__) && 1 // TODO later - wait for wasm/wasi exception handling proposal
#if defined(__wasi__) && 1 // TODO later: wait for wasm/wasi exception handling proposal
extern "C" {
void *__cxa_allocate_exception(std::size_t thrown_size) throw() { return ::malloc(thrown_size); }
void __cxa_throw(void *thrown_exception, /*std::type_info*/ void *tinfo, void (*dest)(void *)) {
+4
View File
@@ -105,6 +105,10 @@ forceinline upx_ptraddr_t ptr_get_address(const void *p) noexcept { return (upx_
forceinline upx_ptraddr_t ptr_get_address(upx_uintptr_t p) noexcept { return p; }
#endif
forceinline upx_sptraddr_t ptraddr_diff(const void *a, const void *b) noexcept {
return ptr_get_address(a) - ptr_get_address(b);
}
template <size_t Alignment>
forceinline bool ptr_is_aligned(const void *p) noexcept {
static_assert(upx::has_single_bit(Alignment));
+1 -6
View File
@@ -76,12 +76,7 @@ void xspan_check_range(const void *ptr, const void *base, ptrdiff_t size_in_byte
xspan_fail_range_nullptr();
if very_unlikely (base == nullptr)
xspan_fail_range_nullbase();
#if defined(__SANITIZE_ADDRESS__) || 1
// info: pointers are out of range deliberately during internal doctest checks; see dt_xspan.cpp
const upx_sptraddr_t off = ptr_get_address(ptr) - ptr_get_address(base);
#else
const ptrdiff_t off = (const charptr) ptr - (const charptr) base;
#endif
upx_sptraddr_t off = ptraddr_diff(ptr, base);
if very_unlikely (off < 0 || off > size_in_bytes || size_in_bytes > UPX_RSIZE_MAX)
xspan_fail_range_range();
NO_fprintf(stderr, "xspan_check_range done\n");