Skip to content

Commit d932a3e

Browse files
committed
Upgrade to Clang 22
1 parent 9de0043 commit d932a3e

11 files changed

Lines changed: 36 additions & 30 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ ARG STYLUA_VERSION=2.5.2
77
# [Optional] Uncomment this section to install additional vcpkg ports.
88
# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"
99

10-
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
10+
RUN apt-get update \
11+
&& apt-get -y install --no-install-recommends ca-certificates curl \
12+
&& curl --location --proto '=https' --tlsv1.2 --fail --silent --show-error \
13+
https://apt.llvm.org/llvm-snapshot.gpg.key \
14+
--output /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
15+
&& echo 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main' \
16+
> /etc/apt/sources.list.d/llvm.list \
17+
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
1118
&& apt-get -y install --no-install-recommends \
12-
build-essential ca-certificates clang-20 clang-format-20 clang-tidy-20 clang-tools-20 \
13-
clangd-20 curl libsqlite3-dev sqlite3 unzip
19+
build-essential clang-22 clang-format-22 clang-tidy-22 clang-tools-22 libclang-rt-22-dev \
20+
clangd-22 libsqlite3-dev sqlite3 unzip \
21+
&& rm -rf /var/lib/apt/lists/*
1422

1523
RUN CMAKE_ARCHIVE="cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" \
1624
&& curl --location --proto '=https' --tlsv1.2 --fail --silent --show-error \

AGENTS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ When writing C code, use the following naming conventions:
4444

4545
## Available clang tools
4646

47-
I've installed `clang-20`. There are a number of other tools installed, but they all have the version `-20` suffix:
47+
I've installed `clang-22`. There are a number of other tools installed, but they all have the version `-22` suffix:
4848

49-
* clang-tidy-20
50-
* clang-format-20
51-
* clang-apply-replacements-20
52-
* clang-query-20
49+
* clang-tidy-22
50+
* clang-format-22
51+
* clang-apply-replacements-22
52+
* clang-query-22
5353

5454
See `ls /usr/bin/clang*` for a full list.

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 4.3)
22

33
if(NOT DEFINED CMAKE_C_COMPILER)
4-
find_program(CMAKE_C_COMPILER NAMES clang-20 REQUIRED)
4+
find_program(CMAKE_C_COMPILER NAMES clang-22 REQUIRED)
55
endif()
66

77
project(StompyMUX LANGUAGES C)
@@ -49,12 +49,12 @@ option(BTECH_ENABLE_IWYU "Run Include What You Use during project compilation" O
4949

5050
if(BTECH_ENABLE_CLANG_TIDY)
5151
# Needs to understand C23 `constexpr`, which landed in Clang 19.
52-
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy-20 clang-tidy-19 clang-tidy REQUIRED)
52+
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy-22 clang-tidy REQUIRED)
5353
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
5454
endif()
5555

5656
if(BTECH_ENABLE_IWYU)
57-
find_program(IWYU_EXECUTABLE NAMES include-what-you-use-20 include-what-you-use REQUIRED)
57+
find_program(IWYU_EXECUTABLE NAMES include-what-you-use-22 include-what-you-use REQUIRED)
5858
set(BTECH_IWYU_COMMAND "${IWYU_EXECUTABLE}")
5959
endif()
6060

@@ -173,7 +173,7 @@ configure_file(src/cmake/version.h.in "${CMAKE_BINARY_DIR}/mux/server/version.h"
173173

174174
add_library(btmux_options INTERFACE)
175175
target_compile_options(btmux_options INTERFACE
176-
$<$<COMPILE_LANGUAGE:C>:-Wall -Wextra -Wno-unused-parameter -Werror -Wformat=2 -Wshadow>)
176+
$<$<COMPILE_LANGUAGE:C>:-Wall -Wextra -Wno-unused-parameter -Werror -Wno-gcc-install-dir-libstdcxx -Wformat=2 -Wshadow>)
177177
if(BTECH_ENABLE_ASAN)
178178
target_compile_options(btmux_options INTERFACE -fsanitize=address)
179179
target_link_options(btmux_options INTERFACE -fsanitize=address)

TODO

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,4 @@
3030

3131
## BTech Todos in the /btech/ dir
3232

33-
* Enum for special weapons effects?
34-
* Enums for sections?
35-
* Enums for parts and components instead of standalone constants?
3633
* Break commodities out of hcode?

docs/content/en/docs/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ Before compiling the sources and running your own game, you'll need to ensure th
2626
following dependencies are present:
2727

2828
* CMake 4.3 or higher
29-
* Clang 20 or higher
29+
* Clang 22 or higher
3030
* [Just](https://github.com/casey/just) 1.56 or higher
3131

3232
### Include What You Use
3333

3434
The optional `just iwyu` check requires an IWYU release built against the same
35-
Clang major version as the project. For Clang 20, install
36-
`libclang-20-dev`, then build and install IWYU 0.24 (the `clang_20` branch)
35+
Clang major version as the project. For Clang 22, install
36+
`libclang-22-dev`, then build and install IWYU 0.26 (the `clang_22` branch)
3737
from the [upstream repository](https://github.com/include-what-you-use/include-what-you-use).
38-
Make the executable available as `include-what-you-use-20`, or set `IWYU` to
38+
Make the executable available as `include-what-you-use-22`, or set `IWYU` to
3939
its path when running the check:
4040

4141
```shell

justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
33
build_dir := ".build"
44
iwyu_build_dir := ".iwyu-build"
55
build_type := env_var_or_default("CMAKE_BUILD_TYPE", "RelWithDebInfo")
6-
clang_tidy := env_var_or_default("CLANG_TIDY", "clang-tidy-20")
7-
run_clang_tidy := env_var_or_default("RUN_CLANG_TIDY", "run-clang-tidy-20")
8-
clang_format := env_var_or_default("CLANG_FORMAT", "clang-format-20")
9-
iwyu := env_var_or_default("IWYU", "include-what-you-use-20")
6+
clang_tidy := env_var_or_default("CLANG_TIDY", "clang-tidy-22")
7+
run_clang_tidy := env_var_or_default("RUN_CLANG_TIDY", "run-clang-tidy-22")
8+
clang_format := env_var_or_default("CLANG_FORMAT", "clang-format-22")
9+
iwyu := env_var_or_default("IWYU", "include-what-you-use-22")
1010
stylua := env_var_or_default("STYLUA", "stylua")
1111

1212
default: fmt build test install

src/btech/economy/unit_cost.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ unsigned long long mech_fasa_cost(Mech *mech) {
441441
: technology_secondary & STEALTH_ARMOR_TECH ? 50000
442442
: technology & HARDA_TECH ? 15000
443443
: technology_secondary & LT_FF_ARMOR_TECH ? 15000
444-
: technology_secondary & HVY_FF_ARMOR_TECH ? 25000
444+
: technology_secondary & HVY_FF_ARMOR_TECH ? 25000
445445
: 10000);
446446
#if COST_DEBUG
447447
btech_channel_send(

src/btech/movement/aero_move.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ land_data[] = {
8181
{CLASS_VTOL, 10, -60, -15, 15, 5, 0,
8282
"You bring your VTOL to a safe landing.", "lands.",
8383
"The rotor whines overhead as you lift off into the sky.", "takes off!"},
84-
{CLASS_AERO, 10, -30, MIN_TAKEOFF_SPEED *MP1, 999, 20, 10,
84+
{CLASS_AERO, 10, -30, MIN_TAKEOFF_SPEED * MP1, 999, 20, 10,
8585
"You land your AeroFighter safely.", "lands safely.",
8686
"The Aerofighter launches into the air!", "launches into the air!"},
87-
{CLASS_DS, 10, -25, MIN_TAKEOFF_SPEED *MP1, 999, 20, 300,
87+
{CLASS_DS, 10, -25, MIN_TAKEOFF_SPEED * MP1, 999, 20, 300,
8888
"The DropShip lands safely.", "lands safely.",
8989
"The DropShip's nose lurches upward, and it starts climbing to the sky!",
9090
"starts climbing to the sky!"},

src/btech/ui/mech_tactical_layout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void tactical_map_sketch(char *buffer, BattleMap *map, Mech *mech, int start_x,
3636
int display_columns, int top_offset, int left_offset,
3737
bool use_color, bool use_hex_los,
3838
bool show_underlying_terrain) {
39-
static const char hex_rows[2][310] = {
39+
static const char hex_rows[2][311] = {
4040
"\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/"
4141
"][\\][/]["
4242
"\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/][\\][/"

src/mux/lua/lua_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ extern const char *const LUA_EVENT_NAMES[LUA_EVENT_COUNT];
5555
extern const char *const LUA_LOCK_NAMES[LUA_LOCK_COUNT];
5656
extern const char *const LUA_LOCK_OPERATION_NAMES[LUA_LOCK_OPERATION_COUNT];
5757
extern const char *const LUA_MESSAGE_NAMES[LUA_MESSAGE_COUNT];
58-
extern const char
59-
*const LUA_MESSAGE_OPERATION_NAMES[LUA_MESSAGE_OPERATION_COUNT];
58+
extern const char *const
59+
LUA_MESSAGE_OPERATION_NAMES[LUA_MESSAGE_OPERATION_COUNT];
6060

6161
void lua_set_error(char *error, size_t error_size, const char *format, ...)
6262
__attribute__((format(printf, 3, 4)));

0 commit comments

Comments
 (0)