misc: upx_testsuite; move podman directories into subdirectory
This commit is contained in:
@@ -352,6 +352,25 @@ struct TestIntegerWrap {
|
||||
static inline bool neg_eq(const T x) noexcept { return T(0) - x == x; }
|
||||
};
|
||||
|
||||
static noinline void throwSomeValue(int x) {
|
||||
if (x < 0)
|
||||
throw int(x);
|
||||
else
|
||||
throw size_t(x);
|
||||
}
|
||||
|
||||
static noinline void check_basic_cxx_exception_handling(void (*func)(int)) noexcept {
|
||||
bool cxx_exception_handling_works = false;
|
||||
try {
|
||||
func(42);
|
||||
} catch (const size_t &e) {
|
||||
if (e == 42)
|
||||
cxx_exception_handling_works = true;
|
||||
} catch (...) {
|
||||
}
|
||||
assert_noexcept(cxx_exception_handling_works);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#define ACC_WANT_ACC_CHK_CH 1
|
||||
@@ -359,6 +378,9 @@ struct TestIntegerWrap {
|
||||
#include "../miniacc.h"
|
||||
|
||||
void upx_compiler_sanity_check(void) noexcept {
|
||||
// first check C++ exception handling to catch toolchain/qemu/wine/etc problems
|
||||
check_basic_cxx_exception_handling(throwSomeValue);
|
||||
|
||||
#define ACC_WANT_ACC_CHK_CH 1
|
||||
#undef ACCCHK_ASSERT
|
||||
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
|
||||
|
||||
+6
-2
@@ -401,8 +401,10 @@ inline void owner_delete(OwningPointer(T) (&object)) noexcept {
|
||||
delete object;
|
||||
object = nullptr;
|
||||
}
|
||||
#if defined(__clang__) || __GNUC__ != 7
|
||||
template <class T>
|
||||
inline void owner_delete(T (&array)[]) noexcept DELETED_FUNCTION;
|
||||
#endif
|
||||
template <class T, size_t N>
|
||||
inline void owner_delete(T (&array)[N]) noexcept DELETED_FUNCTION;
|
||||
|
||||
@@ -415,8 +417,10 @@ inline void mem_clear(T *object) noexcept {
|
||||
static_assert(size >= 1 && size <= UPX_RSIZE_MAX_MEM);
|
||||
memset((void *) object, 0, size);
|
||||
}
|
||||
#if defined(__clang__) || __GNUC__ != 7
|
||||
template <class T>
|
||||
inline void mem_clear(T (&array)[]) noexcept DELETED_FUNCTION;
|
||||
#endif
|
||||
template <class T, size_t N>
|
||||
inline void mem_clear(T (&array)[N]) noexcept DELETED_FUNCTION;
|
||||
|
||||
@@ -821,9 +825,9 @@ void *membuffer_get_void_ptr(MemBuffer &mb) noexcept;
|
||||
unsigned membuffer_get_size(MemBuffer &mb) noexcept;
|
||||
|
||||
// util/dt_check.cpp
|
||||
void upx_compiler_sanity_check() noexcept;
|
||||
noinline void upx_compiler_sanity_check() noexcept;
|
||||
noinline int upx_doctest_check(int argc, char **argv);
|
||||
int upx_doctest_check();
|
||||
int upx_doctest_check(int argc, char **argv);
|
||||
|
||||
// main.cpp
|
||||
extern const char *progname;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# UPX stub Makefile - needs GNU make 3.81 or better
|
||||
#
|
||||
# Preferred: see misc/rebuild-stubs-with-podman how to use Podman/Docker.
|
||||
# Preferred: see misc/podman/rebuild-stubs how to use Podman/Docker.
|
||||
# Otherwise you will need a number of special build tools like various
|
||||
# cross-assemblers and cross-compilers - see README.SRC.
|
||||
#
|
||||
|
||||
@@ -151,6 +151,7 @@ void uintptr_check_no_overlap(upx_uintptr_t a, size_t a_size, upx_uintptr_t b, s
|
||||
if very_unlikely (a_end < a || b_end < b) // wrap-around
|
||||
throwCantPack("ptr_check_no_overlap-overflow");
|
||||
// same as (!(a >= b_end || b >= a_end))
|
||||
// same as (!(a_end <= b || b_end <= a))
|
||||
if very_unlikely (a < b_end && b < a_end)
|
||||
throwCantPack("ptr_check_no_overlap-ab");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user