This content has been marked as final. Show 3 replies
olavsa wrote:Removing dead code is an optimization, so you need at least -xO1 for that.
1. Are there any reasons for why cc includes unused static inline functions in the object file while CC does not?
2. Are there any ways or options to tell cc to not include unused static inline functions in the object file?
Thank your for the answer and the suggestion for how to solve this problem. Adding -xO1 makes the code compile and link.
Still, it seems like the C++ compiler (CC) does the clean-up of dead code without having to add any optimization options.
The rules for inline functions are different in C and C++. With the Sun C++ compiler, declaring an inline function as static does not cause it to be emitted. It will be emitted only if it is called and cannot be inlined for some reason.