Reply
Posts: 3,021
Registered: ‎02-07-2002

No break at the end of case

Eclipse complains when there is a FALLTHROUGH in a switch statement with the message "No break at the end of case". It appears that you can suppress this with

// no break

/* no break */

/* no break at the end of case */

If you want to use the apparent lint default of /* FALLTHROUGH */ or /* -fallthrough */ you have to edit eclipse settings.

 

I did not know about all this, but then I didn't use Eclipse for C before I started using Simplicity Studio. But the developers SiLabs also don't seem to know this. E.g. in em_cmu.c this warning appears and the comment is: /* Fall through and select clock source */ which is not one of the above. Could it be that they don't use Simplicity Studio themselves? Or they did not care that their code gives warnings in their own tool? Let's hope they were just too busy to look this up and reading along right now so this can be fixed Robot Happy

 

Maarten

Posts: 394
Registered: ‎12-05-2016

Re: No break at the end of case

Hi Maarten,

 

Thank you for reporting this issue.  I have created a bug report for it.

 

Note in the Case Analysis preferences for the "No break at end of case" check, the comment text used to suppress the warning defaults to "no break", so any of the first three examples you site would match that criteria.

 

Silicon Labs runs their code through the IAR C-Stat analysis tool and it isn't case sensitive in the check and allows either a single word 'fallthrough' or two words 'fall through' to suppress the warning.

 

Thank you,

jpitt

Posts: 3,021
Registered: ‎02-07-2002

Re: No break at the end of case

Thanks for passing this on. The three examples indeed do work. I also found out that Eclipse is quite picky about them when it comes to placement. You can't place another comment after these lines. If IAR C-Stat behaves the same then you won't be able to satisfy both since only one line can be the last.