svn commit: r261916 - head/sys/dev/xen/console
David Chisnall
theraven at FreeBSD.org
Sat Feb 15 18:59:22 UTC 2014
On 15 Feb 2014, at 17:02, Bruce Evans <brde at optusnet.com.au> wrote:
> Why? There are hundreds if not thousands of static inline functions in
> headers, and most of these functions are not always used, so there would
> be [hundreds if not thousands] * [number of #includes] compiler warnings
> if compilers warned about things like this. They could handle include
> files specially, but shouldn't.
They do, and absolutely should, handle include files separately. If you have a static inline function in a header that is not used in a specific compilation unit, then that is a little bit of extra work for the compiler as it has to parse it without it being used, but it is not a problem. It is a safe assumption that it is used by at least one compilation unit and so is not dead code (and even if it isn't yet, it is part of an API, and so removing it would be an error).
In contrast, a static inline function in the main source file for a compilation unit is definitely a bug. It is obviously dead code. It is likely that it either should have been removed when all callers were deleted, or should not have been static but accidentally was.
David
More information about the svn-src-all
mailing list