src: fix djgpp and musl builds
This commit is contained in:
+2
-1
@@ -111,6 +111,7 @@ ACC_COMPILE_TIME_ASSERT_HEADER((char)(-1) == 255) // -funsigned-char
|
|||||||
|
|
||||||
#undef snprintf
|
#undef snprintf
|
||||||
#undef vsnprintf
|
#undef vsnprintf
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
#define ACC_WANT_ACC_INCD_H 1
|
#define ACC_WANT_ACC_INCD_H 1
|
||||||
#define ACC_WANT_ACC_INCE_H 1
|
#define ACC_WANT_ACC_INCE_H 1
|
||||||
#define ACC_WANT_ACC_LIB_H 1
|
#define ACC_WANT_ACC_LIB_H 1
|
||||||
@@ -738,7 +739,7 @@ unsigned membuffer_get_size(MemBuffer &mb);
|
|||||||
|
|
||||||
#include "util/xspan.h"
|
#include "util/xspan.h"
|
||||||
|
|
||||||
//#define DOCTEST_CONFIG_DISABLE
|
//#define DOCTEST_CONFIG_DISABLE 1
|
||||||
#include <doctest/parts/doctest_fwd.h>
|
#include <doctest/parts/doctest_fwd.h>
|
||||||
|
|
||||||
// util/dt_check.cpp
|
// util/dt_check.cpp
|
||||||
|
|||||||
+1
-1
@@ -6085,7 +6085,7 @@ Elf64_Sym const *PackLinuxElf64::elf_lookup(char const *name) const
|
|||||||
do {
|
do {
|
||||||
if (gashend <= hp) {
|
if (gashend <= hp) {
|
||||||
char msg[120]; snprintf(msg, sizeof(msg),
|
char msg[120]; snprintf(msg, sizeof(msg),
|
||||||
"bad gnu_hash[%#zx] head=%u",
|
"bad gnu_hash[%#tx] head=%u",
|
||||||
hp - hasharr, hhead);
|
hp - hasharr, hhead);
|
||||||
throwCantPack(msg);
|
throwCantPack(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
bool upx_doctest_check(int argc, char **argv) {
|
bool upx_doctest_check(int argc, char **argv) {
|
||||||
|
#if defined(DOCTEST_CONFIG_DISABLE)
|
||||||
|
UNUSED(argc);
|
||||||
|
UNUSED(argv);
|
||||||
|
#else
|
||||||
bool minimal = true; // only show failing tests
|
bool minimal = true; // only show failing tests
|
||||||
bool duration = false; // show timings
|
bool duration = false; // show timings
|
||||||
bool success = false; // show all tests
|
bool success = false; // show all tests
|
||||||
@@ -66,6 +70,7 @@ bool upx_doctest_check(int argc, char **argv) {
|
|||||||
int r = context.run();
|
int r = context.run();
|
||||||
if (context.shouldExit() || r != 0)
|
if (context.shouldExit() || r != 0)
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
#define DOCTEST_CONFIG_IMPLEMENT
|
#define DOCTEST_CONFIG_IMPLEMENT
|
||||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
||||||
#define DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
|
#define DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
|
||||||
|
#if defined(__MSDOS__) && defined(__DJGPP__)
|
||||||
|
#define DOCTEST_CONFIG_NO_POSIX_SIGNALS
|
||||||
|
#endif
|
||||||
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
#include <doctest/parts/doctest.cpp>
|
#include <doctest/parts/doctest.cpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* vim:set ts=4 sw=4 et: */
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
@@ -480,6 +480,7 @@ TEST_CASE("Span constness") {
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
namespace {
|
namespace {
|
||||||
int my_memcmp_v1(SPAN_P(const void) a, SPAN_0(const void) b, size_t n) {
|
int my_memcmp_v1(SPAN_P(const void) a, SPAN_0(const void) b, size_t n) {
|
||||||
if (b == nullptr)
|
if (b == nullptr)
|
||||||
@@ -499,6 +500,7 @@ int my_memcmp_v2(SPAN_P(const char) a, SPAN_0(const char) b, size_t n) {
|
|||||||
return memcmp(x, y, n);
|
return memcmp(x, y, n);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_CASE("PtrOrSpan") {
|
TEST_CASE("PtrOrSpan") {
|
||||||
static const char buf[4] = {0, 1, 2, 3};
|
static const char buf[4] = {0, 1, 2, 3};
|
||||||
|
|||||||
@@ -283,7 +283,9 @@ inline C<T> operator-(const C<T> &a, const LE32 &v) {
|
|||||||
template <class T>
|
template <class T>
|
||||||
typename std::enable_if<sizeof(T) == 1, upx_rsize_t>::type upx_safe_strlen(const C<T> &a) {
|
typename std::enable_if<sizeof(T) == 1, upx_rsize_t>::type upx_safe_strlen(const C<T> &a) {
|
||||||
// not fully checked, but can require at least 1 byte
|
// not fully checked, but can require at least 1 byte
|
||||||
return upx_safe_strlen(a.raw_bytes(1));
|
upx_rsize_t len = upx_safe_strlen(a.raw_bytes(1));
|
||||||
|
(void) a.raw_bytes(len + 1); // now can do a full check
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UPX_VERSION_HEX
|
#endif // UPX_VERSION_HEX
|
||||||
|
|||||||
Reference in New Issue
Block a user