diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79f52659..52a7641e 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-30 - ZIG_DIST_VERSION: 0.12.0-dev.1350+91e117697 + # 2023-11-01 + ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c jobs: job-rebuild-and-verify-stubs: diff --git a/.github/workflows/misc-spell-check.yml b/.github/workflows/misc-spell-check.yml index feb729f2..ac473d16 100644 --- a/.github/workflows/misc-spell-check.yml +++ b/.github/workflows/misc-spell-check.yml @@ -17,5 +17,5 @@ jobs: uses: actions/checkout@v4 with: { submodules: false } - name: 'Spell check with crate-ci/typos' - uses: crate-ci/typos@c004e98018d8621614d1ca516eed8ca2d04b365a # v1.16.20 + uses: crate-ci/typos@47dd2976043bd5c76a33aa9300b328a176a1d6f7 # v1.16.21 with: { config: ./.github/typos_config.toml } diff --git a/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml b/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml index 52fbae18..3d510235 100644 --- a/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml +++ b/.github/workflows/weekly-ci-bs-cmake-windows-ninja.yml @@ -19,14 +19,15 @@ jobs: fail-fast: false matrix: include: - # cl (msvc) + # cl (MSVC) - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64 } - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_arm64 } - { os: windows-2019, cc: cl, cxx: cl, vsversion: 2019, arch: amd64_x86 } - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64 } - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_arm64 } - { os: windows-2022, cc: cl, cxx: cl, vsversion: 2022, arch: amd64_x86 } - # clang-cl + # clang-cl (from MSVC) + - { os: windows-2019, cc: clang-cl, cxx: clang-cl, vsversion: 2019, arch: amd64 } - { os: windows-2022, cc: clang-cl, cxx: clang-cl, vsversion: 2022, arch: amd64 } # clang - { os: windows-2022, cc: clang, cxx: 'clang++', arch: amd64, xflags: '-static' } diff --git a/.github/workflows/weekly-ci-bs-misc.yml b/.github/workflows/weekly-ci-bs-misc.yml new file mode 100644 index 00000000..df830fd9 --- /dev/null +++ b/.github/workflows/weekly-ci-bs-misc.yml @@ -0,0 +1,53 @@ +# Copyright (C) Markus Franz Xaver Johannes Oberhumer +# BS BuildSystem: build misc + +name: 'Weekly CI BS - Misc' +on: + schedule: [cron: '40 1 * * 3'] # run weekly Wednesday 01:50 UTC + workflow_dispatch: +env: + CMAKE_REQUIRED_QUIET: "OFF" + CTEST_OUTPUT_ON_FAILURE: "ON" + DEBIAN_FRONTEND: noninteractive + +jobs: + job-bs-misc: # uses cmake + make + if: github.repository_owner == 'upx' + strategy: + fail-fast: false + matrix: + container: + - 'alpine:3.18' + - 'i386/alpine:3.18' + cc: + - 'clang' + - 'gcc' + cppflags: + - '-DWITH_XSPAN=0' + - '-DWITH_XSPAN=1' + - '-DWITH_XSPAN=2' + - '-DDOCTEST_CONFIG_DISABLE' + runs-on: ubuntu-latest + container: ${{ matrix.container }} + steps: + - name: ${{ format('Install packages {0}', matrix.container) }} + run: 'apk update && apk upgrade && apk add clang cmake g++ git make' + - name: ${{ format('Check out UPX {0} source code', github.ref_name) }} + run: | + # this seems to be needed when running in a container (beause of UID mismatch??) + git config --global --add safe.directory '*' + git clone --branch "$GITHUB_REF_NAME" --depth 1 https://github.com/upx/upx . + git submodule update --init + # set environment + xflags="-static ${{ matrix.cppflags }}" + case ${{ matrix.cc }} in + clang) CC="clang $xflags"; CXX="clang++ $xflags" ;; + gcc) CC="gcc $xflags"; CXX="g++ $xflags" ;; + *) CC=false; CXX=false ;; + esac + echo -e "CC=$CC\nCXX=$CXX" >> $GITHUB_ENV + - name: 'Build Debug' + run: 'make debug && ctest --test-dir build/debug' + - name: 'Build Release' + if: success() || failure() # run this step even if the previous step failed + run: 'make release && ctest --test-dir build/debug' diff --git a/.github/workflows/weekly-ci-cc-zigcc.yml b/.github/workflows/weekly-ci-cc-zigcc.yml index 1bfa9add..b2b74806 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-30 - ZIG_DIST_VERSION: 0.12.0-dev.1350+91e117697 + # 2023-11-01 + ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c jobs: job-linux-zigcc: # uses cmake + make diff --git a/src/check/dt_cxxlib.cpp b/src/check/dt_cxxlib.cpp index 32180f00..d5bc2edd 100644 --- a/src/check/dt_cxxlib.cpp +++ b/src/check/dt_cxxlib.cpp @@ -99,36 +99,36 @@ TEST_CASE("ptr_reinterpret_cast") { 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))); + assert((vp == ptr_reinterpret_cast(vp))); + assert((vp == ptr_reinterpret_cast(bp))); + assert((vp == ptr_reinterpret_cast(ip))); + assert((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))); + assert((bp == ptr_reinterpret_cast(vp))); + assert((bp == ptr_reinterpret_cast(bp))); + assert((bp == ptr_reinterpret_cast(ip))); + assert((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))); + assert((ip == ptr_reinterpret_cast(vp))); + assert((ip == ptr_reinterpret_cast(bp))); + assert((ip == ptr_reinterpret_cast(ip))); + assert((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))); + assert((dp == ptr_reinterpret_cast(vp))); + assert((dp == ptr_reinterpret_cast(bp))); + assert((dp == ptr_reinterpret_cast(ip))); + assert((dp == ptr_reinterpret_cast(dp))); const byte *bc = nullptr; const int *ic = nullptr; - 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))); + assert((bc == ptr_reinterpret_cast(bp))); + assert((bc == ptr_reinterpret_cast(bc))); + assert((bc == ptr_reinterpret_cast(ip))); + assert((bc == ptr_reinterpret_cast(ic))); + assert((ic == ptr_reinterpret_cast(bp))); + assert((ic == ptr_reinterpret_cast(bc))); + assert((ic == ptr_reinterpret_cast(ip))); + assert((ic == ptr_reinterpret_cast(ic))); } TEST_CASE("noncopyable") { @@ -155,7 +155,7 @@ TEST_CASE("noncopyable") { namespace { template struct TestTriBool { - static void test(bool expect_true) noexcept { + static void test(bool expect_true) { static_assert(std::is_class::value); static_assert(std::is_nothrow_default_constructible::value); static_assert(std::is_nothrow_destructible::value); @@ -171,6 +171,7 @@ struct TestTriBool { #endif static_assert(!bool(T(false))); static_assert(bool(T(true))); + static_assert(bool(T(T::Third)) == T::is_third_true); static_assert(T(false) == T::False); static_assert(T(true) == T::True); static_assert(T(T::False) == T::False); @@ -190,64 +191,65 @@ struct TestTriBool { static_assert(array[2].isThird()); static_assert(sizeof(array) == 3 * sizeof(T)); T a; - CHECK(a.getValue() == T::False); - CHECK(!a); - CHECK(!bool(a)); - CHECK((!a ? true : false)); - CHECK(a.isStrictFalse()); - CHECK(!a.isStrictTrue()); - CHECK(a.isStrictBool()); - CHECK(!a.isThird()); + assert(a.getValue() == T::False); + assert(!a); + assert(!bool(a)); + assert((!a ? true : false)); + assert(a.isStrictFalse()); + assert(!a.isStrictTrue()); + assert(a.isStrictBool()); + assert(!a.isThird()); a = false; - CHECK(a.getValue() == T::False); - CHECK(!a); - CHECK(!bool(a)); - CHECK((!a ? true : false)); - CHECK(a.isStrictFalse()); - CHECK(!a.isStrictTrue()); - CHECK(a.isStrictBool()); - CHECK(!a.isThird()); + assert(a.getValue() == T::False); + assert(!a); + assert(!bool(a)); + assert((!a ? true : false)); + assert(a.isStrictFalse()); + assert(!a.isStrictTrue()); + assert(a.isStrictBool()); + assert(!a.isThird()); a = true; - CHECK(a.getValue() == T::True); - CHECK(a); - CHECK(bool(a)); - CHECK((a ? true : false)); - CHECK(!a.isStrictFalse()); - CHECK(a.isStrictTrue()); - CHECK(a.isStrictBool()); - CHECK(!a.isThird()); + assert(a.getValue() == T::True); + assert(a); + assert(bool(a)); + assert((a ? true : false)); + assert(!a.isStrictFalse()); + assert(a.isStrictTrue()); + assert(a.isStrictBool()); + assert(!a.isThird()); a = T::Third; - CHECK(a.getValue() == T::Third); + assert(a.getValue() == T::Third); + assert(T::is_third_true == expect_true); if (expect_true) { - CHECK(a); - CHECK(bool(a)); - CHECK((a ? true : false)); + assert(a); + assert(bool(a)); + assert((a ? true : false)); } else { - CHECK(!a); - CHECK(!bool(a)); - CHECK((!a ? true : false)); + assert(!a); + assert(!bool(a)); + assert((!a ? true : false)); } - CHECK(!a.isStrictFalse()); - CHECK(!a.isStrictTrue()); - CHECK(!a.isStrictBool()); - CHECK(a.isThird()); + assert(!a.isStrictFalse()); + assert(!a.isStrictTrue()); + assert(!a.isStrictBool()); + assert(a.isThird()); a = 99; - CHECK(a.getValue() == T::Third); + assert(a.getValue() == T::Third); if (expect_true) { - CHECK(a); - CHECK(bool(a)); - CHECK((a ? true : false)); + assert(a); + assert(bool(a)); + assert((a ? true : false)); } else { - CHECK(!a); - CHECK(!bool(a)); - CHECK((!a ? true : false)); + assert(!a); + assert(!bool(a)); + assert((!a ? true : false)); } - CHECK(!a.isStrictFalse()); - CHECK(!a.isStrictTrue()); - CHECK(!a.isStrictBool()); - CHECK(a.isThird()); + assert(!a.isStrictFalse()); + assert(!a.isStrictTrue()); + assert(!a.isStrictBool()); + assert(a.isThird()); mem_clear(&a); - CHECK(a.isStrictFalse()); + assert(a.isStrictFalse()); } }; } // namespace diff --git a/src/util/cxxlib.h b/src/util/cxxlib.h index 798528ee..5ebd26a4 100644 --- a/src/util/cxxlib.h +++ b/src/util/cxxlib.h @@ -114,6 +114,7 @@ constexpr bool string_ge(const char *a, const char *b) { return !string_lt(a, b) template // Third is false by default struct TriBool final { + static constexpr bool is_third_true = IsThirdTrue; // types typedef T underlying_type; static_assert(std::is_integral_v);