Skip to content

Format the code using clang-format#890

Merged
whot merged 2 commits intolinuxwacom:masterfrom
whot:wip/clang-format
Jul 9, 2025
Merged

Format the code using clang-format#890
whot merged 2 commits intolinuxwacom:masterfrom
whot:wip/clang-format

Conversation

@whot
Copy link
Member

@whot whot commented Jun 24, 2025

The style is fairly close to what we have and at least enforces a consistent
coding style. The only true change in style is no indentation for case
in switch statements, the rest is a combination of styles we already
used in one place or another, just not consistently.

There are a handful of outliers that I'm not very happy with (e.g. the __attribute__(printf) being split up and clang-format apparently being unable to align function argument names which I quite liked. But hey, just like ruff and cargo fmt it's better to have something that's not perfect but at least consistent.

Closes #868

version 6.10 is currently the most recent one with changes, subsequent
releases do not change this file.

A few more key codes that we don't need ourselves but this fixes
compilation issues that occur depending on the include file order:

[1/13] Compiling C object libwacom.so.9.0.0.p/libwacom_libwacom-database.c.o
In file included from ../libwacom/libwacom-database.c:33:
../include/linux/input-event-codes.h:280:9: warning: ‘KEY_DASHBOARD’ redefined
  280 | #define KEY_DASHBOARD           204     /* AL Dashboard */
      |         ^~~~~~~~~~~~~
In file included from /usr/include/linux/input.h:18,
                 from /usr/include/libevdev-1.0/libevdev/libevdev.h:33,
                 from ../libwacom/libwacom-database.c:32:
/usr/include/linux/input-event-codes.h:282:9: note: this is the location of the previous definition
  282 | #define KEY_DASHBOARD           KEY_ALL_APPLICATIONS
@whot whot force-pushed the wip/clang-format branch from f0218ff to f01527b Compare June 24, 2025 23:18
@whot
Copy link
Member Author

whot commented Jun 24, 2025

Note that I'll add a .git-blame-ignore-revs file later once we have the fixed commit sha so git blame will simply ignore this commit.

This is fairly close to what we have and at least enforces a consistent
coding style. The only true change in style is no indentation for case
in switch statements, the rest is a combination of styles we already
used in one place or another, just not consistently.
@whot whot force-pushed the wip/clang-format branch from f01527b to 774148b Compare July 4, 2025 01:48
@whot whot added this pull request to the merge queue Jul 9, 2025
Merged via the queue into linuxwacom:master with commit a51a03e Jul 9, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consistent use of foo() vs foo ();

1 participant