[lkml]   [2011]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRE: [PATCH 4/6] ftrace syscalls: Allow arch specific syscallsymbol matching
    On Wed, 2011-02-02 at 14:15 +0000, David Laight wrote:
    > > +#define arch_syscall_match_sym_name(sym, name) !strcmp(sym + 3, name
    > + 3)
    > Whenever you use a #define macro arg, you should enclose it in ().
    > About the only time you don't need to is when it is being
    > passed as an argument to another function
    > (ie when it's use is also ',' separated).
    > So the above ought to be:
    > #define arch_syscall_match_sym_name(sym, name) (!strcmp((sym) + 3,
    > (name) + 3))

    I would have mentioned this if I wanted it to stay a macro ;)

    > Whether an inline function is better or worse is much more subtle!
    > For instance I've used:
    > asm volatile ( "# line " STR(__LINE__) :: )
    > to stop gcc merging the tails of conditionals.
    > Useful when the conditional is at the end of a loop (etc),
    > it might increase code size slightly, but removes a branch.
    > If I put one of those in an 'inline' function separate copies
    > of the function end up sharing code.
    > With a #define __LINE__ differs so they don't.
    > (I had some code to get below 190 clocks, these changes
    > were significant!)

    For what you were doing, this may have helped. But the code in question
    is the "default" version of the function. I much more prefer it to be a
    static inline. The issues you experience could change from gcc to gcc.
    But static inlined functions are much cleaner and easier to read than

    Using a macro for this purpose is just too messy.

    Again, look at include/trace/ftrace.h. If I'm saying using a macro is
    ugly, then don't use it! Listen to me, because I'm Mr. Ugly Macro Man.

    -- Steve

     \ /
      Last update: 2011-02-02 15:31    [W:0.020 / U:75.040 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site