【问题标题】:Inlining warning内联警告
【发布时间】:2010-03-07 00:00:30
【问题描述】:

在 64 位 Linux 机器上编译后,我收到内联警告。编译器是:

gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1

警告是:

warning: inlining failed : call is unlikely and code size would grow
warning: called from here
warning: inlining failed: call is unlikely and code size would grow
warning: called from here
warning: inlining failed: call is unlikely and code size would grow
warning: called from here
warning: inlining failed: call is unlikely and code size would grow

我搜索了它并使用 -Winline 选项编译它。但还没有找到解决办法。我正在寻找摆脱它的方法。如何摆脱它?

slightly edited on 9th May 2010

我已经发布了我很久以前就面临的上述问题。我仍在寻找解决方案。我尝试从函数中删除所有 inline 。这导致不使用代码中定义的许多函数,例如:

warning: function  defined but not used

我认为删除 inline_ 甚至降低了代码的性能(速度)。有人可以为上述问题提出一些想法吗?

有没有什么优化方法可以不降低性能,也可以去掉这个警告。

【问题讨论】:

    标签: gcc inline compiler-warnings


    【解决方案1】:

    编译器认为内联这些函数是个坏主意。

    inline 关键字只是一个建议,编译器不必遵循它。据推测,编译器会警告您它决定忽略 inline 关键字。

    【讨论】:

    • 有没有办法摆脱它?或者只是我们必须忽略它,或者有什么方法可以抑制这些警告?我不确定取消警告是否明智。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    • 2016-09-28
    • 2014-08-29
    • 1970-01-01
    相关资源
    最近更新 更多