Search code examples
ceclipseeclipse-cdt

How do I turn off a static code analysis warning on a line by line warning in CDT (C code)?


We have a project using CDT in Eclipse. It's an old project that we just imported into Eclipse, and I want to ensure we start using static code analysis to find any weirdnesses.

The thing is, there are a bunch of lines that trigger warnings that we want to just ignore, with the main ones being fallthroughs within switch statements.

I know how to do this for lint, but what about for CDT? Is there a single-line comment that I can put right above the line?

Example: ("No break at the end of case")

  case enChA:  
    nChannel++;
    // I want to ignore this fallthrough       
  case enChB:      
    nChannel++;
    // And this one...
  case enChC:
    nChannel++;
    // And this one...
  case enChD:
    nChannel++;
    // do some more stuff...
    break;

Solution

  • You should try

    //no break
    

    before the next case.