sys/drivers: guard l2filter.h, netstats.h includes#7079
sys/drivers: guard l2filter.h, netstats.h includes#7079kaspar030 merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
I still don't see the point to be honest. |
|
Also (stemming from this) I don't understand when I should put the header into |
|
Actually, I think the rule is quite simple: if module A depends on module B, no guards around the includes of B's header(s) are needed. In case module A used module C conditionally/optionally, the header(s) of C should be guarded. Examples of A using B(s):
Examples of A using C conditionally:
So to my understanding (and after looking around RIOT some more), we already do escape optional headers in parts of RIOT -> see So it seemed to me, that the case with Opinions? |
|
I agree with you @haukepetersen. The rule of thumb should be: only include what you use. |
|
just curious: but why don't move the This would avoid clumsy |
Yes. This is also a prerequisite for out-of-tree modules. The header of a module might not be available if the module (/ package) is not built. |
IMO that's the price of conditional compilation at this level. |
Sure, but in case of netstats and L2filter modules it could be somewhat optimized (?) by putting the conditions directly into the header files. However, you are right: for external packages this would not work. |
It might optimize readability slightly. It would de-optimize other things. Imagine a build system that rebuilds reliably only needed stuff (not needing edit There's a reason we don't just do |
|
@kaspar030 good point! Unnecessary rebuilds are suboptimal ... |
|
So do I read it correctly here, that we close in to a common understanding of # |
|
Begrudgingly 👍 |
|
I added a bullet point to the coding conventions: https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions#includes -> feel free to improve! So anyone now willing to ACK this PR? |
7eb8b62 to
40003b8
Compare
|
fixed issue with gnrc_ipv6_netif... |
sys/include/net/gnrc/ipv6/netif.h
Outdated
| */ | ||
| void gnrc_ipv6_netif_init_by_dev(void); | ||
|
|
||
|
|
There was a problem hiding this comment.
nitpicky: why was this introduced?
40003b8 to
d488fdc
Compare
|
fixed newline issue |
|
&go. |
as discussed in #7066, it does not hurt to include
netstats.handl2filter.honly if their modules are actually being build.