[core] check exclusive selection of FTD, MTD, or RADIO configs (#11376)

This commit adds a check in `instance.cpp` to ensure that exactly one
of the `OPENTHREAD_CONFIG_FTD`, `OPENTHREAD_CONFIG_MTD`, or
`OPENTHREAD_CONFIG_RADIO` configuration options is enabled. This
enforces a clear definition of the build type and prevents potential
conflicts or unexpected behavior arising from ambiguous or incorrect
configurations.
This commit is contained in:
Abtin Keshavarzian
2025-04-01 13:11:20 -07:00
committed by GitHub
parent 42fbcbde2c
commit ab6e241d90

View File

@ -40,6 +40,10 @@
namespace ot {
#if (OPENTHREAD_FTD + OPENTHREAD_MTD + OPENTHREAD_RADIO) != 1
#error "Exactly one of {OPENTHREAD_FTD, OPENTHREAD_MTD, OPENTHREAD_RADIO} MUST be set"
#endif
#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
// Define the raw storage used for OpenThread instance (in single-instance case).