-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang tidy: round 2 #662
Clang tidy: round 2 #662
Conversation
3717f13
to
56f33fc
Compare
Well, no chance here. The |
The issue is that my Not sure I want to dig how to make it compatible with earlier versions, or maintain two config versions. Maybe just deactivate it for now. |
7eab026
to
635cd6c
Compare
Removed the clang-tidy CI, we’ll deal with it in a further PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/x11/keymap.c
Outdated
@@ -197,7 +197,7 @@ translate_action(union xkb_action *action, const xcb_xkb_action_t *wire) | |||
case XCB_XKB_SA_TYPE_SET_GROUP: | |||
action->type = ACTION_TYPE_GROUP_SET; | |||
|
|||
action->group.group = wire->setgroup.group; | |||
action->group.group = (int32_t) wire->setgroup.group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC setgroup->group is an int8_t, so why does clang-tidy wants a cast here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual warning:
../src/x11/keymap.c:200:31: warning: 'signed char' to 'int32_t' (aka 'int') conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
200 | action->group.group = wire->setgroup.group;
| ^
../src/x11/keymap.c:213:31: warning: 'signed char' to 'int32_t' (aka 'int') conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
213 | action->group.group = wire->latchgroup.group;
| ^
../src/x11/keymap.c:226:31: warning: 'signed char' to 'int32_t' (aka 'int') conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
226 | action->group.group = wire->lockgroup.group;
| ^
From the doc about bugprone-signed-char-misuse
:
When the code contains an explicit
signed char
-> integer conversion, the human programmer probably expects that the converted value matches with the character code (a value from[0..255]
), however, the actual value is in[-128..127]
interval. To avoid this kind of misinterpretation, the desired way of converting from asigned char
to an integer value is converting tounsigned char
first, which stores all the characters in the positive[0..255]
interval which matches the known character codes.
The issue is that int8_t
is just a typedef, so we get this unrelated warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added int8_t
to the option CharTypdefsToIgnore
in .clang-tidy
to avoid the explicit cast.
635cd6c
to
b6f6514
Compare
CI will pass once #661 is merged.EDIT: removed clang-tidy CI.