[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: static functions are your friends (Was GPIO revisited)
Maybe other compilers dont grok __noinline or someone wants to make
inline anyway, who knows. :-)
do we have other compilers? I am offering a compromise and already
complaints. I think I should stick to just plain non-static
declarations. those are portable and don't fuckup ddb.....
Yes, we have other compilers -- we have one in the tree, which people
actually use, and our source code is supposed to be reasonably free
of GCC specific constructs (at least except very common ones) so that
it's not hard to bootstrap it on other compilers. FreeBSD currently
builds with LLVM and in the past, there have been efforts to build
NetBSD kernels with DEC C, icc, and lcc, with varying degrees of
That's why we have macros like __predict_true() instead of directly
using the relevant GCC features. They can become NOPs with a compiler
that doesn't provide the feature. One here which gives "static
with GCC and "" with pcc would be shorter then typing out the whole
GCC syntax and certainly look cleaner!
Hmm, do we have example code somewehre in the tree?
As to inline or not with debug or diagnostic -- my personal taste is
if you really want to never have inlining in driver code that you
personally maintain, fine. But I think that in most parts of the
tree, we should not disable optimization unless DEBUG or DIAGNOSTIC.
As I think others have (obliquely) pointed out, addr2line or gdb can
get you better traceback information than ddb, given a core dump or
just the raw addresses from ddb's traceback. In the face of
inlining by the compiler, there's really nothing that can get it
right -- but with a full symbol table, gdb/addr2line can do a _little_
better than ddb can.
Thanks for the feedback. Actually I just saw that /usr/include/sys/
cdefs has the following in it:
#define __const /* delete pseudo-ANSI C
#endif /* !__GNUC__ */
So I assume that as long as I include this file, the use of __inline
should be save, right?
- Marc Balmer
Main Index |
Thread Index |