如何在CDT(C代码)中逐行警告中关闭静态代码分析警告? [英] How do I turn off a static code analysis warning on a line by line warning in CDT (C code)?

查看:132
本文介绍了如何在CDT(C代码)中逐行警告中关闭静态代码分析警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个在Eclipse中使用CDT的项目。这是一个我们刚刚导入Eclipse的旧项目,我想确保我们开始使用静态代码分析来查找任何异常。



事情是,有一堆的行,触发我们要忽略的警告,主要的是在switch语句中的突破。



我知道如何做这个lint,但是呢CDT?



示例:(在案件结束时不休息)

  case enChA:
nChannel ++;
//我想忽略这个下降
case enChB:
nChannel ++;
//这一个...
case enChC:
nChannel ++;
//这一个...
case enChD:
nChannel ++;
//做一些更多的东西...
break;


解决方案

您应该尝试

  // no break 

before下一个例子。


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;

解决方案

You should try

//no break

before the next case.

这篇关于如何在CDT(C代码)中逐行警告中关闭静态代码分析警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆