gcc 编译期间收到内联失败警告
函数静态内联时出现以下警告的原因是什么?以下
inlining failed to while calling the function: The code size may grow.
是头文件中定义的一种函数。我怎样才能摆脱上述警告。
static __inline___ getSomething(){
return something;
}
编辑
是的,我尝试删除 inline
,但我收到以下警告
function getSomething defined but not used.
有没有办法删除这两个警告?
[编辑]
-g -Wno-unused -g -ansi -pedantic -Wall -Wshadow -Wpointer-arith -Wwrite-strings
What is the reason for the following kind of warning
inlining failed to while calling the function: The code size may grow.
when function is static inline.Following is a kind of function defined in header file. How can i get rid of the above mentioned warning.
static __inline___ getSomething(){
return something;
}
EDIT
yes i tried removing the inline
, but i get the following warning
function getSomething defined but not used.
Is there any way to remove both the warnings?
[EDIT]
-g -Wno-unused -g -ansi -pedantic -Wall -Wshadow -Wpointer-arith -Wwrite-strings
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除
__inline__
关键字。编译器通常足够聪明,知道何时内联,除非您正在进行详细的分析并且了解得更好,否则尝试强制内联是没有必要的。Remove the
__inline__
keyword. Compilers are generally smart enough to know when to inline, and unless you're doing detailed profiling and know better, trying to force it is unnecessary.难道这个功能真的没用过吗?也许应该完全删除它?
Is the function really not used? may be it should be removed altogether?