all: more minor cleanups
This commit is contained in:
parent
bf8dd31914
commit
3e70021406
@ -19,6 +19,5 @@ SortIncludes: false
|
||||
SpaceAfterCStyleCast: true
|
||||
Standard: Cpp03
|
||||
StatementMacros:
|
||||
- ACC_BLOCK_BEGIN
|
||||
- CLANG_FORMAT_DUMMY_STATEMENT
|
||||
...
|
||||
|
||||
6
.github/workflows/weekly-ci-rt-checkers.yml
vendored
6
.github/workflows/weekly-ci-rt-checkers.yml
vendored
@ -20,9 +20,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { container: 'alpine:3.18', release: debug, qemu: 'qemu-x86_64 -cpu Westmere' }
|
||||
- { container: 'alpine:3.18', release: release, qemu: 'qemu-x86_64 -cpu Westmere' }
|
||||
- { container: 'alpine:edge', release: release, qemu: 'qemu-x86_64 -cpu Westmere' }
|
||||
- { container: 'alpine:3.18', release: debug, qemu: 'qemu-x86_64 -cpu Nehalem' }
|
||||
- { container: 'alpine:3.18', release: release, qemu: 'qemu-x86_64 -cpu Nehalem' }
|
||||
- { container: 'alpine:edge', release: release, qemu: 'qemu-x86_64 -cpu Nehalem' }
|
||||
- { container: 'i386/alpine:edge', release: release, qemu: 'qemu-i386' }
|
||||
name: ${{ format('{0} {1}', matrix.container, matrix.release) }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@ -120,7 +120,7 @@ function(upx_cache_bool_vars)
|
||||
endfunction()
|
||||
|
||||
# global settings
|
||||
if(${CMAKE_VERSION} VERSION_GREATER "3.14.7" AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER "3.14.99" AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif()
|
||||
|
||||
2
Makefile
2
Makefile
@ -67,6 +67,6 @@ CTEST = ctest
|
||||
test: $(.DEFAULT_GOAL)
|
||||
cd $(.DEFAULT_GOAL) && $(CTEST)
|
||||
ifneq ($(wildcard /usr/bin/env),) # needs bash, perl, xargs, etc.
|
||||
check-whitespace clang-format run-testsuite run-testsuite-debug run-testsuite-release: PHONY src/Makefile
|
||||
check-whitespace clang-format run-testsuite run-testsuite-debug run-testsuite-release: src/Makefile PHONY
|
||||
$(MAKE) -C src $@
|
||||
endif
|
||||
|
||||
@ -9,7 +9,7 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
||||
# test file system behaviour with symlinks; requires:
|
||||
# $upx_exe (required, but with convenience fallback "./upx")
|
||||
# optional settings:
|
||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Westmere" or "valgrind")
|
||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||
#
|
||||
|
||||
# IMPORTANT NOTE: do NOT run as user root!!
|
||||
@ -42,7 +42,7 @@ upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||
upx_run=()
|
||||
if [[ -n $upx_exe_runner ]]; then
|
||||
# usage examples:
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Westmere"
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||
# export upx_exe_runner="wine"
|
||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
||||
|
||||
@ -12,7 +12,7 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
||||
# $upx_testsuite_BUILDDIR (optional)
|
||||
#
|
||||
# optional settings:
|
||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Westmere" or "valgrind")
|
||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||
# $UPX_TESTSUITE_VERBOSE
|
||||
# $UPX_TESTSUITE_LEVEL
|
||||
#
|
||||
@ -32,7 +32,7 @@ upx_exe=$(readlink -fn "$upx_exe") # make absolute
|
||||
upx_run=()
|
||||
if [[ -n $upx_exe_runner ]]; then
|
||||
# usage examples:
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Westmere"
|
||||
# export upx_exe_runner="qemu-x86_64 -cpu Nehalem"
|
||||
# export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet"
|
||||
# export upx_exe_runner="wine"
|
||||
IFS=' ' read -r -a upx_run <<< "$upx_exe_runner" # split at spaces into array
|
||||
|
||||
23
src/Makefile
23
src/Makefile
@ -18,7 +18,7 @@ endif
|
||||
#
|
||||
|
||||
# NOTE that top-level Makefile .DEFAULT_GOAL is build/release
|
||||
.DEFAULT_GOAL = build/debug
|
||||
.DEFAULT_GOAL = build/all
|
||||
|
||||
build/debug: $(top_srcdir)/build/debug
|
||||
build/release: $(top_srcdir)/build/release
|
||||
@ -33,15 +33,14 @@ debug: build/debug
|
||||
release: build/release
|
||||
all build/all: build/debug build/release
|
||||
|
||||
$(top_srcdir)/build/debug: PHONY
|
||||
$(MAKE) -C $(top_srcdir) build/debug
|
||||
$(top_srcdir)/build/release: PHONY
|
||||
$(MAKE) -C $(top_srcdir) build/release
|
||||
# actual rules - redirect to top-level
|
||||
$(top_srcdir)/build/debug: PHONY; $(MAKE) -C $(top_srcdir) build/debug
|
||||
$(top_srcdir)/build/release: PHONY; $(MAKE) -C $(top_srcdir) build/release
|
||||
|
||||
# convenience
|
||||
CTEST = ctest
|
||||
test: $(top_srcdir)/$(.DEFAULT_GOAL)
|
||||
cd $(top_srcdir)/$(.DEFAULT_GOAL) && $(CTEST)
|
||||
test:: $(top_srcdir)/build/debug PHONY; cd $< && $(CTEST)
|
||||
test:: $(top_srcdir)/build/release PHONY; cd $< && $(CTEST)
|
||||
|
||||
#
|
||||
# "make run-testsuite"
|
||||
@ -70,10 +69,10 @@ run-testsuite: run-testsuite-release
|
||||
run-testsuite-%: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
||||
run-testsuite-%: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite
|
||||
run-testsuite-debug: export upx_exe := $(top_srcdir)/build/debug/upx
|
||||
run-testsuite-debug: PHONY $(top_srcdir)/build/debug
|
||||
run-testsuite-debug: $(top_srcdir)/build/debug PHONY
|
||||
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh
|
||||
run-testsuite-release: export upx_exe := $(top_srcdir)/build/release/upx
|
||||
run-testsuite-release: PHONY $(top_srcdir)/build/release
|
||||
run-testsuite-release: $(top_srcdir)/build/release PHONY
|
||||
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh
|
||||
endif
|
||||
endif
|
||||
@ -83,9 +82,9 @@ endif
|
||||
#
|
||||
|
||||
ifneq ($(wildcard /usr/bin/env),) # needs bash, perl, xargs, etc.
|
||||
CHECK_WHITESPACE = $(top_srcdir)/misc/scripts/check_whitespace.sh $(top_srcdir)
|
||||
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace.sh $(top_srcdir)
|
||||
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||
CHECK_WHITESPACE = $(top_srcdir)/misc/scripts/check_whitespace_git.sh $(top_srcdir)
|
||||
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace_git.sh $(top_srcdir)
|
||||
endif
|
||||
check-whitespace: PHONY; $(CHECK_WHITESPACE)
|
||||
endif
|
||||
@ -102,7 +101,7 @@ CLANG_FORMAT_EXCLUDE_FILES += p_elf.h p_elf_enum.h p_lx_% p_mach% p_unix% p_vmli
|
||||
CLANG_FORMAT_FILES := $(sort $(wildcard *.[ch]* ../maint/src/*.[ch]* */*.[ch]*))
|
||||
CLANG_FORMAT_FILES += $(sort $(wildcard stub/tools/*/*.[ch]*))
|
||||
CLANG_FORMAT_FILES := $(filter-out $(CLANG_FORMAT_EXCLUDE_FILES),$(CLANG_FORMAT_FILES))
|
||||
clang-format: PHONY $(CLANG_FORMAT_FILES)
|
||||
clang-format: $(CLANG_FORMAT_FILES) PHONY
|
||||
@echo "running upx-clang-format"
|
||||
@$(top_srcdir)/misc/scripts/upx-clang-format.sh -i $(CLANG_FORMAT_FILES)
|
||||
endif
|
||||
|
||||
@ -136,12 +136,10 @@ bool PackPs1::readBkupHeader() {
|
||||
}
|
||||
|
||||
#define INIT_BH_BKUP(p, l) \
|
||||
ACC_BLOCK_BEGIN \
|
||||
{ \
|
||||
do { \
|
||||
(p)->id = '1'; \
|
||||
(p)->len = l; \
|
||||
} \
|
||||
ACC_BLOCK_END
|
||||
} while (0)
|
||||
#define ADLER16(a) (((a) >> 16) ^ ((a) &0xffff))
|
||||
|
||||
void PackPs1::putBkupHeader(const byte *src, byte *dst, unsigned *len) {
|
||||
|
||||
@ -137,19 +137,19 @@ static noinline tribool try_can_unpack(PackerBase *pb, void *user) may_throw {
|
||||
PackerBase *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const Options *o,
|
||||
void *user) may_throw {
|
||||
#define D(Klass) \
|
||||
ACC_BLOCK_BEGIN \
|
||||
COMPILE_TIME_ASSERT(std::is_nothrow_destructible_v<Klass>) \
|
||||
auto pb = std::unique_ptr<PackerBase>(new Klass(f)); \
|
||||
if (o->debug.debug_level) \
|
||||
fprintf(stderr, "visitAllPackers: (ver=%d, fmt=%3d) %s\n", pb->getVersion(), \
|
||||
pb->getFormat(), #Klass); \
|
||||
pb->assertPacker(); \
|
||||
tribool r = func(pb.get(), user); \
|
||||
if (r) \
|
||||
return pb.release(); /* success */ \
|
||||
if (r.isThird()) \
|
||||
return nullptr; /* stop and fail early */ \
|
||||
ACC_BLOCK_END
|
||||
do { \
|
||||
COMPILE_TIME_ASSERT(std::is_nothrow_destructible_v<Klass>) \
|
||||
auto pb = std::unique_ptr<PackerBase>(new Klass(f)); \
|
||||
if (o->debug.debug_level) \
|
||||
fprintf(stderr, "visitAllPackers: (ver=%d, fmt=%3d) %s\n", pb->getVersion(), \
|
||||
pb->getFormat(), #Klass); \
|
||||
pb->assertPacker(); \
|
||||
tribool r = func(pb.get(), user); \
|
||||
if (r) \
|
||||
return pb.release(); /* success */ \
|
||||
if (r.isThird()) \
|
||||
return nullptr; /* stop and fail early */ \
|
||||
} while (0)
|
||||
|
||||
// NOTE: order of tries is important !!!
|
||||
|
||||
|
||||
@ -285,13 +285,13 @@ static void memswap_no_overlap(byte *a, byte *b, size_t n) {
|
||||
#else // clang bug
|
||||
upx_alignas_max byte tmp_buf[16];
|
||||
#define SWAP(x) \
|
||||
ACC_BLOCK_BEGIN \
|
||||
upx_memcpy_inline(tmp_buf, a, x); \
|
||||
upx_memcpy_inline(a, b, x); \
|
||||
upx_memcpy_inline(b, tmp_buf, x); \
|
||||
a += x; \
|
||||
b += x; \
|
||||
ACC_BLOCK_END
|
||||
do { \
|
||||
upx_memcpy_inline(tmp_buf, a, x); \
|
||||
upx_memcpy_inline(a, b, x); \
|
||||
upx_memcpy_inline(b, tmp_buf, x); \
|
||||
a += x; \
|
||||
b += x; \
|
||||
} while (0)
|
||||
|
||||
for (; n >= 16; n -= 16)
|
||||
SWAP(16);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user