core/thread_flags: remove #error from header file#13671
core/thread_flags: remove #error from header file#13671bergzand merged 1 commit intoRIOT-OS:masterfrom
Conversation
This commit removes the #error from the thread_flags header. This #error makes the usage of if(IS_USED(MODULE_THAT_DEPENDS_ON_THREAD_FLAGS)) pattern harder, because the error is triggered each time the header is included. If a module uses any thread_flags function it will fail in link time anyway.
don't include headers you don''t use? |
This leads to a lot of ugly |
This. You need to add the header files for that pattern: #include "A.h"
if (IS_USED(MODULE_A)) {
function_in_header_a();
}
another_function();It will fail if you didn't include "A.h" header. |
Yes, but as soon as we add |
Well, the function doesn't exist now, right? And as soon as someone add it, you only need to guard the function instead of a whole snippet of code. That's what it was done in #13669 |
Then we introduce that like this: |
|
And go! |
Contribution description
This commit removes the #error from the thread_flags header.
This #error makes the usage of
if(IS_USED(MODULE_THAT_DEPENDS_ON_THREAD_FLAGS)) pattern harder,
because the error is triggered each time the header is included.
If a module uses any thread_flags function it will fail in link time
anyway.
Testing procedure
Try removing the
core_thread_flagsdependency from any component that requires thread flags (e.g/tests/thread_flags_xtimer. It should fail.Issues/PRs references
#13669