[style] harmonize feature check and header includes (#6399)

This commit harmonizes how the feature config checks are done within
OT core modules. In header `.hpp` files, any related `#if` config
check is done immediately after the `"openthread-core-config.h"` is
included. This way the rest of definitions are skipped over if the
feature is not being used. In `cpp` source files the `#if` check is
done immediately after including the related header file.
This commit is contained in:
Abtin Keshavarzian
2021-04-05 14:13:24 -07:00
committed by GitHub
parent 29f6f275b8
commit 743e91361c
111 changed files with 299 additions and 176 deletions
+3 -1
View File
@@ -33,6 +33,8 @@
#include "openthread-core-config.h"
#if OPENTHREAD_FTD || OPENTHREAD_MTD
#include <openthread/thread.h>
#include "common/debug.hpp"
@@ -42,7 +44,6 @@
using namespace ot;
#if OPENTHREAD_FTD || OPENTHREAD_MTD
uint32_t otThreadGetChildTimeout(otInstance *aInstance)
{
Instance &instance = *static_cast<Instance *>(aInstance);
@@ -515,4 +516,5 @@ void otThreadRegisterParentResponseCallback(otInstance * aInst
instance.Get<Mle::MleRouter>().RegisterParentResponseStatsCallback(aCallback, aContext);
}
#endif // OPENTHREAD_FTD || OPENTHREAD_MTD