From f62576a2be0e2c880d737cd56914e393fda2f668 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 30 Oct 2023 14:15:35 +0100 Subject: [PATCH] CI updates and minor cleanups --- .github/workflows/ci.yml | 4 +- .github/workflows/weekly-ci-cc-zigcc.yml | 4 +- NEWS | 4 +- src/Makefile | 2 +- src/check/dt_cxxlib.cpp | 47 +++++++++++++++++------- src/miniacc.h | 2 + src/pefile.h | 8 ++-- src/stub/tools/macho-snip/macho-snip.c | 2 + src/stub/tools/sstrip/sstrip.c | 2 + 9 files changed, 50 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f0492a1..645f9533 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ env: CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive UPX_CMAKE_BUILD_FLAGS: --verbose - # 2023-10-29 - ZIG_DIST_VERSION: 0.12.0-dev.1327+256ab68a9 + # 2023-10-30 + ZIG_DIST_VERSION: 0.12.0-dev.1349+fa022d1ec jobs: job-rebuild-and-verify-stubs: diff --git a/.github/workflows/weekly-ci-cc-zigcc.yml b/.github/workflows/weekly-ci-cc-zigcc.yml index b8e4525e..1d4ae9bd 100644 --- a/.github/workflows/weekly-ci-cc-zigcc.yml +++ b/.github/workflows/weekly-ci-cc-zigcc.yml @@ -11,8 +11,8 @@ env: CMAKE_REQUIRED_QUIET: "OFF" CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive - # 2023-10-29 - ZIG_DIST_VERSION: 0.12.0-dev.1327+256ab68a9 + # 2023-10-30 + ZIG_DIST_VERSION: 0.12.0-dev.1349+fa022d1ec jobs: job-linux-zigcc: # uses cmake + make diff --git a/NEWS b/NEWS index be8a3b54..e03212f7 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ User visible changes for UPX ================================================================== Changes in 4.2.1 (XX XXX XXXX): - * windows: use SetFileTime to preserve sub-second timestamps + * windows: use SetFileTime to preserve sub-second file timestamps * official Windows builds: revert activeCodePage change introduced in 4.2.0 * bug fixes - see https://github.com/upx/upx/milestone/14 @@ -12,8 +12,8 @@ Changes in 4.2.0 (26 Oct 2023): * unix: use utimensat to preserve sub-second file timestamps * new option '--link' to preserve hard-links (Unix only; use with care) * add support for NO_COLOR env var; see https://no-color.org/ - * official Windows builds: set activeCodePage to UTF-8 * disable macOS support until we fix compatibility with macOS 13+ + * official Windows builds: set activeCodePage to UTF-8 * bug fixes - see https://github.com/upx/upx/milestone/13 Changes in 4.1.0 (08 Aug 2023): diff --git a/src/Makefile b/src/Makefile index c786b75b..48820ce7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -96,7 +96,7 @@ ifeq ($(shell uname),Linux) CLANG_FORMAT_EXCLUDE_FILES += miniacc.h stub/%.h CLANG_FORMAT_EXCLUDE_FILES += p_elf.h p_elf_enum.h p_lx_% p_mach% p_unix% p_vmlin% CLANG_FORMAT_FILES := $(sort $(wildcard *.[ch]* ../maint/src/*.[ch]* */*.[ch]*)) -CLANG_FORMAT_FILES += stub/tools/armpe/armpe_tester.c +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) @echo "running upx-clang-format" diff --git a/src/check/dt_cxxlib.cpp b/src/check/dt_cxxlib.cpp index d11e998b..cbba0117 100644 --- a/src/check/dt_cxxlib.cpp +++ b/src/check/dt_cxxlib.cpp @@ -94,21 +94,40 @@ ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_le("abc", "abz")) TEST_CASE("ptr_reinterpret_cast") { // check that we don't trigger any -Wcast-align warnings using upx::ptr_reinterpret_cast; - byte *an = nullptr; - int *in = nullptr; - CHECK((an == ptr_reinterpret_cast(an))); - CHECK((an == ptr_reinterpret_cast(in))); - CHECK((in == ptr_reinterpret_cast(an))); - CHECK((in == ptr_reinterpret_cast(in))); - const byte *ac = nullptr; + void *vp = nullptr; + byte *bp = nullptr; + int *ip = nullptr; + double *dp = nullptr; + + CHECK((vp == ptr_reinterpret_cast(vp))); + CHECK((vp == ptr_reinterpret_cast(bp))); + CHECK((vp == ptr_reinterpret_cast(ip))); + CHECK((vp == ptr_reinterpret_cast(dp))); + + CHECK((bp == ptr_reinterpret_cast(vp))); + CHECK((bp == ptr_reinterpret_cast(bp))); + CHECK((bp == ptr_reinterpret_cast(ip))); + CHECK((bp == ptr_reinterpret_cast(dp))); + + CHECK((ip == ptr_reinterpret_cast(vp))); + CHECK((ip == ptr_reinterpret_cast(bp))); + CHECK((ip == ptr_reinterpret_cast(ip))); + CHECK((ip == ptr_reinterpret_cast(dp))); + + CHECK((dp == ptr_reinterpret_cast(vp))); + CHECK((dp == ptr_reinterpret_cast(bp))); + CHECK((dp == ptr_reinterpret_cast(ip))); + CHECK((dp == ptr_reinterpret_cast(dp))); + + const byte *bc = nullptr; const int *ic = nullptr; - CHECK((ac == ptr_reinterpret_cast(an))); - CHECK((ac == ptr_reinterpret_cast(ac))); - CHECK((ac == ptr_reinterpret_cast(in))); - CHECK((ac == ptr_reinterpret_cast(ic))); - CHECK((ic == ptr_reinterpret_cast(an))); - CHECK((ic == ptr_reinterpret_cast(ac))); - CHECK((ic == ptr_reinterpret_cast(in))); + CHECK((bc == ptr_reinterpret_cast(bp))); + CHECK((bc == ptr_reinterpret_cast(bc))); + CHECK((bc == ptr_reinterpret_cast(ip))); + CHECK((bc == ptr_reinterpret_cast(ic))); + CHECK((ic == ptr_reinterpret_cast(bp))); + CHECK((ic == ptr_reinterpret_cast(bc))); + CHECK((ic == ptr_reinterpret_cast(ip))); CHECK((ic == ptr_reinterpret_cast(ic))); } diff --git a/src/miniacc.h b/src/miniacc.h index d8716d31..c1d198bc 100644 --- a/src/miniacc.h +++ b/src/miniacc.h @@ -25,6 +25,8 @@ http://www.oberhumer.com/ */ +/* clang-format off */ + #ifndef __ACC_H_INCLUDED #define __ACC_H_INCLUDED 1 #define ACC_VERSION 20230625L diff --git a/src/pefile.h b/src/pefile.h index f4a47257..e12d53e9 100644 --- a/src/pefile.h +++ b/src/pefile.h @@ -356,7 +356,7 @@ protected: RT_LAST }; - class Interval : private noncopyable { + class Interval final : private noncopyable { unsigned capacity = 0; void *base = nullptr; public: @@ -382,7 +382,7 @@ protected: static int __acc_cdecl_qsort compare(const void *p1, const void *p2); }; - class Reloc : private noncopyable { + class Reloc final : private noncopyable { // these are set in constructor byte *start = nullptr; unsigned start_size_in_bytes = 0; @@ -418,7 +418,7 @@ protected: void finish(byte *(&result_ptr), unsigned &result_size); // => transfer ownership }; - class Resource : private noncopyable { + class Resource final : private noncopyable { struct res_dir_entry; struct res_dir; struct res_data; @@ -474,7 +474,7 @@ protected: */ }; - class Export : private noncopyable { + class Export final : private noncopyable { struct alignas(1) export_dir_t { byte _[12]; // flags, timedate, version LE32 name; diff --git a/src/stub/tools/macho-snip/macho-snip.c b/src/stub/tools/macho-snip/macho-snip.c index 169cf67b..d89d74a3 100644 --- a/src/stub/tools/macho-snip/macho-snip.c +++ b/src/stub/tools/macho-snip/macho-snip.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright 2022 BitWagon Software LLC. All rights reserved. +/* clang-format off */ + #include #include #include diff --git a/src/stub/tools/sstrip/sstrip.c b/src/stub/tools/sstrip/sstrip.c index 10b40a6b..9cf96aa4 100644 --- a/src/stub/tools/sstrip/sstrip.c +++ b/src/stub/tools/sstrip/sstrip.c @@ -1,5 +1,7 @@ /* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */ +/* clang-format off */ + /* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU * General Public License. No warranty. See COPYING for details. *