mirror of https://github.com/upx/upx.git
all: pacify clang-tidy, CI and cmake updates
This commit is contained in:
parent
be44cefbe7
commit
fdcdaf596a
|
@ -15,7 +15,7 @@ AttributeMacros:
|
||||||
- XSPAN_DELETED_FUNCTION
|
- XSPAN_DELETED_FUNCTION
|
||||||
- may_throw
|
- may_throw
|
||||||
EmptyLineBeforeAccessModifier: Leave
|
EmptyLineBeforeAccessModifier: Leave
|
||||||
# IndentPPDirectives: AfterHash # TODO
|
# IndentPPDirectives: AfterHash # TODO later
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
SpaceAfterCStyleCast: true
|
SpaceAfterCStyleCast: true
|
||||||
Standard: Cpp03
|
Standard: Cpp03
|
||||||
|
|
|
@ -191,8 +191,10 @@ jobs:
|
||||||
- { os: macos-11, gcc: gcc-10, gxx: 'g++-10', testsuite: true, ctest: true }
|
- { os: macos-11, gcc: gcc-10, gxx: 'g++-10', testsuite: true, ctest: true }
|
||||||
- { os: macos-12, gcc: gcc-11, gxx: 'g++-11', testsuite: true, ctest: true }
|
- { os: macos-12, gcc: gcc-11, gxx: 'g++-11', testsuite: true, ctest: true }
|
||||||
- { os: macos-13, gcc: gcc-12, gxx: 'g++-12', testsuite: true, xcode_version: 14.3.1 }
|
- { os: macos-13, gcc: gcc-12, gxx: 'g++-12', testsuite: true, xcode_version: 14.3.1 }
|
||||||
- { os: macos-13, testsuite: true } # use default Xcode-15.0
|
- { os: macos-13, testsuite: true } # use default Xcode-15
|
||||||
- { os: macos-14, testsuite: true }
|
# { os: macos-14, gcc: gcc-13, gxx: 'g++-13', testsuite: true } # gcc-13: INTERNAL ERROR in ld64
|
||||||
|
# { os: macos-14, gcc: gcc-13, gxx: 'g++-13', testsuite: true, xcode_version: 14.3.1 } # gcc-13: MISSING HEADER FILES
|
||||||
|
- { os: macos-14, gcc: gcc-12, gxx: 'g++-12', testsuite: true } # => use gcc-12 for now
|
||||||
env:
|
env:
|
||||||
UPX_CONFIG_EXPECT_THREADS: 'ON'
|
UPX_CONFIG_EXPECT_THREADS: 'ON'
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -256,7 +256,7 @@ if(Threads_FOUND)
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
|
||||||
try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
|
try_compile(result "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/try_compile/${f}"
|
"${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/try_compile/${f}"
|
||||||
OUTPUT_VARIABLE output)
|
CXX_STANDARD 17 OUTPUT_VARIABLE output)
|
||||||
if(NOT result)
|
if(NOT result)
|
||||||
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
|
# failed; under MinGW be sure to use the posix-threads and NOT the win32-threads version
|
||||||
#message(STATUS "Threads FAILED: ${output}") # debug output from try_compile
|
#message(STATUS "Threads FAILED: ${output}") # debug output from try_compile
|
||||||
|
@ -326,6 +326,7 @@ if(MSVC_FRONTEND)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
||||||
endif() # UPX_CONFIG_DISABLE_BZIP2
|
endif() # UPX_CONFIG_DISABLE_BZIP2
|
||||||
|
|
||||||
set(t upx_vendor_ucl)
|
set(t upx_vendor_ucl)
|
||||||
|
@ -337,6 +338,7 @@ if(MSVC_FRONTEND)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
||||||
|
|
||||||
set(t upx_vendor_zlib)
|
set(t upx_vendor_zlib)
|
||||||
upx_compile_target_debug_with_O2(${t})
|
upx_compile_target_debug_with_O2(${t})
|
||||||
|
@ -350,6 +352,7 @@ if(MSVC_FRONTEND)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} -Wno-cast-align -Wno-cast-qual ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} -Wno-cast-align -Wno-cast-qual ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
||||||
|
|
||||||
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
||||||
set(t upx_vendor_zstd)
|
set(t upx_vendor_zstd)
|
||||||
|
@ -361,6 +364,7 @@ if(MSVC_FRONTEND)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
||||||
endif() # UPX_CONFIG_DISABLE_ZSTD
|
endif() # UPX_CONFIG_DISABLE_ZSTD
|
||||||
|
|
||||||
set(t upx)
|
set(t upx)
|
||||||
|
@ -403,6 +407,7 @@ if(MSVC_FRONTEND)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
|
||||||
endif()
|
endif()
|
||||||
|
upx_add_target_extra_compile_options(${t} UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# test
|
# test
|
||||||
|
|
|
@ -197,6 +197,26 @@ function(upx_add_definitions) # ARGV; needs include(CheckCCompilerFlag)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(upx_add_target_extra_compile_options) # ARGV
|
||||||
|
set(t "${ARGV0}")
|
||||||
|
list(REMOVE_AT ARGV 0)
|
||||||
|
foreach(var_name ${ARGV})
|
||||||
|
if(NOT DEFINED ${var_name})
|
||||||
|
elseif(",${${var_name}}," STREQUAL ",,")
|
||||||
|
else()
|
||||||
|
set(flags "${${var_name}}")
|
||||||
|
if(NOT flags MATCHES ";") # NOTE: split into list from string only if not already a list
|
||||||
|
if(${CMAKE_VERSION} VERSION_GREATER "3.8.99")
|
||||||
|
separate_arguments(flags NATIVE_COMMAND "${flags}")
|
||||||
|
else()
|
||||||
|
separate_arguments(flags)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
target_compile_options(${t} PRIVATE "${flags}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# compile a target with -O2 optimization even in Debug build
|
# compile a target with -O2 optimization even in Debug build
|
||||||
function(upx_compile_target_debug_with_O2) # ARGV
|
function(upx_compile_target_debug_with_O2) # ARGV
|
||||||
foreach(t ${ARGV})
|
foreach(t ${ARGV})
|
||||||
|
|
|
@ -276,6 +276,12 @@ build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WSTRICT)
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_WERROR)
|
||||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_DISABLE_SELF_PACK_TEST)
|
||||||
|
# pass UPX extra compile options from environment/make to cmake; see CMakeLists.txt
|
||||||
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_BZIP2)
|
||||||
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UCL)
|
||||||
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_UPX)
|
||||||
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZLIB)
|
||||||
|
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,UPX_CONFIG_EXTRA_COMPILE_OPTIONS_ZSTD)
|
||||||
|
|
||||||
endif # GNU make bug work-around
|
endif # GNU make bug work-around
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
#
|
||||||
# valgrind suppressions for musl libc
|
# valgrind suppressions for musl libc
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
#
|
||||||
|
|
||||||
# musl malloc
|
# musl malloc
|
||||||
{
|
{
|
||||||
|
|
|
@ -261,8 +261,8 @@ struct Z2_X2 : public X2 {
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
TEST_CASE("Deleter") {
|
TEST_CASE("Deleter") {
|
||||||
LE16 *o = {}; // object
|
LE16 *o = nullptr; // object
|
||||||
LE32 *a = {}; // array
|
LE32 *a = nullptr; // array
|
||||||
{
|
{
|
||||||
const upx::ObjectDeleter<LE16 **> o_deleter{&o, 1};
|
const upx::ObjectDeleter<LE16 **> o_deleter{&o, 1};
|
||||||
o = new LE16;
|
o = new LE16;
|
||||||
|
|
|
@ -1239,6 +1239,7 @@ void PeFile::Export::build(char *newbase, unsigned newoffs) {
|
||||||
|
|
||||||
edir.addrtable = newoffs + ptr_diff_bytes(functionp, newbase);
|
edir.addrtable = newoffs + ptr_diff_bytes(functionp, newbase);
|
||||||
edir.ordinaltable = newoffs + ptr_diff_bytes(ordinalp, newbase);
|
edir.ordinaltable = newoffs + ptr_diff_bytes(ordinalp, newbase);
|
||||||
|
assert(ordinals != nullptr); // pacify clang-tidy
|
||||||
memcpy(ordinalp, ordinals, 2 * edir.names);
|
memcpy(ordinalp, ordinals, 2 * edir.names);
|
||||||
|
|
||||||
edir.name = newoffs + ptr_diff_bytes(enamep, newbase);
|
edir.name = newoffs + ptr_diff_bytes(enamep, newbase);
|
||||||
|
|
|
@ -179,7 +179,7 @@ forceinline Result ptr_static_cast(const From *ptr) noexcept {
|
||||||
return static_cast<Result>(static_cast<const void *>(ptr));
|
return static_cast<Result>(static_cast<const void *>(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper classes so we don't leak memory on exceptions
|
// helper classes so we don't leak memory on exceptions; NOT thread-safe
|
||||||
template <class T> // T is "Type **"
|
template <class T> // T is "Type **"
|
||||||
struct ObjectDeleter final {
|
struct ObjectDeleter final {
|
||||||
static_assert(std::is_pointer_v<T>);
|
static_assert(std::is_pointer_v<T>);
|
||||||
|
|
Loading…
Reference in New Issue