Skip to content

Replace __builtin_ffs with std::countr_zero #1915

Replace __builtin_ffs with std::countr_zero

Replace __builtin_ffs with std::countr_zero #1915

Workflow file for this run

---
name: msvc-build
on:
push:
branches:
- master
pull_request:
permissions: {}
jobs:
build:
runs-on: windows-2025
env:
EXAMPLE_PRESETS: >-
msvc-debug
msvc-release
msvc-llvm-debug
msvc-llvm-release
STATIC_ANALYSIS_PRESETS: >-
msvc-static-analysis-debug
msvc-static-analysis-release
strategy:
fail-fast: false
matrix:
include:
- name: MSVC Debug
preset: "msvc-debug"
- name: MSVC Release
preset: "msvc-release"
- name: MSVC Debug w/ ASan
preset: "msvc-debug-asan"
- name: MSVC Release w/ ASan
preset: "msvc-release-asan"
- name: MSVC LLVM Debug
preset: "msvc-llvm-debug"
- name: MSVC LLVM Release
preset: "msvc-llvm-release"
- name: MSVC Debug without AVX2
preset: "msvc-debug-no-avx2"
- name: MSVC Static Analysis Debug
preset: "msvc-static-analysis-debug"
- name: MSVC Static Analysis Release
preset: "msvc-static-analysis-release"
steps:
- uses: actions/checkout@v5
with:
submodules: false
persist-credentials: false
- name: Setup command line tools
uses: ilammy/msvc-dev-cmd@v1 # zizmor: ignore[unpinned-uses]
- name: Install cppcheck
run: |
del C:\Strawberry\c\bin\cppcheck.exe
choco install cppcheck -y
- name: Install dependencies
run: |
vcpkg install boost-accumulators boost-stacktrace:x64-windows-static `
gtest benchmark
- name: Configure CMake (examples)
working-directory: examples
run: |
# Ensure that we use clang-cl from MSVC, not LLVM
$env:path = $env:path `
-split ';' -notmatch 'C:\\Program Files\\LLVM\\bin' -join ';'
cmake --preset "${{matrix.preset}}"
if: contains(env.EXAMPLE_PRESETS, matrix.preset)
- name: Build (examples)
working-directory: examples
run: |
cmake --build --preset "${{matrix.preset}}" -- -k 0
if: contains(env.EXAMPLE_PRESETS, matrix.preset)
- name: Run examples
working-directory: examples
run: |
cmake --build --preset "${{matrix.preset}}" --target examples `
-- -k 0
if: contains(env.EXAMPLE_PRESETS, matrix.preset)
- name: Populate git submodules and configure CMake
run: |
git submodule update --init --recursive
# Ensure that we use clang-cl from MSVC, not LLVM
$env:path = $env:path `
-split ';' -notmatch 'C:\\Program Files\\LLVM\\bin' -join ';'
cmake --preset "${{matrix.preset}}"
- name: Build
run: |
cmake --build --preset "${{matrix.preset}}" -- -k 0
$BUILD_ROOT = "${{github.workspace}}\build\${{matrix.preset}}"
$SARIF_SRC = "$BUILD_ROOT\msvc.sarif"
$SARIF_DST = "$BUILD_ROOT\msvc-${{matrix.preset}}.sarif"
Move-Item -Path $SARIF_SRC -Destination $SARIF_DST `
-ErrorAction SilentlyContinue
- name: Upload SARIF as an Artifact
uses: actions/upload-artifact@v4
with:
name: sarif-file-${{matrix.preset}}
path: "${{github.workspace}}\\build\\${{matrix.preset}}\\msvc-${{matrix.preset}}.sarif"
if: contains(env.STATIC_ANALYSIS_PRESETS, matrix.preset)
- name: Correctness test
run: ctest -V --preset "${{matrix.preset}}"
if: "!contains(env.STATIC_ANALYSIS_PRESETS, matrix.preset)"
- name: Benchmark correctness test
run: |
$Env:P = "${{matrix.preset}}"
cmake --build --preset "$env:P" --target quick_benchmarks
if: "!contains(env.STATIC_ANALYSIS_PRESETS, matrix.preset)"