如何使用 gcc 的内联报告(-Winline)
在我的项目上启用 -Winline
会产生大量我不太理解的输出。有谁知道如何使用此输出来找出为什么我的特定函数没有内联?
Enabling -Winline
on my project produces a whole lot of output which I don't really understand. Does anyone know how to use this output to figure out why my particular function wasn't inlined?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,根据我的 gcc 手册页......
我不相信你可以强制编译器内联你的函数;当编译器更新时,它的实现细节甚至可能会发生变化。此外,只要编译器的选择使您的函数运行得更快,您是否有任何特殊原因关心该函数是否实际上是内联的?
当然,如果您出于某种原因确实想要内联函数,您可能只需使用宏来执行此操作。
Well, according to my gcc man page...
I don't believe that you can force the compiler to inline your function; it's an implementation detail that could even change when the compiler is updated. Besides, as long as the compiler's choice causes your function to run faster, is there any particular reason that you care whether the function is actually inlined or not?
Of course, if you really want to inline your function for some reason, you could probably just use a macro to do so.