From 9030c3376f66a884b71b2d97e06ba338d00183b9 Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Fri, 10 Jan 2025 06:52:25 -0800 Subject: [PATCH] bump clang-format to clang-15 clang 11 was released in 2007, and the last variant of Ubuntu with the clang-format-11 package is 22.04. This bumps the clang-format used for the formatting check to clang 15, available with Ubuntu 22.04 and 24.04. --- .github/workflows/pull-request-check-clang-format.sh | 4 ++-- .github/workflows/syntax-checks.yaml | 6 +++--- CODING_STANDARD.md | 11 +++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-request-check-clang-format.sh b/.github/workflows/pull-request-check-clang-format.sh index ec19cd05ade..951b7e417ff 100755 --- a/.github/workflows/pull-request-check-clang-format.sh +++ b/.github/workflows/pull-request-check-clang-format.sh @@ -7,7 +7,7 @@ set -e echo "Pull request's base branch is: ${BASE_BRANCH}" echo "Pull request's merge branch is: ${MERGE_BRANCH}" echo "Pull request's source branch is: ${GITHUB_HEAD_REF}" -clang-format-11 --version +clang-format-15 --version # The checkout action leaves us in detatched head state. The following line # names the checked out commit, for simpler reference later. @@ -26,7 +26,7 @@ echo "Checking for formatting errors introduced since $MERGE_BASE" # Do the checking. "eval" is used so that quotes (as inserted into $EXCLUDES # above) are not interpreted as parts of file names. -eval git-clang-format-11 --binary clang-format-11 $MERGE_BASE -- $EXCLUDES +eval git-clang-format-15 --binary clang-format-15 $MERGE_BASE -- $EXCLUDES git diff > formatted.diff if [[ -s formatted.diff ]] ; then echo 'Formatting error! The following diff shows the required changes' diff --git a/.github/workflows/syntax-checks.yaml b/.github/workflows/syntax-checks.yaml index 4678d6bf388..5c32a3d3647 100644 --- a/.github/workflows/syntax-checks.yaml +++ b/.github/workflows/syntax-checks.yaml @@ -6,7 +6,7 @@ on: jobs: # This job takes approximately 1 minute check-clang-format: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: @@ -19,8 +19,8 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | sudo apt-get update - sudo apt-get install --no-install-recommends -yq clang-format-11 - - name: Check updated lines of code match clang-format-11 style + sudo apt-get install --no-install-recommends -yq clang-format-15 + - name: Check updated lines of code match clang-format-15 style env: BASE_BRANCH: ${{ github.base_ref }} MERGE_BRANCH: ${{ github.ref }} diff --git a/CODING_STANDARD.md b/CODING_STANDARD.md index 8bc373d7d13..e44a58fc24f 100644 --- a/CODING_STANDARD.md +++ b/CODING_STANDARD.md @@ -341,13 +341,12 @@ To avoid waiting until you've made a PR to find formatting issues, you can install clang-format locally and run it against your code as you are working. Different versions of clang-format have slightly different behaviors. CBMC uses -clang-format-11 as it is available the repositories for Ubuntu 20.04 and -Homebrew. -To install on a Unix-like system, try installing using the system package -manager: +clang-format-15, available in the standard Ubuntu 24.04 and Homebrew +repositories. To install on a Unix-like system, try installing using the +system package manager: ``` -apt-get install clang-format-11 # Run this on Ubuntu, Debian etc. -brew install clang-format@11 # Run this on a Mac with Homebrew installed +apt-get install clang-format-15 # Run this on Ubuntu, Debian etc. +brew install clang-format # Run this on a Mac with Homebrew installed ``` If your platform doesn't have a package for clang-format, you can download a