From a692c0136c0edeca6adc265437f04a43b43d6373 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Wed, 5 Feb 2025 00:21:23 +0000 Subject: [PATCH] wip --- .github/toolchains/loongarch64.cmake | 4 +- .github/workflows-in/clang_tidy.ys | 3 +- .github/workflows-in/gcc.ys | 75 +++---- .github/workflows-in/release.ys | 7 +- .github/workflows-in/windows.ys | 2 +- .github/workflows/arch.yml | 2 + .github/workflows/clang_tidy.yml | 4 + .github/workflows/gcc.yml | 289 ++++++++++++++++++--------- .github/workflows/release.yml | 21 +- .github/workflows/windows.yml | 2 +- src/c4/charconv.hpp | 15 +- src/c4/dump.hpp | 3 +- 12 files changed, 281 insertions(+), 146 deletions(-) diff --git a/.github/toolchains/loongarch64.cmake b/.github/toolchains/loongarch64.cmake index 9775efe3..d97004d8 100644 --- a/.github/toolchains/loongarch64.cmake +++ b/.github/toolchains/loongarch64.cmake @@ -3,8 +3,8 @@ set(CMAKE_SYSTEM_PROCESSOR loongarch64) set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_C_COMPILER /usr/bin/loongarch64-linux-gnu-gcc) -set(CMAKE_CXX_COMPILER /usr/bin/loongarch64-linux-gnu-g++) +set(CMAKE_C_COMPILER /usr/bin/loongarch64-linux-gnu-gcc-14) +set(CMAKE_CXX_COMPILER /usr/bin/loongarch64-linux-gnu-g++-14) set(CMAKE_FIND_ROOT_PATH /usr/loongarch64-linux-gnu/) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/.github/workflows-in/clang_tidy.ys b/.github/workflows-in/clang_tidy.ys index bd5e6ae7..081b4e81 100644 --- a/.github/workflows-in/clang_tidy.ys +++ b/.github/workflows-in/clang_tidy.ys @@ -11,7 +11,8 @@ jobs: fail-fast: false matrix: include: - - {std: 11, clang: 18, bt: Debug, bits: 64} + - {std: 11, clang: 18, bt: Debug , bits: 64} + - {std: 11, clang: 18, bt: Release, bits: 64} env:: load('share/env.yaml') steps: - :: checkout-action-docker diff --git a/.github/workflows-in/gcc.ys b/.github/workflows-in/gcc.ys index 65ac0f59..33f0e1bc 100644 --- a/.github/workflows-in/gcc.ys +++ b/.github/workflows-in/gcc.ys @@ -53,50 +53,55 @@ jobs: #---------------------------------------------------------------------------- extended: :: setup-job("gcc" "canary") - name: extended/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}/vg${{matrix.vg}} + name: extended/${{matrix.cxx}}/${{matrix.bits}}bit/c++${{matrix.std}}/vg${{matrix.vg}} :: runs-on-docker-c4core('${{matrix.img}}') strategy: fail-fast: false matrix: include: - # VALGRIND - - {std: 11, cxx: g++-14 , bt: Debug , vg: ON , img: 22.04} - - {std: 11, cxx: g++-14 , bt: Release, vg: ON , img: 22.04} - - {std: 14, cxx: g++-14 , bt: Debug , vg: ON , img: 22.04} - - {std: 14, cxx: g++-14 , bt: Release, vg: ON , img: 22.04} - - {std: 17, cxx: g++-14 , bt: Debug , vg: ON , img: 22.04} - - {std: 17, cxx: g++-14 , bt: Release, vg: ON , img: 22.04} - - {std: 20, cxx: g++-14 , bt: Debug , vg: ON , img: 22.04} - - {std: 20, cxx: g++-14 , bt: Release, vg: ON , img: 22.04} - # - - {std: 11, cxx: g++-13 , bt: Debug , vg: OFF, img: 22.04} - - {std: 11, cxx: g++-13 , bt: Release, vg: OFF, img: 22.04} - - {std: 11, cxx: g++-13 , bt: Debug , vg: OFF, img: 22.04} - - {std: 11, cxx: g++-13 , bt: Release, vg: OFF, img: 22.04} - - {std: 11, cxx: g++-11 , bt: Debug , vg: OFF, img: 22.04} - - {std: 11, cxx: g++-11 , bt: Release, vg: OFF, img: 22.04} - - {std: 11, cxx: g++-10 , bt: Debug , vg: OFF, img: 22.04} - - {std: 11, cxx: g++-10 , bt: Release, vg: OFF, img: 22.04} - - {std: 11, cxx: g++-9 , bt: Debug , vg: OFF, img: 22.04} - - {std: 11, cxx: g++-9 , bt: Release, vg: OFF, img: 22.04} - - {std: 11, cxx: g++-8 , bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-8 , bt: Release, vg: OFF, img: 18.04} - - {std: 11, cxx: g++-7 , bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-7 , bt: Release, vg: OFF, img: 18.04} - - {std: 11, cxx: g++-6 , bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-6 , bt: Release, vg: OFF, img: 18.04} - - {std: 11, cxx: g++-5 , bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-5 , bt: Release, vg: OFF, img: 18.04} - - {std: 11, cxx: g++-4.9, bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-4.9, bt: Release, vg: OFF, img: 18.04} - - {std: 11, cxx: g++-4.8, bt: Debug , vg: OFF, img: 18.04} - - {std: 11, cxx: g++-4.8, bt: Release, vg: OFF, img: 18.04} + # with valgrind: only latest gcc + # VALGRIND + - {std: 11, cxx: 14 , bits: 64, vg: ON , img: 22.04} + - {std: 11, cxx: 14 , bits: 32, vg: ON , img: 22.04} + - {std: 14, cxx: 14 , bits: 64, vg: ON , img: 22.04} + - {std: 14, cxx: 14 , bits: 32, vg: ON , img: 22.04} + - {std: 17, cxx: 14 , bits: 64, vg: ON , img: 22.04} + - {std: 17, cxx: 14 , bits: 32, vg: ON , img: 22.04} + - {std: 20, cxx: 14 , bits: 64, vg: ON , img: 22.04} + - {std: 20, cxx: 14 , bits: 32, vg: ON , img: 22.04} + # without valgrind + - {std: 11, cxx: 13 , bits: 64, vg: OFF, img: 22.04} + - {std: 11, cxx: 13 , bits: 32, vg: OFF, img: 22.04} + - {std: 11, cxx: 13 , bits: 64, vg: OFF, img: 22.04} + - {std: 11, cxx: 13 , bits: 32, vg: OFF, img: 22.04} + - {std: 11, cxx: 11 , bits: 64, vg: OFF, img: 22.04} + - {std: 11, cxx: 11 , bits: 32, vg: OFF, img: 22.04, extra_flags: -Wno-stringop-overflow} + - {std: 11, cxx: 10 , bits: 64, vg: OFF, img: 22.04} + - {std: 11, cxx: 10 , bits: 32, vg: OFF, img: 22.04} + - {std: 11, cxx: 9 , bits: 64, vg: OFF, img: 22.04} + - {std: 11, cxx: 9 , bits: 32, vg: OFF, img: 22.04} + - {std: 11, cxx: 8 , bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 8 , bits: 32, vg: OFF, img: 18.04} + - {std: 11, cxx: 7 , bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 7 , bits: 32, vg: OFF, img: 18.04} + - {std: 11, cxx: 6 , bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 6 , bits: 32, vg: OFF, img: 18.04} + - {std: 11, cxx: 5 , bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 5 , bits: 32, vg: OFF, img: 18.04} + - {std: 11, cxx: 4.9, bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 4.9, bits: 32, vg: OFF, img: 18.04} + - {std: 11, cxx: 4.8, bits: 64, vg: OFF, img: 18.04} + - {std: 11, cxx: 4.8, bits: 32, vg: OFF, img: 18.04} env:: load('share/env.yaml') steps: - :: checkout-manual - name: install - run: c4core-install ${{matrix.cxx}} - - :: run-steps + run: c4core-install g++-${{matrix.cxx}} + - :: run-gcc-manual-with-flags('Debug' '-m${{matrix.bits}} ${{matrix.extra_flags}}') + - :: run-gcc-manual-with-flags('Release' '-O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}') + - :: run-gcc-manual-with-flags('Release' '-O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}') + - :: run-gcc-manual-with-flags('Release' '-O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}') + - :: run-gcc-manual-with-flags('Release' '-Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}') #---------------------------------------------------------------------------- gccsan: diff --git a/.github/workflows-in/release.ys b/.github/workflows-in/release.ys index 5642d00b..926f1b1a 100644 --- a/.github/workflows-in/release.ys +++ b/.github/workflows-in/release.ys @@ -61,8 +61,11 @@ jobs: fail-fast: false matrix: config: - # name of the artifact | suffix (gen) | suffix (package) | cpack gen | mime type | os | cxx + # name of the artifact | suffix (gen) | suffix (package) | cpack gen | mime type | os | cxx + - {name: Ubuntu 24.04 deb , sfxg: unix64-shared-Release.deb, sfxp: ubuntu-24.04.deb , gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-24.04 } + - {name: Ubuntu 22.04 deb , sfxg: unix64-shared-Release.deb, sfxp: ubuntu-22.04.deb , gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-22.04 } - {name: Ubuntu 20.04 deb , sfxg: unix64-shared-Release.deb, sfxp: ubuntu-20.04.deb , gen: DEB , mime: vnd.debian.binary-package, os: ubuntu-20.04 } + - {name: Windows VS2022 zip, sfxg: win64-shared-Release.zip , sfxp: windows-vs2022.zip , gen: ZIP , mime: zip , os: windows-2022, cxx: vs2022} - {name: Windows VS2019 zip, sfxg: win64-shared-Release.zip , sfxp: windows-vs2019.zip , gen: ZIP , mime: zip , os: windows-2019, cxx: vs2019} - {name: MacOSX sh , sfxg: apple64-shared-Release.sh, sfxp: macosx-xcode.sh , gen: STGZ , mime: x-sh , os: macos-13 , cxx: xcode } steps: @@ -86,7 +89,7 @@ jobs: cp -fav $asset_src $asset_dst - name: Save artifacts uses: actions/upload-artifact@v4 - with: {name: assets-cpp, path: assets} + with: {name: "assets-cpp-${{matrix.os}}-${{matrix.cxx}}", path: assets} #---------------------------------------------------------------------------- merge_artifacts: diff --git a/.github/workflows-in/windows.ys b/.github/workflows-in/windows.ys index a88a2fd6..a3926723 100644 --- a/.github/workflows-in/windows.ys +++ b/.github/workflows-in/windows.ys @@ -58,7 +58,7 @@ jobs: - {std: 20, cxx: vs2022, bt: Release, os: windows-2022, bitlinks: shared64 static32} # https://learn.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-170 # https://learn.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information?view=msvc-170 - env: {CXXFLAGS: "/EHa- /EHs- /EHc /EHr- /GR- /wd4530", STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"} + env: {CXXFLAGS: "/EHa- /EHs- /EHc /EHr- /GR- /wd4530 /wd9002 /wd9025", STD: "${{matrix.std}}", CXX_: "${{matrix.cxx}}", BT: "${{matrix.bt}}", BITLINKS: "${{matrix.bitlinks}}", VG: "${{matrix.vg}}", SAN: "${{matrix.san}}", LINT: "${{matrix.lint}}", OS: "${{matrix.os}}"} steps: - :: checkout-action - {name: install requirements, run: source .github/reqs.sh && c4_install_test_requirements $OS} diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml index 9be6498c..d05bbb68 100644 --- a/.github/workflows/arch.yml +++ b/.github/workflows/arch.yml @@ -42,6 +42,8 @@ jobs: - arch: armv4 tc: arm-linux-gnueabi flags: -march=armv4 + - arch: loongarch64 + tc: 14-loongarch64-linux-gnu - arch: mips tc: mips-linux-gnu - arch: mipsel diff --git a/.github/workflows/clang_tidy.yml b/.github/workflows/clang_tidy.yml index 68c094f2..e500af60 100644 --- a/.github/workflows/clang_tidy.yml +++ b/.github/workflows/clang_tidy.yml @@ -33,6 +33,10 @@ jobs: clang: 18 bt: Debug bits: 64 + - std: 11 + clang: 18 + bt: Release + bits: 64 env: STD: ${{matrix.std}} CXX_: ${{matrix.cxx}} diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 67135461..4e980184 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -290,7 +290,7 @@ jobs: extended: if: always() continue-on-error: false - name: extended/${{matrix.cxx}}/c++${{matrix.std}}/${{matrix.bt}}/vg${{matrix.vg}} + name: extended/${{matrix.cxx}}/${{matrix.bits}}bit/c++${{matrix.std}}/vg${{matrix.vg}} runs-on: ubuntu-24.04 container: ghcr.io/biojppm/c4core/ubuntu${{matrix.img}}:latest strategy: @@ -298,153 +298,154 @@ jobs: matrix: include: - std: 11 - cxx: g++-14 - bt: Debug + cxx: 14 + bits: 64 vg: 'ON' img: 22.04 - std: 11 - cxx: g++-14 - bt: Release + cxx: 14 + bits: 32 vg: 'ON' img: 22.04 - std: 14 - cxx: g++-14 - bt: Debug + cxx: 14 + bits: 64 vg: 'ON' img: 22.04 - std: 14 - cxx: g++-14 - bt: Release + cxx: 14 + bits: 32 vg: 'ON' img: 22.04 - std: 17 - cxx: g++-14 - bt: Debug + cxx: 14 + bits: 64 vg: 'ON' img: 22.04 - std: 17 - cxx: g++-14 - bt: Release + cxx: 14 + bits: 32 vg: 'ON' img: 22.04 - std: 20 - cxx: g++-14 - bt: Debug + cxx: 14 + bits: 64 vg: 'ON' img: 22.04 - std: 20 - cxx: g++-14 - bt: Release + cxx: 14 + bits: 32 vg: 'ON' img: 22.04 - std: 11 - cxx: g++-13 - bt: Debug + cxx: 13 + bits: 64 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-13 - bt: Release + cxx: 13 + bits: 32 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-13 - bt: Debug + cxx: 13 + bits: 64 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-13 - bt: Release + cxx: 13 + bits: 32 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-11 - bt: Debug + cxx: 11 + bits: 64 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-11 - bt: Release + cxx: 11 + bits: 32 vg: 'OFF' img: 22.04 + extra_flags: -Wno-stringop-overflow - std: 11 - cxx: g++-10 - bt: Debug + cxx: 10 + bits: 64 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-10 - bt: Release + cxx: 10 + bits: 32 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-9 - bt: Debug + cxx: 9 + bits: 64 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-9 - bt: Release + cxx: 9 + bits: 32 vg: 'OFF' img: 22.04 - std: 11 - cxx: g++-8 - bt: Debug + cxx: 8 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-8 - bt: Release + cxx: 8 + bits: 32 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-7 - bt: Debug + cxx: 7 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-7 - bt: Release + cxx: 7 + bits: 32 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-6 - bt: Debug + cxx: 6 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-6 - bt: Release + cxx: 6 + bits: 32 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-5 - bt: Debug + cxx: 5 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-5 - bt: Release + cxx: 5 + bits: 32 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-4.9 - bt: Debug + cxx: 4.9 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-4.9 - bt: Release + cxx: 4.9 + bits: 32 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-4.8 - bt: Debug + cxx: 4.8 + bits: 64 vg: 'OFF' img: 18.04 - std: 11 - cxx: g++-4.8 - bt: Release + cxx: 4.8 + bits: 32 vg: 'OFF' img: 18.04 env: @@ -506,41 +507,137 @@ jobs: # show the last commit git log --name-status HEAD^..HEAD - name: install - run: c4core-install ${{matrix.cxx}} - - name: show info - run: source .github/setenv.sh && c4_show_info - - name: shared64-configure--------------------------------------------------- - run: source .github/setenv.sh && c4_cfg_test shared64 - - name: shared64-build - run: source .github/setenv.sh && c4_build_test shared64 - - name: shared64-run - run: source .github/setenv.sh && c4_run_test shared64 - - name: shared64-pack - run: source .github/setenv.sh && c4_package shared64 - - name: static64-configure--------------------------------------------------- - run: source .github/setenv.sh && c4_cfg_test static64 - - name: static64-build - run: source .github/setenv.sh && c4_build_test static64 - - name: static64-run - run: source .github/setenv.sh && c4_run_test static64 - - name: static64-pack - run: source .github/setenv.sh && c4_package static64 - - name: static32-configure--------------------------------------------------- - run: source .github/setenv.sh && c4_cfg_test static32 - - name: static32-build - run: source .github/setenv.sh && c4_build_test static32 - - name: static32-run - run: source .github/setenv.sh && c4_run_test static32 - - name: static32-pack - run: source .github/setenv.sh && c4_package static32 - - name: shared32-configure--------------------------------------------------- - run: source .github/setenv.sh && c4_cfg_test shared32 - - name: shared32-build - run: source .github/setenv.sh && c4_build_test shared32 - - name: shared32-run - run: source .github/setenv.sh && c4_run_test shared32 - - name: shared32-pack - run: source .github/setenv.sh && c4_package shared32 + run: c4core-install g++-${{matrix.cxx}} + - name: '---------------------------------------------------------' + run: | + echo "Debug ::: -m${{matrix.bits}} ${{matrix.extra_flags}}" + - name: 'configure Debug ::: -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + rm -rf build/Debug + export C4_EXTERN_DIR=`pwd`/build/extern + cmake -S . -B build/Debug \ + -DCMAKE_CXX_COMPILER=g++-${{matrix.cxx}} \ + -DCMAKE_C_COMPILER=gcc-${{matrix.cxx}} \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS_DEBUG="-m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DCMAKE_C_FLAGS_DEBUG="-m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DC4_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_BUILD_TESTS=ON \ + -DC4CORE_VALGRIND=${{matrix.vg}} \ + -DC4CORE_DEV=ON \ + -DC4CORE_BUILD_BENCHMARKS=OFF \ + -DC4CORE_DBG=OFF + - name: 'build Debug ::: -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Debug --target c4core-test-build --parallel --verbose + - name: 'run Debug ::: -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Debug --target c4core-test-run + - name: '---------------------------------------------------------' + run: | + echo "Release ::: -O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" + - name: 'configure Release ::: -O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + rm -rf build/Release + export C4_EXTERN_DIR=`pwd`/build/extern + cmake -S . -B build/Release \ + -DCMAKE_CXX_COMPILER=g++-${{matrix.cxx}} \ + -DCMAKE_C_COMPILER=gcc-${{matrix.cxx}} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DCMAKE_C_FLAGS_RELEASE="-O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DC4_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_BUILD_TESTS=ON \ + -DC4CORE_VALGRIND=${{matrix.vg}} \ + -DC4CORE_DEV=ON \ + -DC4CORE_BUILD_BENCHMARKS=OFF \ + -DC4CORE_DBG=OFF + - name: 'build Release ::: -O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-build --parallel --verbose + - name: 'run Release ::: -O1 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-run + - name: '---------------------------------------------------------' + run: | + echo "Release ::: -O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" + - name: 'configure Release ::: -O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + rm -rf build/Release + export C4_EXTERN_DIR=`pwd`/build/extern + cmake -S . -B build/Release \ + -DCMAKE_CXX_COMPILER=g++-${{matrix.cxx}} \ + -DCMAKE_C_COMPILER=gcc-${{matrix.cxx}} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DCMAKE_C_FLAGS_RELEASE="-O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DC4_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_BUILD_TESTS=ON \ + -DC4CORE_VALGRIND=${{matrix.vg}} \ + -DC4CORE_DEV=ON \ + -DC4CORE_BUILD_BENCHMARKS=OFF \ + -DC4CORE_DBG=OFF + - name: 'build Release ::: -O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-build --parallel --verbose + - name: 'run Release ::: -O2 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-run + - name: '---------------------------------------------------------' + run: | + echo "Release ::: -O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" + - name: 'configure Release ::: -O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + rm -rf build/Release + export C4_EXTERN_DIR=`pwd`/build/extern + cmake -S . -B build/Release \ + -DCMAKE_CXX_COMPILER=g++-${{matrix.cxx}} \ + -DCMAKE_C_COMPILER=gcc-${{matrix.cxx}} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DCMAKE_C_FLAGS_RELEASE="-O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DC4_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_BUILD_TESTS=ON \ + -DC4CORE_VALGRIND=${{matrix.vg}} \ + -DC4CORE_DEV=ON \ + -DC4CORE_BUILD_BENCHMARKS=OFF \ + -DC4CORE_DBG=OFF + - name: 'build Release ::: -O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-build --parallel --verbose + - name: 'run Release ::: -O3 -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-run + - name: '---------------------------------------------------------' + run: | + echo "Release ::: -Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" + - name: 'configure Release ::: -Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + rm -rf build/Release + export C4_EXTERN_DIR=`pwd`/build/extern + cmake -S . -B build/Release \ + -DCMAKE_CXX_COMPILER=g++-${{matrix.cxx}} \ + -DCMAKE_C_COMPILER=gcc-${{matrix.cxx}} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS_RELEASE="-Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DCMAKE_C_FLAGS_RELEASE="-Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}" \ + -DC4_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_CXX_STANDARD=${{matrix.std}} \ + -DC4CORE_BUILD_TESTS=ON \ + -DC4CORE_VALGRIND=${{matrix.vg}} \ + -DC4CORE_DEV=ON \ + -DC4CORE_BUILD_BENCHMARKS=OFF \ + -DC4CORE_DBG=OFF + - name: 'build Release ::: -Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-build --parallel --verbose + - name: 'run Release ::: -Os -DNDEBUG -m${{matrix.bits}} ${{matrix.extra_flags}}' + run: | + cmake --build build/Release --target c4core-test-run gccsan: if: always() continue-on-error: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41d293cb..c6c83c70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,12 +161,31 @@ jobs: fail-fast: false matrix: config: + - name: Ubuntu 24.04 deb + sfxg: unix64-shared-Release.deb + sfxp: ubuntu-24.04.deb + gen: DEB + mime: vnd.debian.binary-package + os: ubuntu-24.04 + - name: Ubuntu 22.04 deb + sfxg: unix64-shared-Release.deb + sfxp: ubuntu-22.04.deb + gen: DEB + mime: vnd.debian.binary-package + os: ubuntu-22.04 - name: Ubuntu 20.04 deb sfxg: unix64-shared-Release.deb sfxp: ubuntu-20.04.deb gen: DEB mime: vnd.debian.binary-package os: ubuntu-20.04 + - name: Windows VS2022 zip + sfxg: win64-shared-Release.zip + sfxp: windows-vs2022.zip + gen: ZIP + mime: zip + os: windows-2022 + cxx: vs2022 - name: Windows VS2019 zip sfxg: win64-shared-Release.zip sfxp: windows-vs2019.zip @@ -232,7 +251,7 @@ jobs: - name: Save artifacts uses: actions/upload-artifact@v4 with: - name: assets-cpp + name: assets-cpp-${{matrix.os}}-${{matrix.cxx}} path: assets merge_artifacts: if: always() diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 05fe8cb3..ee8f541f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -179,7 +179,7 @@ jobs: os: windows-2022 bitlinks: shared64 static32 env: - CXXFLAGS: /EHa- /EHs- /EHc /EHr- /GR- /wd4530 + CXXFLAGS: /EHa- /EHs- /EHc /EHr- /GR- /wd4530 /wd9002 /wd9025 STD: ${{matrix.std}} CXX_: ${{matrix.cxx}} BT: ${{matrix.bt}} diff --git a/src/c4/charconv.hpp b/src/c4/charconv.hpp index c29fe2d6..f564266a 100644 --- a/src/c4/charconv.hpp +++ b/src/c4/charconv.hpp @@ -377,7 +377,7 @@ template<> struct charconv_digits_<4u, false> // uint32_t static constexpr csubstr max_value_dec() noexcept { return csubstr("4294967295"); } static constexpr bool is_oct_overflow(csubstr str) noexcept { return !((str.len < 11) || (str.len == 11 && str[0] <= '3')); } }; -template<> struct charconv_digits_<8u, true> // int32_t +template<> struct charconv_digits_<8u, true> // int64_t { enum : size_t { maxdigits_bin = 1 + 2 + 64, // len=67: -9223372036854775808 -0b1000000000000000000000000000000000000000000000000000000000000000 @@ -396,7 +396,7 @@ template<> struct charconv_digits_<8u, true> // int32_t static constexpr csubstr max_value_dec() noexcept { return csubstr("9223372036854775807"); } static constexpr bool is_oct_overflow(csubstr str) noexcept { return !((str.len < 22)); } }; -template<> struct charconv_digits_<8u, false> +template<> struct charconv_digits_<8u, false> // uint64_t { enum : size_t { maxdigits_bin = 2 + 64, // len=66: 18446744073709551615 0b1111111111111111111111111111111111111111111111111111111111111111 @@ -783,15 +783,18 @@ template writer> size_t write_num_digits(substr buf, T v, size_t num_digits) noexcept { C4_STATIC_ASSERT(std::is_integral::value); - size_t ret = writer(buf, v); + const size_t ret = writer(buf, v); if(ret >= num_digits) return ret; else if(ret >= buf.len || num_digits > buf.len) return num_digits; C4_ASSERT(num_digits >= ret); - size_t delta = static_cast(num_digits - ret); // NOLINT - memmove(buf.str + delta, buf.str, ret); - memset(buf.str, '0', delta); + const size_t delta = static_cast(num_digits - ret); // NOLINT + C4_ASSERT(ret + delta <= buf.len); + if(ret) + memmove(buf.str + delta, buf.str, ret); + if(delta) + memset(buf.str, '0', delta); return num_digits; } } // namespace detail diff --git a/src/c4/dump.hpp b/src/c4/dump.hpp index 454a37be..526cff1b 100644 --- a/src/c4/dump.hpp +++ b/src/c4/dump.hpp @@ -19,6 +19,7 @@ * subsequent attempt to call. An analog of resuming type will only * ever dump as-yet-undumped arguments, through the use of @ref * DumpResults return type. */ + namespace c4 { C4_SUPPRESS_WARNING_GCC_CLANG_WITH_PUSH("-Wold-style-cast") @@ -319,7 +320,7 @@ C4_ALWAYS_INLINE DumpResults cat_dump_resume(size_t, DumpResults results, substr // terminates the variadic recursion template -C4_ALWAYS_INLINE DumpResults cat_dump_resume(size_t, SinkFn &&, DumpResults results, substr) +C4_ALWAYS_INLINE DumpResults cat_dump_resume(size_t, SinkFn &&, DumpResults results, substr) // NOLINT { return results; }