Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

apparently wrong ifdef's lead to syntax errors in certain configurations

Hello,

I just managed to trigger a syntax error for a seemingly normal set of compiler flags / defines in ser_dbg_sd_str.c:

Compiling file: ser_dbg_sd_str.c 
../../../../../../components/serialization/common/ser_dbg_sd_str.c: In function 'ser_dbg_sd_call_str_get':
../../../../../../components/serialization/common/ser_dbg_sd_str.c:270:5: error: 'else' without a previous 'if'
     else
     ^~~~
make: *** [../../../../../../components/toolchain/gcc/Makefile.common:272: _build/nrf52840_xxaa/ser_dbg_sd_str.c.o] Error 1

SDK Version is nRF5 SDK v16.0.0

Getting rid of the else helps in my particular scenario case:


diff --git a/components/serialization/common/ser_dbg_sd_str.c b/components/serialization/common/ser_dbg_sd_str.c
index 92d6f91c..10fa11cc 100644
--- a/components/serialization/common/ser_dbg_sd_str.c
+++ b/components/serialization/common/ser_dbg_sd_str.c
@@ -267,7 +267,7 @@ const char * ser_dbg_sd_call_str_get(uint8_t opcode)
p_str = string[0];
}
#endif // ANT_STACK_SUPPORT_REQD
- else
+ //else
{
switch (opcode)
{
Related