Skip to content

Conversation

kfessel
Copy link
Contributor

@kfessel kfessel commented Nov 11, 2022

Contribution description

this splits kernel defines by its concerns to ease the use of its parts

Testing procedure

read

Issues/PRs references

@kfessel kfessel requested a review from kaspar030 as a code owner November 11, 2022 12:15
@github-actions github-actions bot added the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Nov 11, 2022
@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 11, 2022
@kaspar030
Copy link
Contributor

how about we put them in one file per macro, named e.g., macros/NO_RETURN.h?

@riot-ci
Copy link

riot-ci commented Nov 11, 2022

Murdock results

✔️ PASSED

045bd7a core/lib: split kernel defines by its concerns

Success Failures Total Runtime
2002 0 2002 06m:30s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

@kfessel
Copy link
Contributor Author

kfessel commented Nov 11, 2022

how about we put them in one file per macro, named e.g., macros/NO_RETURN.h?

thought about that - but then i saw we can keep the NORETURN from conflicting with similar macros defined in pkgs if we just split by general concern.

@kfessel kfessel force-pushed the p-split-kernel-defines branch from 24f2943 to 045bd7a Compare November 11, 2022 12:41
@kaspar030
Copy link
Contributor

thought about that - but then i saw we can keep the NORETURN from conflicting with similar macros defined in pkgs if we just split by general concern.

yes, but, if they're all in one file, I know which file to include. If they are split into files with the same name, I know which to include.

But, if they're put into files according to "general concern", I have to grep a lot to find the right concern.
If I see #include "compiler_hints.h", I don't know why that was included.
And, the "general concern" might be debatable - is IS_CT_CONSTANT(x) a "compiler hint"?

I think I'd like to trade the searching with longer include lists.

Any other opinions?

@kfessel
Copy link
Contributor Author

kfessel commented Nov 11, 2022

I think I found a good split but also like get comments / opinions. I think there should be a split (maybe the lines are not yet optimal), i would also like to keep the "kernel_defines.h" like a collection header. And not force a transition to the split includes. But there are cases where you should not include "kernel_defines.h" but a subset is OK.

From my POV #include "kernel_defines.h" is should be avoided in public headers e.g.: in sys/include #include "modules.h"could be used there.

IS_CT_CONSTANT(expr) may not be a hint to the compiler but from it :)

(it also does not fit into modules version or container)

@kfessel
Copy link
Contributor Author

kfessel commented Nov 11, 2022

ARRAY_SIZE() might not be well placed in container.h

I searched github wher a define of the name might be: it can be found in util.h, libs.h and obviously most often it is uses to torture gcc.

https://github.com/search?q=%22define+array_size%22&type=Code

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and kernel_defines.h include still gets the application all defines.

@benpicco benpicco added the Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer label Nov 15, 2022
@benpicco benpicco merged commit cc7c525 into RIOT-OS:master Nov 15, 2022
@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: core Area: RIOT kernel. Handle PRs marked with this with care! CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants