gnrc_ipv6_nib: remove parenthesis from boolean configs#13605
gnrc_ipv6_nib: remove parenthesis from boolean configs#13605leandrolanzieri merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
Isn't this against our coding conventions? |
Hmm I could not find a reference to this. What I see is section 12.4 in Linux's coding style, is:
|
Well, I assumed until now, that definess should always have parenthesis around the value (that's why I do it all the time), so I'd like to have some clarity on that before merging this. Maybe I was just assuming it, because in the past @OlegHahm was quite insistent on explicit parenthesization. |
|
Also: shouldn't |
The doc shows that parenthesis are not supported |
What is the reason for this? Preprocessor restrictions? |
Because of the way it works, it pastes the RIOT/core/include/kernel_defines.h Lines 186 to 197 in 7943187 Maybe there could be a way to strip the parentheses before evaluating, but I'm not really sure how that would work :/ |
Have to research that myself, but IIRC there is a macro that reduces a marco to this final value. Can't we use that? |
For expressions it totally makes sense: However for booleans, there's no case where this might happen. And it still aligns with Linux conventions. |
|
Mh, but couldn't this lead to cases that through some inattentive combination of macros #define FOO 1
#define BAR 0could become |
Hmmm but in this case (1)(0) would also produce an error. |
Exactly, which is preferable over using an accidentally wrongly created value. |
|
On the other hand... This seems to be an old discussion (the linked one comes to the conclusion "value defines without parenthesis are actually safer). So given that we have differing conclusions and I don't remember exactly the details, why I am following this cargo-cult, I won't block this anymore (actually I never did, but I won't hit the green button ;-)) |
Ok then, let's go with this. |
Contribution description
This PR removes all parenthesis from boolean configurations of GNRC IPv6 NIB.
These parenthesis doesn't allow the usage of the IS_ACTIVE macro, and when these values are exposed in Kconfig they won't have a parenthesis anyway.
This issue was detected by Murdock in #13226
Testing procedure
Murdock tests should be enough
Issues/PRs references