Skip to content

Disable -Wswitch-default for clang-cl #2006

Disable -Wswitch-default for clang-cl

Disable -Wswitch-default for clang-cl #2006

Workflow file for this run

---
name: build
on: [push]
env:
DEFAULT_COMPILER: gcc
DEFAULT_SANITIZE_ADDRESS: OFF
DEFAULT_SANITIZE_THREAD: OFF
DEFAULT_SANITIZE_UB: OFF
DEFAULT_STATIC_ANALYSIS: OFF
DEFAULT_COVERAGE: OFF
DEFAULT_AVX2: ON
permissions: { }
jobs:
build:
runs-on: ${{matrix.os}}
env:
BUILD_TYPE: ${{matrix.BUILD_TYPE}}
SANITIZE_ADDRESS: ${{matrix.SANITIZE_ADDRESS}}
SANITIZE_THREAD: ${{matrix.SANITIZE_THREAD}}
SANITIZE_UB: ${{matrix.SANITIZE_UB}}
STATIC_ANALYSIS: ${{matrix.STATIC_ANALYSIS}}
COVERAGE: ${{matrix.COVERAGE}}
COMPILER: ${{matrix.COMPILER}}
CPPLINT: ${{matrix.CPPLINT}}
CPPCHECK: ${{matrix.CPPCHECK}}
AVX2: ${{matrix.AVX2}}
strategy:
fail-fast: false
matrix:
include:
- name: GCC 13 Release
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
- name: GCC 13 Release with ASan
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
SANITIZE_ADDRESS: ON
- name: GCC 13 Release with TSan
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
SANITIZE_THREAD: ON
- name: GCC 13 Release with UBSan
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
SANITIZE_UB: ON
- name: GCC 13 Debug
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
- name: GCC 13 Debug with ASan
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
SANITIZE_ADDRESS: ON
- name: GCC 13 Debug with TSan
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
SANITIZE_THREAD: ON
- name: GCC 13 Debug with UBSan
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
SANITIZE_UB: ON
- name: GCC 13 Debug without AVX2
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
AVX2: OFF
- name: GCC 13 Release static analysis & cpplint
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
STATIC_ANALYSIS: ON
CPPLINT: ON
- name: GCC 13 default CMake configuration
os: ubuntu-22.04
COMPILER: gcc
- name: clang 19 Release
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang
- name: clang 19 Release with ASan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_ADDRESS: ON
COMPILER: clang
- name: clang 19 Release with TSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_THREAD: ON
COMPILER: clang
- name: clang 19 Release with UBSan
os: ubuntu-22.04
BUILD_TYPE: Release
SANITIZE_UB: ON
COMPILER: clang
- name: clang 19 Debug
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang
- name: clang 19 Debug with ASan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_ADDRESS: ON
COMPILER: clang
- name: clang 19 Debug with TSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_THREAD: ON
COMPILER: clang
- name: clang 19 Debug with UBSan
os: ubuntu-22.04
BUILD_TYPE: Debug
SANITIZE_UB: ON
COMPILER: clang
- name: clang 19 Release static analysis
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: clang
STATIC_ANALYSIS: ON
- name: clang 19 Debug static analysis
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: clang
STATIC_ANALYSIS: ON
- name: XCode Release (Intel)
os: macos-latest
BUILD_TYPE: Release
COMPILER: macos-clang
AVX2: OFF
- name: XCode Release with ASan (Intel)
os: macos-latest
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_ADDRESS: ON
AVX2: OFF
- name: XCode Release with TSan (Intel)
os: macos-latest
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_THREAD: ON
AVX2: OFF
- name: XCode Release with UBSan (Intel)
os: macos-latest
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_UB: ON
AVX2: OFF
- name: XCode Debug with cppcheck (Intel)
os: macos-latest
BUILD_TYPE: Debug
COMPILER: macos-clang
CPPCHECK: ON
AVX2: OFF
- name: XCode Debug with ASan (Intel)
os: macos-latest
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_ADDRESS: ON
AVX2: OFF
- name: XCode Debug with TSan (Intel)
os: macos-latest
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_THREAD: ON
AVX2: OFF
- name: XCode Debug with UBSan (Intel)
os: macos-latest
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_UB: ON
AVX2: OFF
- name: XCode Release (Apple Silicon)
os: macos-14
BUILD_TYPE: Release
COMPILER: macos-clang
AVX2: OFF
- name: XCode Release with ASan (Apple Silicon)
os: macos-14
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_ADDRESS: ON
AVX2: OFF
- name: XCode Release with TSan (Apple Silicon)
os: macos-14
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_THREAD: ON
AVX2: OFF
- name: XCode Release with UBSan (Apple Silicon)
os: macos-14
BUILD_TYPE: Release
COMPILER: macos-clang
SANITIZE_UB: ON
AVX2: OFF
- name: XCode Debug with cppcheck (Apple Silicon)
os: macos-14
BUILD_TYPE: Debug
COMPILER: macos-clang
CPPCHECK: ON
AVX2: OFF
- name: XCode Debug with ASan (Apple Silicon)
os: macos-14
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_ADDRESS: ON
AVX2: OFF
- name: XCode Debug with TSan (Apple Silicon)
os: macos-14
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_THREAD: ON
AVX2: OFF
- name: XCode Debug with UBSan (Apple Silicon)
os: macos-14
BUILD_TYPE: Debug
COMPILER: macos-clang
SANITIZE_UB: ON
AVX2: OFF
- name: Debug coverage
os: ubuntu-22.04
BUILD_TYPE: Debug
COMPILER: gcc
COVERAGE: ON
AVX2: OFF
- name: Release coverage
os: ubuntu-22.04
BUILD_TYPE: Release
COMPILER: gcc
COVERAGE: ON
AVX2: OFF
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup common dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install -y libboost-dev libc6-dev-i386
sudo apt-get remove clang-tidy-11
if: runner.os == 'Linux'
- name: Setup dependencies for cpplint
run: pip install cpplint
if: env.CPPLINT == 'ON'
- name: Setup dependencies for GCC
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-13
if: runner.os == 'Linux' && env.COMPILER == 'gcc'
- name: Setup dependencies for Linux LLVM (common)
run: |
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \
| sudo apt-key add -
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main' \
| sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang-19 iwyu
if: runner.os == 'Linux' && env.COMPILER == 'clang'
- name: Setup dependencies for Linux LLVM (Release)
run: sudo apt-get install -y libomp5-19 llvm-19 lld-19
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.BUILD_TYPE == 'Release'
- name: Setup dependencies for Linux LLVM (static analysis)
run: sudo apt-get install -y clang-tools-19
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.STATIC_ANALYSIS == 'ON'
- name: Setup dependencies for Linux LLVM (not static analysis)
run: sudo apt-get install -y clang-tidy-19
if: >
runner.os == 'Linux' && env.COMPILER == 'clang'
&& env.STATIC_ANALYSIS != 'ON'
- name: Set up dependencies for Linux (coverage)
run: |
sudo apt-get install lcov cpanminus
sudo cpanm install JSON
if: runner.os == 'Linux' && env.COVERAGE == 'ON'
- name: Set up dependencies for macOS (common)
run: |
brew install boost include-what-you-use python-setuptools
if: runner.os == 'macOS'
- name: Set up dependencies for macOS (cppcheck)
run: brew install cppcheck
if: runner.os == 'macOS' && env.CPPCHECK == 'ON'
- name: Create build environment
run: mkdir ${{github.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment
# variable access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
run: |
COMPILER="${COMPILER:-$DEFAULT_COMPILER}"
SANITIZE_ADDRESS="${SANITIZE_ADDRESS:-$DEFAULT_SANITIZE_ADDRESS}"
SANITIZE_THREAD="${SANITIZE_THREAD:-$DEFAULT_SANITIZE_THREAD}"
SANITIZE_UB="${SANITIZE_UB:-$DEFAULT_SANITIZE_UB}"
STATIC_ANALYSIS="${STATIC_ANALYSIS:-$DEFAULT_STATIC_ANALYSIS}"
COVERAGE="${COVERAGE:-$DEFAULT_COVERAGE}"
AVX2="${AVX2:-$DEFAULT_AVX2}"
export PATH="$HOME/.local/bin:$PATH"
if [[ -n "$BUILD_TYPE" ]]; then
CBT="-DCMAKE_BUILD_TYPE=$BUILD_TYPE"
else
CBT=""
fi
if [[ $COMPILER == "gcc" ]]; then
V=13
if [[ $COVERAGE == "ON" ]]; then
EXTRA_CMAKE_ARGS=("-DGCOV_PATH=/usr/bin/gcov-$V")
else
EXTRA_CMAKE_ARGS=()
fi
export CC=gcc-$V
export CXX=g++-$V
elif [[ $COMPILER == "clang" ]]; then
V=19
export CC=clang-$V
export CXX=clang++-$V
if [[ $BUILD_TYPE == "Release" ]]; then
EXTRA_CMAKE_ARGS=(\
"-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-$V" \
"-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-$V" \
"-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-$V")
else
EXTRA_CMAKE_ARGS=()
fi
# LLVM static analysis wart
if [[ $STATIC_ANALYSIS == "ON" ]]; then
STATIC_ANALYSIS=OFF
# Workaround https://github.com/llvm/llvm-project/issues/61576
# scan-build defaults to -std=c++14
EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \
"-DCMAKE_CXX_FLAGS=-std=c++17")
else
EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \
"-DCLANG_TIDY_EXE=/usr/bin/clang-tidy-$V")
fi
elif [[ $COMPILER == "macos-clang" ]]; then
export CC=clang
export CXX=clang++
fi
cmake "$GITHUB_WORKSPACE" "$CBT" -DSTANDALONE=ON -DMAINTAINER_MODE=ON \
"-DSANITIZE_ADDRESS=${SANITIZE_ADDRESS}" \
"-DSANITIZE_THREAD=${SANITIZE_THREAD}" \
"-DSANITIZE_UB=${SANITIZE_UB}" \
"-DSTATIC_ANALYSIS=${STATIC_ANALYSIS}" "-DCOVERAGE=${COVERAGE}" \
"-DAVX2=${AVX2}" "${EXTRA_CMAKE_ARGS[@]}"
- name: Build
working-directory: ${{github.workspace}}/build
run: make -j3
if: env.STATIC_ANALYSIS != 'ON' || env.COMPILER != 'clang'
- name: clang static analysis
working-directory: ${{github.workspace}}/build
run: |
/usr/bin/scan-build-19 --status-bugs -stats -analyze-headers \
--force-analyze-debug-code make -j3;
if: env.STATIC_ANALYSIS == 'ON' && env.COMPILER == 'clang'
- name: Correctness test
working-directory: ${{github.workspace}}/build
run: ctest -j3 -V
if: env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON'
- name: Benchmark correctness test
working-directory: ${{github.workspace}}/build
run: make quick_benchmarks
if: env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON'
- name: DeepState 1 minute fuzzing
working-directory: ${{github.workspace}}/build
run: make -j2 deepstate_1m
if: >
env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON'
&& (runner.os != 'macOS'
|| (env.SANITIZE_ADDRESS == 'OFF' && env.SANITIZE_THREAD == 'OFF'))
- name: DeepState libfuzzer 1 minute fuzzing
working-directory: ${{github.workspace}}/build
run: make -j2 deepstate_lf_1m
if: >
env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON'
&& env.COMPILER == 'clang' && env.BUILD_TYPE != 'Release'
&& env.SANITIZE_THREAD != 'ON'
- name: Valgrind test
working-directory: ${{github.workspace}}/build
run: |
sudo apt-get install -y libc6-dbg
sudo snap install --classic valgrind
make valgrind
if: >
env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON'
&& env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON'
&& runner.os == 'Linux' && env.COVERAGE != 'ON'
- name: Gather coverage data
working-directory: ${{github.workspace}}/build
run: |
make -j3 coverage
if: env.COVERAGE == 'ON'
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{matrix.BUILD_TYPE}}
fail_ci_if_error: true
directory: ${{github.workspace}}/build
if: env.COVERAGE == 'ON'