-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Make syscall internal implementation visibility consistent #12220
Conversation
Syscall internal implementations were spread across headers, as static inline, and C sources. The generated syscall code was declaring all internal _impl_ as an extern function because of the ones implemented in C sources. This was violating MISRA-C rule 8.8 in the cases internal functions were implemented in the headers. This patch put all internal implementations inside C sources. MISRA-C rule 8.8 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
When userspace was not defined the functions k_object_access_revoke and k_object_access_all_grant were being defined twice and with different visibility. MISRA-C rule 8.8 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
API brief explanation was wrong. It was saying that this function grant, instead of revoking, access to a thread. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Codecov Report
@@ Coverage Diff @@
## master #12220 +/- ##
==========================================
- Coverage 48.3% 48.25% -0.06%
==========================================
Files 293 294 +1
Lines 44136 44126 -10
Branches 10591 10589 -2
==========================================
- Hits 21318 21291 -27
- Misses 18552 18566 +14
- Partials 4266 4269 +3
Continue to review full report at Codecov.
|
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.
All those tiny, isolated functions and the calls to them would strike me as a pretty large increase to code size, no? Isn't there a way to do this that preserves the inlinability? That is, it seems you fixed the "function is defined as both extern and static inline" by making everything extern. Can't we do the opposite?
Maybe have a "NODECLARE" syscall declaration variant that doesn't export the API itself and relies on the user to do it?
I haven't had a chance to delve into this part of Zephyr yet, and don't know if the following is consistent with MISRA-C, but: Assuming you require C11 conformance, you can just remove E.g. in
Then in
which provides an external definition without needing to duplicate the definition body. In modern C this is the preferred approach over having It would make things much nicer if Zephyr did require C11. Since it's seven years old we should be able to expect all toolchains to support it. |
Hi, C11 has several cool things but unfortunately MISRA-C is based on either C99 or C89. We're focusing in C99 right now.h |
@andyross That was my second option, the drawback was increase the complexity in scripts that generate the code (but not that much). This one moved more code but is just simpler. |
actually my idea was a little bit different. It was adding a new keyword |
why are we moving all those syscall definitions under kernel/? |
didn't know a better place to put these implementations. Anyway, I'm changing the approach, I'll send a new pr with the other solution so we can discuss which one is better |
Closing this. |
Syscall internal implementations were spread across headers, as static
inline, and C sources. The generated syscall code was declaring all
internal impl as an extern function because of the ones implemented
in C sources. This was violating MISRA-C rule 8.8 in the cases
internal functions were implemented in the headers.