仅当没有错误时 gcc 才会发出警告
是否可以告诉 gcc 显示所有警告(如 -Wall),但前提是没有错误?如果有错误 - 仅显示错误。
Is it possible to tell gcc to show all warnings (like with -Wall) but only if there are no errors? If there are errors - show only them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不这么认为。这将要求 GCC“缓存”所有警告,直到完成编译单元的处理,这听起来不太有用。
有像 colorgcc 这样的实用程序可以使 GCC 的输出在彩色终端中更加明显 - 也许你会发现有那么有用吗?
您可以使用
-Werror
将所有警告变成错误,从而消除问题,但这不是您想要的:-)I don't think so. That would require GCC to "cache" all the warnings until it's finished processing the compilation unit, which doesn't sound very useful.
There are utilities like colorgcc that make the output of GCC a bit more obvious in color terminals - maybe you would find that useful?
You could turn all the warnings into errors with
-Werror
, thus removing the problem, but that's not what you're after :-)