如何检测未使用的宏定义与放大器;类型定义? [英] How do I detect unused macro definitions & typedefs?

查看:132
本文介绍了如何检测未使用的宏定义与放大器;类型定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以很容易地获取列表未使用的函数和变量与接头的反馈,但我怎么能检测到那些未使用的宏定义与放大器;类型定义?我一定要浏览线和git的grep的code线在整个项目?

It's easy to get a list unused functions and variables with linker feedback, but how can I detect those unused macro definitions & typedefs? Do I have to browse the code line by line and git grep in the whole project?

推荐答案

C和C ++程序静态分析工具可能包括未使用的preprocessor宏的检查。

Static analysis tools for C and C++ programs may include a check on unused preprocessor macros.

比如看 PC - 皮棉

另一种可能性是进入具体包括文件,并使用#IFDEF 0删除宏大段,然后再检查使用的一种鸿沟的编译器错误而治之算法。不过,我会期望一个静态分析工具将是更好的方法为源$ C ​​$ C尺寸变大。

Another possibility would be to go into specific include files and use #ifdef 0 to remove large sections of macros and then review the compiler errors using a kind of divide and conquer algorithm. However I would expect that a static analysis tool would be much better approach as the source code size becomes large.

这篇关于如何检测未使用的宏定义与放大器;类型定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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