mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
Meta: Switch to clang-format-15 as the standard formatter
The two major changes noticeable on the SerenityOS codebase are: - Much improved support for const placement, clang-format-14 ignored our east-const configuration in various places - Different formatting for requires clauses, now breaking them onto their own line, which helps with readability a bit Current versions of CLion also ship LLVM 15, so the built-in formatting now matches CI formatting again :^)
This commit is contained in:
parent
0d63b7a515
commit
8639d8bc21
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/8639d8bc21 Pull-request: https://github.com/SerenityOS/serenity/pull/15654 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/alimpfard
7 changed files with 22 additions and 20 deletions
|
@ -12,3 +12,5 @@ BraceWrapping:
|
|||
AfterFunction: true
|
||||
NamespaceIndentation: None
|
||||
QualifierAlignment: Right
|
||||
RequiresClausePosition: WithFollowing
|
||||
IndentRequiresClause: false
|
||||
|
|
6
.github/workflows/cmake.yml
vendored
6
.github/workflows/cmake.yml
vendored
|
@ -57,9 +57,9 @@ jobs:
|
|||
# Packages below aren't.
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main'
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format-14 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip
|
||||
sudo apt-get install -y clang-format-15 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip
|
||||
- name: Install JS dependencies
|
||||
run: sudo npm install -g prettier@2.7.1
|
||||
- name: Install Python dependencies
|
||||
|
@ -68,7 +68,7 @@ jobs:
|
|||
python -m pip install --upgrade pip
|
||||
pip install flake8 requests
|
||||
- name: Check versions
|
||||
run: set +e; g++ --version; g++-12 --version; clang-format --version; clang-format-14 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version
|
||||
run: set +e; g++ --version; g++-12 --version; clang-format --version; clang-format-15 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version
|
||||
|
||||
# === PREPARE FOR BUILDING ===
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ jobs:
|
|||
#
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main'
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format-14 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio
|
||||
sudo apt-get install -y clang-format-15 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio
|
||||
|
||||
- name: Check versions
|
||||
run: set +e; g++ --version; g++-12 --version; ninja --version;
|
||||
|
|
|
@ -59,9 +59,9 @@ jobs:
|
|||
# Packages below aren't.
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main'
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format-14 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip
|
||||
sudo apt-get install -y clang-format-15 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip
|
||||
|
||||
- name: Check versions
|
||||
run: set +e; g++ --version; g++-12 --version; ninja --version;
|
||||
|
|
|
@ -20,9 +20,9 @@ These instructions assume the OS installed is Ubuntu 22.04 (Jammy), so they migh
|
|||
```shell
|
||||
sudo add-apt-repository ppa:canonical-server/server-backports
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-focal-14 main'
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
|
||||
apt update
|
||||
apt install git build-essential make cmake clang-format-14 gcc-12 g++-12 libstdc++-12-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt
|
||||
apt install git build-essential make cmake clang-format-15 gcc-12 g++-12 libstdc++-12-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt
|
||||
```
|
||||
### Force usage of GCC 12
|
||||
```shell
|
||||
|
|
|
@ -8,9 +8,9 @@ steps:
|
|||
- ${{ if eq(parameters.os, 'Serenity') }}:
|
||||
- script: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main'
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang-format-14 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld
|
||||
sudo apt-get install clang-format-15 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld
|
||||
displayName: 'Install Dependencies'
|
||||
|
||||
- ${{ if eq(parameters.os, 'Linux') }}:
|
||||
|
|
|
@ -28,21 +28,21 @@ fi
|
|||
if (( ${#files[@]} )); then
|
||||
TOOLCHAIN_DIR=Toolchain/Local/clang/bin
|
||||
CLANG_FORMAT=false
|
||||
if command -v clang-format-14 >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format-14
|
||||
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@14)"/bin/clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT="$(brew --prefix llvm@14)"/bin/clang-format
|
||||
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 14.' ; then
|
||||
if command -v clang-format-15 >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format-15
|
||||
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@15)"/bin/clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT="$(brew --prefix llvm@15)"/bin/clang-format
|
||||
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 15.' ; then
|
||||
CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format
|
||||
elif command -v clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format
|
||||
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 14) exit 1; }'; then
|
||||
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 14 or later."
|
||||
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 15) exit 1; }'; then
|
||||
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 15 or later."
|
||||
echo "It is very likely that the resulting changes are not what you wanted."
|
||||
fi
|
||||
else
|
||||
echo "clang-format-14 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-14."
|
||||
echo "(If you install a package 'clang-format', please make sure it's version 14 or later.)"
|
||||
echo "clang-format-15 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-15."
|
||||
echo "(If you install a package 'clang-format', please make sure it's version 15 or later.)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue