使用 GCC,我可以在每个函数的基础上禁用 -Wframe-larger-than 吗?
使用 GCC,是否可以指定一组免于 -Wframe-larger-than 的函数? (例如,主要。)
Using GCC, is it possible to specify a set of functions that are exempt from -Wframe-larger-than? (For example, main.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GCC 为此目的提供了编译指示:
http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
目前它不会完全按照你想要的方式做,因为它似乎做到了逐个文件地进行,但在下一版本的 gcc (4.6) 中,它看起来好像是上下文感知的:
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
GCC supplies you with pragmas for this purpose:
http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
Currently it won't do exactly what you want, since it seems to do it on a file by file basis, but in the next version of gcc (4.6), it appears as though it is context aware:
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
这有点旧了,但我发现它正在寻找相同的答案,所以我想我应该发布我的解决方案(通过反复试验发现):
似乎有效。由于某种原因,尝试使用
诊断警告
不起作用。似乎不可能更改生成警告的堆栈大小。另外,最后还需要=。也许下一个人会发现这个并为自己节省一些时间:)。这是 4.6.2(在 ARM 交叉编译器上)。约翰
This is a bit old, but I came across it looking for the same answer, so I thought I'd post my solution (found by trial and error):
seems to work. For some reason, trying to use
diagnostic warning
did not work. It does not seem possible to change the stack size that generates the warning. Also, you need the = at the end. Maybe the next guy will find this and save themselves some time :). This is 4.6.2 (on an ARM cross compiler).John
您可以使用 GCC 诊断编译指示。
You can use the GCC diagnostic pragma.