-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys: add auto_init includes treewide #18003
Conversation
I think this might be by design - which header do you need? |
The |
Ah ok - but better move the file to |
#define MY_MODULE_PRIO AUTO_INIT_PRIO_MOD_DUMMY_THREAD + 1 does not evaluate to a number because the preprocessor does not substitude the result. |
Something which would work, would be concatenation, but then the numeric comparability would be broken, which was requested in the original PR |
Huh, true, if I did |
I do have a question regarding how to add or change priorities going forward? If I can't refer to the macro values, then I at some point there is a new module pushed earlier than lets say |
hmm I´m sorry. I thought this was clear : / |
concatenation, something like this #define AUTO_INIT_PRIO_AFTER(base, position) EVAL(base) ## position
#define MY_MODULE_PRIO AUTO_INIT_PRIO_AFTER(AUTO_INIT_PRIO_MOD_DUMMY_THREAD, 1) or make the preprocessor do the math somehow. |
Just a kind of brute force idea: Have #define SUCCESSOR_1070 1071
#define SUCCESSOR(x) SUCCESSOR_ ## EVAL(x)
#define MY_MODULE_PRIO SUCCESSOR(AUTO_INIT_PRIO_MOD_DUMMY_THREAD) |
This would be zero overhead, but many lines of code and a bit ugly. |
Maybe such a header could be auto-generated for a given range of numbers. Other modules could also profit from preprocessor +1 addition and -1 subtraction. |
Yep, I was looking into those right now as well, does pre-procesor introduce a lot of overhead? I think we should think of two things:
If the compilation overhead is OK, then we could use |
I think we would not even notice a difference in compilation times. But I have never experimented with it. |
I think it would be worth the try, I'll put it on my todo list (although with low priority) |
Contribution description
Current headers are only visible in the
auto-init
compile unit, make them visible whenever the module is used.Testing procedure
green ci.