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