Skip to content

Commit cae3317

Browse files
committed
Update to use clangformat9
With clangformat9 the AfterCaseLabel is introduced. And this defaults to false, but our code is formatted implicitly with this set to true. PRs to Verona and Snmalloc are being formatted with clangformat9, and this is causing complexity. Let's move forward to clangformat9 in CI.
1 parent 1d72024 commit cae3317

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ AlwaysBreakTemplateDeclarations: true
2121
BinPackArguments: false
2222
BinPackParameters: false
2323
BraceWrapping:
24+
AfterCaseLabel: true
2425
AfterClass: true
2526
AfterControlStatement: true
2627
AfterEnum: true

CMakeLists.txt

+4-7
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,12 @@ endmacro()
3535

3636
macro(clangformat_targets)
3737
# The clang-format tool is installed under a variety of different names. Try
38-
# to find a sensible one. Only look for versions 6 to 8 explicitly - we don't
38+
# to find a sensible one. Only look for versions 9 explicitly - we don't
3939
# know whether our clang-format file will work with newer versions of the
40-
# tool
40+
# tool. It does not work with older versions as AfterCaseLabel is not supported
41+
# in earlier versions.
4142
find_program(CLANG_FORMAT NAMES
42-
clang-format-8
43-
clang-format-7.0
44-
clang-format-6.0
45-
clang-format70
46-
clang-format60
43+
clang-format-9
4744
clang-format)
4845

4946
# If we've found a clang-format tool, generate a target for it, otherwise emit

azure-pipelines.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ jobs:
225225
- job:
226226
displayName: Format
227227
pool:
228-
vmImage: 'ubuntu-16.04'
228+
vmImage: 'ubuntu-18.04'
229229
steps:
230230
- script: |
231231
set -eo pipefail
232232
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
233-
sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main"
233+
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main"
234234
sudo apt-get update
235-
sudo apt-get install -y clang-format-8 clang-tidy-8
236-
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-8 100
235+
sudo apt-get install -y clang-format-9
236+
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-9 100
237237
238238
displayName: 'Install clang'
239239
@@ -245,7 +245,6 @@ jobs:
245245
- script: |
246246
set -eo pipefail
247247
make clangformat
248-
git diff
249248
git diff --exit-code $(Build.SourceVersion)
250249
251250
workingDirectory: build
@@ -254,7 +253,6 @@ jobs:
254253
255254
- script: |
256255
set -eo pipefail
257-
clang-tidy-8 src/override/malloc.cc -header-filter="`pwd`/*" -export-fixes=tidy.fail -- -std=c++17 -mcx16
258-
if [ -f tidy.fail ] ; then exit 1 ; fi
256+
clang-tidy-9 src/override/malloc.cc -header-filter="`pwd`/*" -warnings-as-errors='*' -export-fixes=tidy.fail -- -std=c++17 -mcx16
259257
260258
displayName: 'Clang-Tidy'

0 commit comments

Comments
 (0)