Skip to content

Commit 9364e45

Browse files
authored
Merge pull request #6619 from tautschnig/cleanup/clang-format-10
Switch to clang-format-10 to support more recent platforms
2 parents 380179b + 14ddb8c commit 9364e45

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ SpacesInCStyleCastParentheses: 'false'
5858
SpacesInContainerLiterals: 'false'
5959
SpacesInParentheses: 'false'
6060
SpacesInSquareBrackets: 'false'
61-
Standard: Cpp11
61+
Standard: c++11
6262
TabWidth: '2'
6363
UseTab: Never
6464
---

.github/workflows/pull-request-check-clang-format.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
echo "Pull request's base branch is: ${BASE_BRANCH}"
88
echo "Pull request's merge branch is: ${MERGE_BRANCH}"
99
echo "Pull request's source branch is: ${GITHUB_HEAD_REF}"
10-
clang-format-7 --version
10+
clang-format-10 --version
1111

1212
# The checkout action leaves us in detatched head state. The following line
1313
# names the checked out commit, for simpler reference later.
@@ -26,7 +26,7 @@ echo "Checking for formatting errors introduced since $MERGE_BASE"
2626

2727
# Do the checking. "eval" is used so that quotes (as inserted into $EXCLUDES
2828
# above) are not interpreted as parts of file names.
29-
eval git-clang-format-7 --binary clang-format-7 $MERGE_BASE -- $EXCLUDES
29+
eval git-clang-format --binary clang-format-10 $MERGE_BASE -- $EXCLUDES
3030
git diff > formatted.diff
3131
if [[ -s formatted.diff ]] ; then
3232
echo 'Formatting error! The following diff shows the required changes'

.github/workflows/pull-request-checks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ jobs:
502502
DEBIAN_FRONTEND: noninteractive
503503
run: |
504504
sudo apt-get update
505-
sudo apt-get install --no-install-recommends -yq clang-format-7
506-
- name: Check updated lines of code match clang-format-7 style
505+
sudo apt-get install --no-install-recommends -yq clang-format
506+
- name: Check updated lines of code match clang-format-10 style
507507
env:
508508
BASE_BRANCH: ${{ github.base_ref }}
509509
MERGE_BRANCH: ${{ github.ref }}

CODING_STANDARD.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ To avoid waiting until you've made a PR to find formatting issues, you can
340340
install clang-format locally and run it against your code as you are working.
341341

342342
Different versions of clang-format have slightly different behaviors. CBMC uses
343-
clang-format-7 as it is available the repositories for Ubuntu 18.04 and
343+
clang-format-10 as it is available the repositories for Ubuntu 18.04 and
344344
Homebrew.
345345
To install on a Unix-like system, try installing using the system package
346346
manager:
347347
```
348-
apt-get install clang-format-7 # Run this on Ubuntu, Debian etc.
349-
brew install clang-format@7 # Run this on a Mac with Homebrew installed
348+
apt-get install clang-format-10 # Run this on Ubuntu, Debian etc.
349+
brew install clang-format@10 # Run this on a Mac with Homebrew installed
350350
```
351351

352352
If your platform doesn't have a package for clang-format, you can download a
@@ -358,12 +358,12 @@ the [LLVM Snapshot Builds page](http://llvm.org/builds/).
358358

359359
### FORMATTING A RANGE OF COMMITS
360360

361-
Clang-format is distributed with a driver script called git-clang-format-7.
361+
Clang-format is distributed with a driver script called git-clang-format.
362362
This script can be used to format git diffs (rather than entire files).
363363

364364
After committing some code, it is recommended to run:
365365
```
366-
git-clang-format-7 upstream/develop
366+
git-clang-format upstream/develop
367367
```
368368
*Important:* If your branch is based on a branch other than `upstream/develop`,
369369
use the name or checksum of that branch instead. It is strongly recommended to
@@ -373,7 +373,7 @@ rebase your work onto the tip of the branch it's based on before running
373373
Note: By default, git-clang-format uses the git config variable
374374
`clangformat.binary`. If you have multiple versions of clang-format installed,
375375
you might need to update this, or explicitly specify the binary to use via
376-
`--binary clang-format-7`.
376+
`--binary clang-format-10`.
377377

378378
### RETROACTIVELY FORMATTING INDIVIDUAL COMMITS
379379

@@ -385,7 +385,7 @@ The following command will stop at each commit in the range and run
385385
clang-format on the diff at that point. This rewrites git history, so it's
386386
*unsafe*, and you should back up your branch before running this command:
387387
```
388-
git filter-branch --tree-filter 'git-clang-format-7 upstream/develop' \
388+
git filter-branch --tree-filter 'git-clang-format upstream/develop' \
389389
-- upstream/develop..HEAD
390390
```
391391
*Important*: `upstream/develop` should be changed in *both* places in the

0 commit comments

Comments
 (0)