Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357050

Re: [RFC PATCH V2] checkpatch: Check output format style of __func__ uses

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [RFC PATCH V2] checkpatch: Check output format style of __func__ uses
Date 2016-03-14 09:30 +0100
Message-ID <rcw30-1f4-3@gated-at.bofh.it> (permalink)
References <rcjIt-1tp-11@gated-at.bofh.it> <rcoRQ-4Fc-5@gated-at.bofh.it> <rct57-7I5-3@gated-at.bofh.it> <rcvgD-Hl-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, 14 Mar 2016, Joe Perches wrote:

> On Mon, 2016-03-14 at 06:19 +0100, Julia Lawall wrote:
> > On Sun, 13 Mar 2016, Joe Perches wrote:
> > > Loggng messages that emit function names have many different forms.
> > > Perhaps it'd be better for logging consistency and grep ease to
> > > exclusively use "%s:"
> > > 
> > > As well, function tracing logging uses are generally unnecessary given
> > > the kernel's function tracing (ftrace) capability.
> > > 
> > > Right now, grep shows these mixtures of forms:
> > > 
> > > 13704 "%s:"
> > > 3839  "%s "
> > > 2787  "%s()"
> > > 
> > > Some of these are macros definitions of various styles.
> > > 
> > > Unfortunately, given the complexity of these macro definition styles,
> > > checkpatch isn't an ideal tool to find these macros.
> > > 
> > > Maybe a coccinelle script might be better suited to find and fix all
> > > the various types of uses.
> > > 
> > > Add a --fix option for these logging messages with __func__.
> >
> > I'm not good enough at perl to really understand this.  Coudl you give an 
> > example of what it does, and of what it does not do?
>
> For instance, this could do simple conversions like:
>
> $ diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
> @@ -416 +416 @@ int __init mcpm_loopback(void (*cache_disable)(void))
> -               pr_err("%s returned %d\n", __func__, ret);
> +               pr_err("%s: returned %d\n", __func__, ret);
>
> But it couldn't find/convert a string concatenation:
>
> #define pch_dbg(adap, fmt, arg...)  \
>         dev_dbg(adap->pch_adapter.dev.parent, "%s :" fmt, __func__, ##arg)

OK, are there any thoughts about what to do when __func__ is not in the
first position?

julia

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] checkpatch: check formatting of __func__ output uses Joe Perches <joe@perches.com> - 2016-03-13 20:20 +0100
  [RFC PATCH V2] checkpatch: Check output format style of __func__ uses Joe Perches <joe@perches.com> - 2016-03-14 01:50 +0100
    Re: [RFC PATCH V2] checkpatch: Check output format style of __func__  uses Julia Lawall <julia.lawall@lip6.fr> - 2016-03-14 06:20 +0100
      Re: [RFC PATCH V2] checkpatch: Check output format style of  __func__ uses Joe Perches <joe@perches.com> - 2016-03-14 08:40 +0100
        Re: [RFC PATCH V2] checkpatch: Check output format style of __func__  uses Julia Lawall <julia.lawall@lip6.fr> - 2016-03-14 09:30 +0100
          Re: [RFC PATCH V2] checkpatch: Check output format style of  __func__ uses Joe Perches <joe@perches.com> - 2016-03-14 15:10 +0100

csiph-web