views:

132

answers:

2

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. Most of these warnings seem to come from boost, however some come from our own library headers (binary .dylibs that we're linking to). 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

A: 

It should be save if you not

  • hit a bug in gcc
  • anticipate inlined functions in your code
  • try to do nasty things

You should try to minimize warnings though.

Wienczny
+2  A: 

g++ is alerting at what's essentially, strictly a PERFORMANCE problem -- you're requesting inline implementations that just can't be inlined. 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. If your use of inline really DOES matter, i.e., 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!-).

Alex Martelli
We aren't actually using the inline keyword at all in our own code. I haven't checked in the boost code that is throwing these warnings, though.
Grant Limberg