From 197bad6f5958f8671e409bdedd4a95b239906df8 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Wed, 5 Nov 2025 22:46:34 +0100 Subject: [PATCH] Update to clang-format-20 (#6521) --- .github/workflows/main.yml | 4 ++-- i3-config-wizard/main.c | 4 ++-- i3-dump-log/main.c | 3 +-- include/queue.h | 12 +++++------- include/xcb.h | 2 +- libi3/get_colorpixel.c | 2 +- testcases/inject_randr1.5.c | 2 +- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8312255..aa3e1655 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,8 +86,8 @@ jobs: run: ./release-notes/generator.pl - name: Install dependencies run: | - sudo apt-get install -y clang-format-15 + sudo apt-get install -y clang-format-20 - name: Check formatting - run: clang-format-15 --dry-run --Werror $(git ls-files '*.c' '*.h') + run: clang-format-20 --dry-run --Werror $(git ls-files '*.c' '*.h') - name: Verify safe wrapper functions are used run: ./travis/check-safe-wrappers.sh diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index 96baff00..5d08ca21 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -75,9 +75,9 @@ xcb_visualtype_t *visual_type = NULL; #define WIN_HEIGHT (15 * font.height + TEXT_PADDING) #define col_x(col) \ - (((col)-1) * char_width + TEXT_PADDING) + (((col) - 1) * char_width + TEXT_PADDING) #define row_y(row) \ - (((row)-1) * font.height + TEXT_PADDING) + (((row) - 1) * font.height + TEXT_PADDING) enum { STEP_WELCOME, STEP_GENERATE } current_step = STEP_WELCOME; diff --git a/i3-dump-log/main.c b/i3-dump-log/main.c index c62df438..35872ccd 100644 --- a/i3-dump-log/main.c +++ b/i3-dump-log/main.c @@ -96,8 +96,7 @@ int main(int argc, char *argv[]) { {"follow", no_argument, 0, 'f'}, #endif {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0} - }; + {0, 0, 0, 0}}; #if !defined(__OpenBSD__) char *options_string = "s:vfVh"; diff --git a/include/queue.h b/include/queue.h index 9b410449..1cff6467 100644 --- a/include/queue.h +++ b/include/queue.h @@ -96,7 +96,7 @@ } #define SLIST_HEAD_INITIALIZER(head) \ - { NULL } + {NULL} #define SLIST_ENTRY(type) \ struct { \ @@ -174,7 +174,7 @@ } #define LIST_HEAD_INITIALIZER(head) \ - { NULL } + {NULL} #define LIST_ENTRY(type) \ struct { \ @@ -256,7 +256,7 @@ } #define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } + {NULL, &(head).sqh_first} #define SIMPLEQ_ENTRY(type) \ struct { \ @@ -322,7 +322,7 @@ } #define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + {NULL, &(head).tqh_first} #define TAILQ_ENTRY(type) \ struct { \ @@ -447,9 +447,7 @@ #define CIRCLEQ_HEAD_INITIALIZER(head) \ { \ - CIRCLEQ_END(&head) \ - , CIRCLEQ_END(&head) \ - } + CIRCLEQ_END(&head), CIRCLEQ_END(&head)} #define CIRCLEQ_ENTRY(type) \ struct { \ diff --git a/include/xcb.h b/include/xcb.h index b3068e18..d469d8ef 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -31,7 +31,7 @@ /** The XCB_CW_EVENT_MASK for its frame */ #define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \ - XCB_EVENT_MASK_BUTTON_RELEASE | \ + XCB_EVENT_MASK_BUTTON_RELEASE | \ XCB_EVENT_MASK_POINTER_MOTION | /* …mouse is moved */ \ XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \ XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* …the frame gets destroyed */ \ diff --git a/libi3/get_colorpixel.c b/libi3/get_colorpixel.c index f985103d..e147b793 100644 --- a/libi3/get_colorpixel.c +++ b/libi3/get_colorpixel.c @@ -61,7 +61,7 @@ uint32_t get_colorpixel(const char *hex) { } } -#define RGB_8_TO_16(i) (65535 * ((i)&0xFF) / 255) +#define RGB_8_TO_16(i) (65535 * ((i) & 0xFF) / 255) int r16 = RGB_8_TO_16(r); int g16 = RGB_8_TO_16(g); int b16 = RGB_8_TO_16(b); diff --git a/testcases/inject_randr1.5.c b/testcases/inject_randr1.5.c index 3550bd86..e96f95a3 100644 --- a/testcases/inject_randr1.5.c +++ b/testcases/inject_randr1.5.c @@ -54,7 +54,7 @@ static struct injected_reply getmonitors_reply = {NULL, 0}; static struct injected_reply getoutputinfo_reply = {NULL, 0}; /* END RandR 1.5 specific */ -#define XCB_PAD(i) (-(i)&3) +#define XCB_PAD(i) (-(i) & 3) struct connstate { /* clientw is a libev watcher for the connection which we accept()ed. */