From ee4a53dcfb4d755e1696e9206c4c52c05225f090 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:01:01 -0700 Subject: [PATCH 1/7] add fil-c build action to ci --- .github/workflows/filc_build.yml | 73 ++++++++++++++++++++++++++++++++ CMakePresets.json | 16 +++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/filc_build.yml diff --git a/.github/workflows/filc_build.yml b/.github/workflows/filc_build.yml new file mode 100644 index 000000000..77283f162 --- /dev/null +++ b/.github/workflows/filc_build.yml @@ -0,0 +1,73 @@ +name: fil-c-build + +on: + pull_request: + workflow_dispatch: + +jobs: + check-diff: + runs-on: ubuntu-latest + outputs: + handle: ${{ steps.check.outputs.run }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 2 + + - name: Check the diff + id: check + run: | + echo "Here are the changed build/C files:" + echo "$(git --no-pager diff --name-only HEAD HEAD~1 | grep -E '\.(c|h)$|\.cmake|CMakeLists|Config\.cmake\.in')" + if git diff --name-only HEAD HEAD~1 | grep -qE '\.(c|h)$|\.cmake|CMakeLists|Config\.cmake\.in'; then + echo "run=true" >> $GITHUB_OUTPUT + echo "Implementation and/or build files have changed, rebuilding..." + else + echo "run=false" >> $GITHUB_OUTPUT + echo "Implementation and/or build files have NOT changed, skipping build..." + fi + + build: + runs-on: ubuntu-latest + name: Fil-C Build ${{ matrix.build == 'debug' && 'Debug' || 'Release' }} - ${{ matrix.portable == 'ON' && 'Portable SIMD Flat Hash Map' || 'Platform SIMD Flat Hash Map' }} + needs: check-diff + if: ${{ needs.check-diff.outputs.handle == 'true' }} + + strategy: + matrix: + build: [debug, release] + portable: [OFF, ON] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download & Install Fil-C + run: | + # Download the latest standalone Fil-C release asset via GitHub CLI + gh release download --repo pizlonator/fil-c --pattern 'filc-*-linux-x86_64.tar.xz' --clobber + + # Extract and run Fil-C setup script + mkdir -p ~/filc + tar -xf filc-*-linux-x86_64.tar.xz -C ~/filc --strip-components=1 + cd ~/filc && ./setup.sh + + # Add filcc binaries to GITHUB_PATH + echo "$HOME/filc/bin" >> $GITHUB_PATH + env: + GH_TOKEN: ${{ github.token }} + + - uses: lukka/get-cmake@latest + + - name: Build and Run Tests with Fil-C + run: | + make clean || true + cmake --preset=filc-${{ matrix.build }} \ + -DCCC_BUILD_SPECIALIZED=ON \ + -DCCC_FLAT_HASH_MAP_PORTABLE=${{ matrix.portable }} && \ + cmake --build build -j$(nproc) --target ccc tests + + make test diff --git a/CMakePresets.json b/CMakePresets.json index 71c9e4d36..fcbca7a98 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -124,6 +124,22 @@ "CMAKE_EXE_LINKER_FLAGS": "$env{CCC_MEMORY_SANITIZER_LINKER_FLAGS}" } }, + { + "name": "filc-debug", + "inherits": "default-debug", + "cacheVariables": { + "CMAKE_C_COMPILER": "filcc", + "CMAKE_C_FLAGS": "-g3 -O0 $env{CCC_WARNING_C_FLAGS}" + } + }, + { + "name": "filc-release", + "inherits": "default-release", + "cacheVariables": { + "CMAKE_C_COMPILER": "filcc", + "CMAKE_C_FLAGS": "-O2 $env{CCC_WARNING_C_FLAGS}" + } + }, { "name": "gcc-gcov", "inherits": ["default-debug"], From 3f1525fcebd1787804574085522821d39a904520 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:03:29 -0700 Subject: [PATCH 2/7] force build --- ccc/flat_hash_map.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccc/flat_hash_map.h b/ccc/flat_hash_map.h index fd4c9918f..31bd54eaf 100644 --- a/ccc/flat_hash_map.h +++ b/ccc/flat_hash_map.h @@ -18,8 +18,8 @@ limitations under the License. A Flat Hash Map stores elements in a contiguous array and allows the user to query the map by key in amortized `O(1)` time. Elements in the table may be -copied and moved, especially when rehashing occurs, so no pointer stability is -available in this implementation. +copied and moved, especially when rehashing occurs, so stored elements are not +pointer stable. A flat hash map requires the user to provide a pointer to the map, a type, a key field, a hash function, and a key three way comparator function. The hasher From e301b74ec935cc2d047a20b99691d0a8c4906e83 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:06:22 -0700 Subject: [PATCH 3/7] fix action step --- .github/workflows/filc_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/filc_build.yml b/.github/workflows/filc_build.yml index 77283f162..ff0e8265a 100644 --- a/.github/workflows/filc_build.yml +++ b/.github/workflows/filc_build.yml @@ -57,6 +57,7 @@ jobs: # Add filcc binaries to GITHUB_PATH echo "$HOME/filc/bin" >> $GITHUB_PATH + echo "$HOME/filc/pizfix/bin" >> $GITHUB_PATH env: GH_TOKEN: ${{ github.token }} From 5e9348fa5093e0c5433d7b148279d7bef9eeb093 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:07:53 -0700 Subject: [PATCH 4/7] force action --- ccc/flat_priority_queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccc/flat_priority_queue.h b/ccc/flat_priority_queue.h index 712081e7d..c15097a2a 100644 --- a/ccc/flat_priority_queue.h +++ b/ccc/flat_priority_queue.h @@ -18,7 +18,7 @@ limitations under the License. A flat priority queue is a contiguous container storing elements in heap order. This offers tightly packed data for efficient push, pop, min/max operations in -`O(lg N)` time. +`O(lg N)` time. See the sort.h interface for heap related sorting. A flat priority queue can use memory sources from the stack, heap, or data segment and can be initialized at compile or runtime. The container offers From f0a7a7e39005c1d40bd82cbb98a2110270395391 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:16:01 -0700 Subject: [PATCH 5/7] try to find compiler --- .github/workflows/filc_build.yml | 18 +++++++++++------- CMakePresets.json | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/filc_build.yml b/.github/workflows/filc_build.yml index ff0e8265a..824df20b2 100644 --- a/.github/workflows/filc_build.yml +++ b/.github/workflows/filc_build.yml @@ -47,17 +47,20 @@ jobs: - name: Download & Install Fil-C run: | - # Download the latest standalone Fil-C release asset via GitHub CLI + # Download Fil-C archive gh release download --repo pizlonator/fil-c --pattern 'filc-*-linux-x86_64.tar.xz' --clobber - # Extract and run Fil-C setup script - mkdir -p ~/filc - tar -xf filc-*-linux-x86_64.tar.xz -C ~/filc --strip-components=1 - cd ~/filc && ./setup.sh + # Extract archive into $HOME/filc + mkdir -p $HOME/filc + tar -xf filc-*-linux-x86_64.tar.xz -C $HOME/filc --strip-components=1 - # Add filcc binaries to GITHUB_PATH + # Run setup script + cd $HOME/filc + ./setup.sh + + # Add BOTH bin directories to GITHUB_PATH for subsequent steps + echo "$HOME/filc/build/bin" >> $GITHUB_PATH echo "$HOME/filc/bin" >> $GITHUB_PATH - echo "$HOME/filc/pizfix/bin" >> $GITHUB_PATH env: GH_TOKEN: ${{ github.token }} @@ -67,6 +70,7 @@ jobs: run: | make clean || true cmake --preset=filc-${{ matrix.build }} \ + -DCMAKE_C_COMPILER=$HOME/filc/build/bin/clang -DCCC_BUILD_SPECIALIZED=ON \ -DCCC_FLAT_HASH_MAP_PORTABLE=${{ matrix.portable }} && \ cmake --build build -j$(nproc) --target ccc tests diff --git a/CMakePresets.json b/CMakePresets.json index fcbca7a98..d9fc71eda 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -128,7 +128,7 @@ "name": "filc-debug", "inherits": "default-debug", "cacheVariables": { - "CMAKE_C_COMPILER": "filcc", + "CMAKE_C_COMPILER": "clang", "CMAKE_C_FLAGS": "-g3 -O0 $env{CCC_WARNING_C_FLAGS}" } }, @@ -136,7 +136,7 @@ "name": "filc-release", "inherits": "default-release", "cacheVariables": { - "CMAKE_C_COMPILER": "filcc", + "CMAKE_C_COMPILER": "clang", "CMAKE_C_FLAGS": "-O2 $env{CCC_WARNING_C_FLAGS}" } }, From 546f7580124410716ba58bc8565dd25d664d5357 Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:16:43 -0700 Subject: [PATCH 6/7] force --- ccc/flat_bitset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccc/flat_bitset.h b/ccc/flat_bitset.h index c8f8b8ba0..3007d88cd 100644 --- a/ccc/flat_bitset.h +++ b/ccc/flat_bitset.h @@ -18,7 +18,7 @@ limitations under the License. A bit set offers efficient set membership operations when the range of values can be tracked via an index. Both a fixed size and dynamic variant are possible -depending on initialization options. +depending on desired behavior when passing an allocator. Conceptually, the bit set can be thought of as an arbitrary length integer with index `0` being the Least Significant Bit and index `N - 1` being the Most From 55ea056c093684fb68ee45f03227514038000b2d Mon Sep 17 00:00:00 2001 From: Alex Lopez Date: Sat, 25 Jul 2026 15:34:47 -0700 Subject: [PATCH 7/7] acknowledge fil-c --- CONTRIBUTING.md | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95bb88052..53d27bb2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,6 +150,8 @@ Now that tooling is set up, the workflow is roughly as follows. - Run `make clean && cmake --preset=my-sanitize-release && cmake --build build -j8 --target ccc tests samples`. Replace the `-j8` flag with the number of cores on your system. This is the same as the previous step just in release mode. Sometimes the compiler can optimize in such a way to create different issues the sanitizer can catch. Run `make test`. Tests will run the PR remotely in case you forget, but feedback is faster locally. - Mark the pr as ready for review when all CI checks pass and tools show no errors locally. +When the pull request is a draft or ready for review, be sure to check if the [Fil-C](https://fil-c.org/) build variants are passing. Fil-C is an excellent compiler intended to guarantee memory safety. Therefore, it can catch even more memory related bugs in the containers than traditional sanitizer builds. + ## Targets - `ccc` - The core C Container Collection library. diff --git a/README.md b/README.md index e20069c45..d05a69b5f 100644 --- a/README.md +++ b/README.md @@ -1288,7 +1288,7 @@ make test ## Quality Control -The C Container Collection is extensively tested and analyzed both statically and at runtime. See the `tests/` repository which is always seeking valuable additions. Also, visit `CONTRIBUTING.md` to see the extensive tooling that is constantly run locally and over CI via actions in the `.github/workflows` folder. Tools include `clang-format`, `clang-tidy`, `pre-commit`, `GCC's -fanalyzer`, and GCC's extensive address and undefined behavior sanitizers. Builds for both Linux `x86` and MacOS `ARM` run on every commit in pull requests, with additional portable implementation variants built. I aim to deliver a high quality library and welcome any suggestions for tools to further improve code quality. +The C Container Collection is extensively tested and analyzed both statically and at runtime. See the `tests/` repository which is always seeking valuable additions. Also, visit `CONTRIBUTING.md` to see the extensive tooling that is constantly run locally and over CI via actions in the `.github/workflows` folder. Tools include `clang-format`, `clang-tidy`, `pre-commit`, `GCC's -fanalyzer`, Fil-C builds, and GCC's extensive address and undefined behavior sanitizers. Builds for both Linux `x86` and MacOS `ARM` run on every commit in pull requests, with additional portable implementation variants built. I aim to deliver a high quality library and welcome any suggestions for tools to further improve code quality. If you are interested in contributing, tests that increase code coverage are a good way to start. View the [coverage report here](https://skeletoss.github.io/ccc/coverage).