-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
scripts/checkpatch: Check for patches adding #defines for libc APIs #60487
scripts/checkpatch: Check for patches adding #defines for libc APIs #60487
Conversation
scripts/checkpatch.pl
Outdated
_POSIX_SOURCE| | ||
_POSIX_C_SOURCE| | ||
_XOPEN_SOURCE| | ||
_XOPEN_SOURCE_EXTENDED| | ||
_ISOC99_SOURCE| | ||
_ISOC11_SOURCE| | ||
_ATFILE_SOURCE| | ||
_GNU_SOURCE| | ||
_BSD_SOURCE| | ||
_SVID_SOURCE| | ||
_DEFAULT_SOURCE |
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.
Non-blocking - prefer you alphabetize these.
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.
Good call. done.
scripts/checkpatch.pl
Outdated
@@ -6527,6 +6541,13 @@ sub process { | |||
} | |||
} | |||
|
|||
# check for #defines of various API specifying things like _POSIX_C_SOURCE |
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.
# check for #defines of various API specifying things like _POSIX_C_SOURCE | |
# check for feature test macros that request C library API extensions, violating rules A.4 and A.5 |
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.
always best to say 'why' and not 'what' in your commit messages. thanks for the fix.
e596e94
to
b459761
Compare
All code in the Zephyr core must use only the Zephyr C library API according to rules A.4 and A.5. Such code is not permitted to request API extensions from the C library via any of the API request mechanisms. This addition to checkpatch.pl verifies that patches don't #define any of these: __STRICT_ANSI__ _POSIX_SOURCE _POSIX_C_SOURCE _XOPEN_SOURCE _ISOC99_SOURCE _ISOC11_SOURCE _ATFILE_SOURCE _GNU_SOURCE _BSD_SOURCE _SVID_SOURCE _DEFAULT_SOURCE Reference: zephyrproject-rtos#49922 Signed-off-by: Keith Packard <[email protected]>
b459761
to
56593bc
Compare
our $api_defines = qr{(?x: | ||
_ATFILE_SOURCE| | ||
_BSD_SOURCE| | ||
_DEFAULT_SOURCE |
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.
@keith-packard missing pipe might be the culprit?
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.
It actually got moved to the end of the pattern when I sorted the symbols upon request from a reviewer... Checkout #60551 for the fix.
All code in the Zephyr core must use only the Zephyr C library API according to rules A.4 and A.5. Such code is not permitted to request API extensions from the C library via any of the API request mechanisms.
This addition to checkpatch.pl verifies that patches don't #define any of these:
Reference: #49922