简体   繁体   English

我应该担心g ++警告说“内联失败”吗?

[英]Should I be worried about g++ warnings saying 'inlining failed'?

In a project I'm working on at the office, when we compile a release build (with -Os) we get hundreds of warnings from g++ saying that inlining has failed. 在我正在办公室工作的一个项目中,当我们使用-Os编译发行版时,我们从g ++收到数百条警告,指出内联失败。 Most of these warnings seem to come from boost, however some come from our own library headers (binary .dylibs that we're linking to). 这些警告中的大多数似乎来自增强,但是有些来自我们自己的库头文件(我们链接到的二进制.dylibs)。 Can these warnings generally be safely ignored, or are they something I should be worried about? 通常可以安全地忽略这些警告,还是我应该担心的警告?

Note: We're using g++ 4.0 on Mac OS X 注意:我们在Mac OS X上使用g ++ 4.0

g++ is alerting at what's essentially, strictly a PERFORMANCE problem -- you're requesting inline implementations that just can't be inlined. G ++是在提醒什么是本质,严格意义上的性能问题-你的要求inline实现,只是不能被内联。 If your use of inline doesn't really matter, you should remove it (compilers ARE able to inline functions without that hint, you know!-), but in terms of code correctness, you can ignore the warning. 如果inline的使用并不重要,则应将其删除(编译器可以在没有该提示的情况下内联函数!),但是就代码正确性而言,您可以忽略该警告。 If your use of inline really DOES matter, ie, is crucial to your performance (as opposed to being a silly premature optimization), the warning is telling you to rework your code so it can be achieved (worst case, by moving down to macros -- sigh, but, when you must, you MUST!-). 如果inline的使用确实很重要,即对性能至关重要(相对于愚蠢的过早优化而言),则警告是告诉您重新编写代码,以便可以实现(最坏的情况是,向​​下移动到宏) -叹息,但是,当你必须时,你必须!-)。

It should be save if you not 如果没有,应该保存

  • hit a bug in gcc 碰到gcc中的错误
  • anticipate inlined functions in your code 预期代码中的内联函数
  • try to do nasty things 尝试做讨厌的事情

You should try to minimize warnings though. 但是,您应该尽量减少警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM