C ++中标头包含的静态分析 [英] Static analysis of header inclusion in C++

查看:158
本文介绍了C ++中标头包含的静态分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我经常在从一个Linux安装迁移到另一个Linux或从一个unix迁移到另一个UNIX时发现我的代码,但我发现我错过了包含某些头文件的信息.

It seems that often I find that my code when moving either from one linux installation to another or from one unix to another, I find that I've missed including certain header files.

当您将源代码提供给其他人并希望他们能够很好地编译它时,这往往会变得很烦人,只是由于缺少头文件包含而导致源代码失败.

This tends to become annoying when you give the source to someone else expecting them to be able to compile it just fine, only for it to fail because of missing header file includes.

是否有任何静态分析工具可以检测应该在当前似乎已隐含包含的标头中显式包含的标头?有什么方法可以禁用头文件的隐式包含吗?

Are there any static analysis tools that can detect headers that should be explicitly included where they're currently seem to be implicitly included? Is there some way to disable this implicit inclusion of header files?

我还要检测包含的头文件,这些头文件可能由于代码更改而变得多余,不再需要.

Also I'd like to detect header files that included and may have become redundant through code changes, and are no longer required.

推荐答案

我使用了 checkheaders 取得了一些成功.去年的发展似乎有所放缓,但仍然可以使用.也许最好使用trunk版本.

I have used checkheaders with some success. Development seems to have slowed down some in the last year, but it is still usable. Probably it's best to use the trunk version.

这篇关于C ++中标头包含的静态分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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