如何运行GCC / Clang进行静态分析? (仅警告) [英] How can I run GCC/Clang for static analysis? (warnings only)

查看:107
本文介绍了如何运行GCC / Clang进行静态分析? (仅警告)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无需编译代码,我希望GCC或Clang报告警告。

是否可以仅运行编译器进行静态分析?

我找不到方法传递编译器警告标志并告诉它不编译。

Without compiling code, I would like GCC or Clang to report warnings.
Is it possible to run the compiler for static analysis only?
I can't find a way to pass the compiler warning flags and tell it not to compile.

编辑:刚刚发现clang有一个静态分析器


edit: just found that clang has a static analyser

推荐答案

GCC和Clang都有一个选项 -fsyntax-only 编译器只执行语法检查而没有任何实际的编译。

Both GCC and Clang have an option -fsyntax-only that makes the compiler only perform syntax checking without any actual compilation.

这篇关于如何运行GCC / Clang进行静态分析? (仅警告)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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