This is a combination bug report / update request. The JN5189DK SDK (2.6.15) seems to have been at least partially written with C++ support in mind, as there are C++ include guards in many headers. Many others are missing though, and some of those that include C++ guards erroneously miss the closing statement.
For example, in `wireless/framework/Common/dbg.h`, the guard opens at top of file and closes inside a conditional block (#if (!defined JENNIC_CHIP_FAMILY_JN518x)). The conditional else block has no closing statement
#if defined __cplusplus
extern "C" {
#endif
#if (!defined JENNIC_CHIP_FAMILY_JN518x)
...
#if defined __cplusplus
};
#endif
#else /* JENNIC_CHIP_FAMILY is JN518x */
...
#endif
We are successfully building C++ applications, but the volume of changes required to add all of the guards makes migrating SDKs painful. Below is a non-exhaustive list of the errors and missing guards:
1. Missing closing braces:
- middleware/wireless/zigbee/ZigbeeCommon/Include/appZpsBeaconHandler.h
- middleware/wireless/framework/RNG/Interface/rnd_pub.h
- middleware/wireless/zigbee/ZCL/Clusters/OTA/Include/OTA.h
2. Completely missing guard
- middleware/wireless/zigbee/ZigbeeCommon/Include/ZQueue.h
- middleware/wireless/zigbee/ZigbeeCommon/Include/ZTimer.h
- middleware/wireless/zigbee/ZPSAPL/Include/zps_apl_zdo.h
- middleware/wireless/zigbee/ZPSAPL/Include/zps_apl_af.h
- middleware/wireless/zigbee/ZPSAPL/Include/zps_apl_aib.h
- middleware/wireless/zigbee/ZPSAPL/Include/zps_apl_zdp.h
- middleware/wireless/zigbee/framework/PDUM/Include/pdum_apl.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/Scenes.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/OnOff.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/Groups.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/MultistateInputBasic.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/Identify.h
- middleware/wireless/zigbee/ZCL/Clusters/General/Include/Basic.h
- middleware/wireless/zigbee/ZigbeeCommon/Include/portmacro_JN518x.h (probably also 517x, 516x)
Code generation and others
- startup_JN5189.c: This file needs to be compiled as c++ to trigger the __libc_init_array call, but ResetISR2 needs C linkage in this case.
Additionally:
- pdum_gen.h - no include guard
- zps_gen.h - no include guard
There are likely many others. This is just those that we needed to modify to get our code compiling as C++.
Thanks for taking a look.
Hello,
Thank you for your feedback, I will check this internally with the responsible team.
Regards,
Ana Sofia.