mirror of
https://github.com/upx/upx.git
synced 2024-11-23 04:39:59 +00:00
all: yet more minor cleanups
This commit is contained in:
parent
54d16a458a
commit
a21a006fe9
@ -3,7 +3,6 @@
|
||||
# for clang-format-15.0.6 from https://github.com/upx/upx-stubtools/releases
|
||||
#
|
||||
# "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." --Rob Pike
|
||||
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
ColumnLimit: 100
|
||||
|
@ -1,7 +1,6 @@
|
||||
# vim:set ft=yaml ts=2 sw=2 et:
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
# for clang-tidy-16 from https://clang.llvm.org/extra/clang-tidy/
|
||||
|
||||
---
|
||||
Checks: >
|
||||
-*,
|
||||
|
1
.clangd
1
.clangd
@ -1,7 +1,6 @@
|
||||
# vim:set ft=yaml ts=2 sw=2 et:
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
# for clangd-17 from https://clangd.llvm.org/
|
||||
|
||||
---
|
||||
# treat *.h files as C++ source code
|
||||
If:
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
# see https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
# see https://github.com/github-linguist/linguist
|
||||
#
|
||||
# HINT: check settings with
|
||||
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -218,9 +218,9 @@ jobs:
|
||||
if ! brew install coreutils; then brew update && brew install coreutils; fi
|
||||
fi
|
||||
case "${{ matrix.os }}" in
|
||||
macos-11 | macos-12) echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV ;;
|
||||
# FIXME: UPX on macos-13+ is broken => disable self-test for now
|
||||
macos-13 | macos-14) echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV ;;
|
||||
macos-11 | macos-12) echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV ;;
|
||||
# FIXME: UPX on macos-13+ is broken => disable self-test for now
|
||||
macos-13 | macos-14) echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV ;;
|
||||
esac
|
||||
- name: 'Check out code'
|
||||
uses: actions/checkout@v4
|
||||
|
40
misc/scripts/run_cmake_config.sh
Executable file
40
misc/scripts/run_cmake_config.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
# assemble cmake config flags; useful for CI jobs
|
||||
|
||||
cmake_config_flags=()
|
||||
|
||||
add_flag() {
|
||||
[[ -z "${!1}" ]] || cmake_config_flags+=( -D$1="${!1}" )
|
||||
}
|
||||
|
||||
# pass common CMake settings from environment to cmake
|
||||
for v in CMAKE_VERBOSE_MAKEFILE; do
|
||||
add_flag $v
|
||||
done
|
||||
# pass common CMake toolchain settings from environment to cmake
|
||||
for v in CMAKE_ADDR2LINE CMAKE_AR CMAKE_DLLTOOL CMAKE_LINKER CMAKE_NM CMAKE_OBJCOPY CMAKE_OBJDUMP CMAKE_RANLIB CMAKE_READELF CMAKE_STRIP CMAKE_TAPI; do
|
||||
add_flag $v
|
||||
done
|
||||
# pass common CMake LTO toolchain settings from environment to cmake (for use with "-flto")
|
||||
for v in CMAKE_C_COMPILER_AR CMAKE_C_COMPILER_RANLIB CMAKE_CXX_COMPILER_AR CMAKE_CXX_COMPILER_RANLIB; do
|
||||
add_flag $v
|
||||
done
|
||||
# pass common CMake cross compilation settings from environment to cmake
|
||||
for v in CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PROCESSOR CMAKE_CROSSCOMPILING_EMULATOR; do
|
||||
add_flag $v
|
||||
done
|
||||
# pass UPX config options from environment to cmake; see CMakeLists.txt
|
||||
for v in UPX_CONFIG_DISABLE_GITREV UPX_CONFIG_DISABLE_SANITIZE UPX_CONFIG_DISABLE_WSTRICT UPX_CONFIG_DISABLE_WERROR UPX_CONFIG_DISABLE_SELF_PACK_TEST; do
|
||||
add_flag $v
|
||||
done
|
||||
# pass UPX extra compile options from environment to cmake; see CMakeLists.txt
|
||||
for v in UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2 UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD; do
|
||||
add_flag $v
|
||||
done
|
||||
|
||||
exec "${CMAKE:-cmake}" $UPX_CMAKE_CONFIG_FLAGS "${cmake_config_flags[@]}" "$@"
|
||||
exit 99
|
@ -18,8 +18,9 @@ umask 0022
|
||||
|
||||
# disable on macOS for now, see https://github.com/upx/upx/issues/612
|
||||
if [[ "$(uname)" == Darwin ]]; then
|
||||
echo "$0: SKIPPED"
|
||||
exit 0
|
||||
case "$UPX_DEBUG_FORCE_PACK_MACOS" in
|
||||
"" | "0") echo "$0: SKIPPED"; exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
id || true
|
||||
|
@ -145,13 +145,13 @@ typedef acc_int64_t upx_int64_t;
|
||||
typedef acc_uint64_t upx_uint64_t;
|
||||
typedef acc_uintptr_t upx_uintptr_t;
|
||||
|
||||
// convention: use "byte" when dealing with data; use "char/uchar" when dealing
|
||||
// UPX convention: use "byte" when dealing with data; use "char/uchar" when dealing
|
||||
// with strings; use "upx_uint8_t" when dealing with small integers
|
||||
typedef unsigned char byte;
|
||||
#define upx_byte byte
|
||||
#define upx_bytep byte *
|
||||
typedef unsigned char uchar;
|
||||
// convention: use "charptr" when dealing with abstract pointer arithmetics
|
||||
// UPX convention: use "charptr" when dealing with abstract pointer arithmetics
|
||||
#define charptr upx_charptr_unit_type *
|
||||
// upx_charptr_unit_type is some opaque type with sizeof(type) == 1
|
||||
struct alignas(1) upx_charptr_unit_type final { char hidden__; };
|
||||
@ -192,7 +192,7 @@ typedef upx_int64_t upx_off_t;
|
||||
#define very_unlikely __acc_very_unlikely
|
||||
|
||||
// cosmetic: explicitly annotate some functions which may throw exceptions
|
||||
// note: noexcept(false) is the default for all C++ functions anyway
|
||||
// note: noexcept(false) is the default for all C++ functions anyway
|
||||
#define may_throw noexcept(false)
|
||||
|
||||
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
|
||||
@ -230,6 +230,7 @@ typedef upx_int64_t upx_off_t;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DUP) && (HAVE_DUP + 0 == 0)
|
||||
// TODO later: add upx_fd_dup() util
|
||||
#undef dup
|
||||
#define dup(x) (-1)
|
||||
#endif
|
||||
|
@ -62,12 +62,12 @@
|
||||
#endif
|
||||
|
||||
// sanity checks
|
||||
#if defined(__ILP32) || defined(__ILP32__)
|
||||
#if defined(_ILP32) || defined(__ILP32) || defined(__ILP32__)
|
||||
static_assert(sizeof(int) == 4);
|
||||
static_assert(sizeof(long) == 4);
|
||||
static_assert(sizeof(void *) == 4);
|
||||
#endif
|
||||
#if defined(__LP64) || defined(__LP64__)
|
||||
#if defined(_LP64) || defined(__LP64) || defined(__LP64__)
|
||||
static_assert(sizeof(int) == 4);
|
||||
static_assert(sizeof(long) == 8);
|
||||
static_assert(sizeof(void *) == 8);
|
||||
@ -153,13 +153,6 @@ static_assert(sizeof(void *) == sizeof(long));
|
||||
|
||||
// UPX vendor git submodule headers
|
||||
#include <doctest/doctest/parts/doctest_fwd.h>
|
||||
#if WITH_BOOST_PFR
|
||||
#include <sstream>
|
||||
#include <boost/pfr/io.hpp>
|
||||
#endif
|
||||
#if WITH_RANGELESS_FN
|
||||
#include <rangeless/include/fn.hpp>
|
||||
#endif
|
||||
#ifndef WITH_VALGRIND
|
||||
#define WITH_VALGRIND 1
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user