-
Notifications
You must be signed in to change notification settings - Fork 7.9k
checkpatch: add 2 new rules to enforce capitilization in macro constants #95904
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
base: main
Are you sure you want to change the base?
Conversation
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.
Verified that it fixes the issue I raised.
I tried the patch with
#define DUM_DUM_val 5
#define dum_dum_val 5
and only dum_dum_val
failed; i.e. it does not seem to catch DUM_DUM_val
- Detects #define statements with lowercase macro names - Detects enum labels starting with lowercase letters Fixes zephyrproject-rtos#95679 Signed-off-by: Anas Nashif <[email protected]>
7b34e4b
to
9ed2be7
Compare
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 latest patch seem to give the expected result
WARNING : Test Checkpatch warning:
MACRO_CASE: Macro name 'DUM_DUM_val' should be capitalized (names of macros defining constants should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:49
WARNING : Test Checkpatch warning:
MACRO_CASE: Macro name 'dum_dum_val' should be capitalized (names of macros defining constants should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:50
WARNING : Test Checkpatch warning:
ENUM_CASE: Enum label 'dummy_val' should be capitalized (names of labels in enums should be capitalized)
File:include/zephyr/bluetooth/bluetooth.h
Line:53
|
my $enum_name = $1; | ||
my $in_enum = 0; | ||
# Look back to see if we're inside an enum | ||
for (my $ln = $linenr - 1; $ln >= $linenr - 20 && $ln >= 0; $ln--) { |
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 searching back 20 lines enough?
zephyr/arch/xtensa/core/gdbstub.c
Line 25 in df0cb36
enum { |
Fixes #95679
Signed-off-by: Anas Nashif [email protected]