6

I'm using Eclipse (Luna SR 2) to write a C++ application. How do I disable the "No break at the end of case" compile warning, ideally for a specific section of code? It's annoying because our coding standard requires zero warnings and I want my cases to fall through, so I don't have to needlessly duplicate code. Is there a way to do this with pragmas?

Jim Fell
  • 13,750
  • 36
  • 127
  • 202
  • 3
    [This](http://stackoverflow.com/questions/16935935/how-do-i-turn-off-a-static-code-analysis-warning-on-a-line-by-line-warning-in-cd) is for code analysis so I am not sure if it is a dupe but it is worth a try. – NathanOliver Sep 09 '16 at 12:02
  • 2
    That depends on the compiler you're using, not on the IDE. What do you compile the code with? – Angew is no longer proud of SO Sep 09 '16 at 12:02
  • http://stackoverflow.com/questions/16935935/how-do-i-turn-off-a-static-code-analysis-warning-on-a-line-by-line-warning-in-cd this could be your Solution – Lord_Curdin Sep 09 '16 at 12:03

1 Answers1

26

Typing //no break should work just fine.

If you want to change that, you can try going to: Window -> Preferences -> C/C++ -> Code Analysis Then choose No break at the end of case and edit //no break to what you want.

I found this StackOverflow question, that should answer your question.

Hope you found this useful,

Alex

Alex P.
  • 488
  • 5
  • 12
  • 1
    In my case (`Atollic TrueSTUDIO for ARM`) even after inserting the `// no break` (I also tried `/* no break */`) the warning was stuck until I cut the whole `case` block and pasted it back. – nurchi Nov 03 '17 at 15:53
  • @nurchi, this solved my problem for TI Code Composer Studio v10.3.0. It also works if I use the syntax `// fall through`. Thanks. – sifferman Aug 31 '21 at 22:29
  • `// Fall-through` (common for Java) or `// fall through` didn't work in my Eclipse, but `// No break` works (formatted it a little nicer) – Mark Jeronimus Jan 25 '22 at 09:05