Skip to content

Commit 823fdb8

Browse files
committed
Meta: Switch to clang-format-18 as the standard formatter
1 parent 891c4ac commit 823fdb8

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

.devcontainer/features/serenity/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
18,
1414
"trunk"
1515
],
16-
"default": 16,
16+
"default": 18,
1717
"description": "Select LLVM compiler version to use"
1818
},
1919
"enable_ladybird": {

.github/workflows/cmake.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ jobs:
5757
# Packages below aren't.
5858
run: |
5959
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
60-
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
60+
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
6161
sudo apt-get update
62-
sudo apt-get install -y clang-format-16 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja libegl1-mesa-dev
62+
sudo apt-get install -y clang-format-18 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja libegl1-mesa-dev
6363
if ${{ matrix.arch == 'aarch64' }}; then
6464
# FIXME: Remove this when we no longer build our own Qemu binary.
6565
sudo apt-get install libgtk-3-dev libpixman-1-dev libsdl2-dev libslirp-dev
@@ -72,7 +72,7 @@ jobs:
7272
python -m pip install --upgrade pip
7373
pip install flake8 requests
7474
- name: Check versions
75-
run: set +e; g++ --version; g++-13 --version; clang-format --version; clang-format-16 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version; gn --version
75+
run: set +e; g++ --version; g++-13 --version; clang-format --version; clang-format-18 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version; gn --version
7676

7777
- name: Enable KVM group perms
7878
run: |

.github/workflows/pvs-studio-static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
#
2727
run: |
2828
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
29-
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
29+
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
3030
sudo apt-get update
31-
sudo apt-get install -y clang-format-16 gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio
31+
sudo apt-get install -y clang-format-18 gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio
3232
3333
- name: Check versions
3434
run: set +e; g++ --version; g++-13 --version; ninja --version;

.github/workflows/sonar-cloud-static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ jobs:
5858
# Packages below aren't.
5959
run: |
6060
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
61-
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
61+
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
6262
sudo apt-get update
63-
sudo apt-get install -y clang-format-16 gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build unzip
63+
sudo apt-get install -y clang-format-18 gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build unzip
6464
6565
- name: Check versions
6666
run: set +e; g++ --version; g++-13 --version; ninja --version;

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Nobody is perfect, and sometimes we mess things up. That said, here are some goo
4444
**Do:**
4545

4646
* Write in idiomatic SerenityOS C++20, using the `AK` containers in all code.
47-
* Conform to the project coding style found in [CodingStyle.md](https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 16 or later) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/SerenityOS/serenity/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-16.
47+
* Conform to the project coding style found in [CodingStyle.md](https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 18 or later) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/SerenityOS/serenity/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-18.
4848
* Choose expressive variable, function and class names. Make it as obvious as possible what the code is doing.
4949
* Split your changes into separate, atomic commits (i.e. A commit per feature or fix, where the build, tests and the system are all functioning).
5050
* Make sure your commits are rebased on the master branch.

Documentation/CodingStyle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
For low-level styling (spaces, parentheses, brace placement, etc), all code should follow the format specified in `.clang-format` in the project root.
44

5-
**Important: Make sure you use `clang-format` version 16 or later!**
5+
**Important: Make sure you use `clang-format` version 18 or later!**
66

77
This document describes the coding style used for C++ code in the Serenity Operating System project. All new code should conform to this style.
88

Documentation/QtCreatorConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Qt Creator should be set up correctly now, go ahead and explore the project and
4848
4949
## Auto-Formatting
5050
51-
You can use `clang-format` to help you with the [style guide](CodingStyle.md). Before you proceed, check that you're actually using clang-format version 16, as some OSes will ship older clang-format versions by default.
51+
You can use `clang-format` to help you with the [style guide](CodingStyle.md). Before you proceed, check that you're actually using clang-format version 18, as some OSes will ship older clang-format versions by default.
5252
5353
- In QtCreator, go to "Help > About Plugins…"
5454
- Find the `Beautifier (experimental)` row (for example, by typing `beau` into the search)

Meta/Azure/Setup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ steps:
99
- script: |
1010
set -e
1111
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
12-
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
12+
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
1313
sudo apt-get update
14-
sudo apt-get install clang-format-16 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld
14+
sudo apt-get install clang-format-18 ccache e2fsprogs gcc-13 g++-13 libstdc++-13-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld
1515
displayName: 'Install Dependencies'
1616
1717
- ${{ if eq(parameters.os, 'Linux') }}:

Meta/lint-clang-format.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ fi
2929
if (( ${#files[@]} )); then
3030
TOOLCHAIN_DIR=Toolchain/Local/clang/bin
3131
CLANG_FORMAT=false
32-
if command -v clang-format-16 >/dev/null 2>&1 ; then
33-
CLANG_FORMAT=clang-format-16
34-
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@16)"/bin/clang-format >/dev/null 2>&1 ; then
35-
CLANG_FORMAT="$(brew --prefix llvm@16)"/bin/clang-format
36-
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 16.' ; then
32+
if command -v clang-format-18 >/dev/null 2>&1 ; then
33+
CLANG_FORMAT=clang-format-18
34+
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@18)"/bin/clang-format >/dev/null 2>&1 ; then
35+
CLANG_FORMAT="$(brew --prefix llvm@18)"/bin/clang-format
36+
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 18.' ; then
3737
CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format
3838
elif command -v clang-format >/dev/null 2>&1 ; then
3939
CLANG_FORMAT=clang-format
40-
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 16) exit 1; }'; then
41-
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 16 or later."
40+
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 18) exit 1; }'; then
41+
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 18 or later."
4242
echo "It is very likely that the resulting changes are not what you wanted."
4343
fi
4444
else
45-
echo "clang-format-16 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-16."
46-
echo "(If you install a package 'clang-format', please make sure it's version 16 or later.)"
45+
echo "clang-format-18 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-18."
46+
echo "(If you install a package 'clang-format', please make sure it's version 18 or later.)"
4747
exit 1
4848
fi
4949

0 commit comments

Comments
 (0)