svn commit: r213744 - head/bin/sh

Bruce Evans brde at optusnet.com.au
Thu Oct 14 01:30:41 UTC 2010


On Wed, 13 Oct 2010, John Baldwin wrote:

> On Wednesday, October 13, 2010 12:29:27 am Bruce Evans wrote:
>> On Tue, 12 Oct 2010, David O'Brien wrote:
>>
>>> On Wed, Oct 13, 2010 at 02:18:33PM +1100, Bruce Evans wrote:
>>> ...
>>>> Of course, debugging and profiling are magic,
>>>> but I don't want to have to adorn all functions with STATICs and
>>>> __attributes() (and pragmas for othercc...) to recover historical/normal
>>>> or variant debugging or profiling of them.
>>>
>>> I agree, and would not add STATIC's to a program's code that didn't
>>> already have them.  But in this case we inherited it from 4.4BSD.
>>> I'm just making it actually do something other than being a gratuitous
>>> spelling change.
>>>
>>> I believe I've made things more consistent with r213760.
>>
>> Add __noinline or whatever attributes to STATIC (but keep static in
>> it) for the DEBUG >= 3 case if you are going that far.  __noinline
>> should be a syntax error for variables, so this should also find any
>> STATICs still on variables.  The spelling fix of changing STATIC to
>> what it actually means
>> (ASSORTED_HACKS_FOR_DEBUGGING_BUT_NOW_ONLY_FOR_FUNCTIONS) goes too far
>> for me.
>
> To be honest, I think changing STATIC is excessive churn.

I agree, but 'static' was already spelled 'STATIC' in all cases without
style bugs (except in the #define of STATIC).  Adding __noinline to
the #define of STATIC is a small change.

> The "right" fix
> is to use 'make DEBUG_FLAGS="-g -DDEBUG=2 -fno-inline"'.  I often use
> 'make DEBUG_FLAGS="-g -fno-inline"' to workaround excessive inlining when
> debugging.  I think all of the STATIC changes should just be backed out.

Adding -fno-inline on the command line is more flexible, but might change
the generated code too much.  Sometimes you want to keep all the little
inline functions inline so as not to see them, or just to give the same
code for them.  -fno-inline-functions-called-once may be more useful.
-fno-inline doesn't affect functions declared as __inline, so in the
kernel where __inline is used too much, -fno-inline doesn't have such a
large effect.  Putting the non-inlining flag in the definition of STATIC
gives even finer control.  But I would only use it if STATIC is already
used.  I would try the hack of "#define static /**/" or
"#define static __noinline_mumble" before changing the source code.

Bruce


More information about the svn-src-all mailing list