All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz (Cyril Hrubis)
To: cocci@systeme.lip6.fr
Subject: [Cocci] string parameter concatenation
Date: Thu, 2 Oct 2014 11:35:51 +0200	[thread overview]
Message-ID: <20141002093551.GA30575@rei.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.10.1410011504340.2489@hadrien>

Hi!
And here is another small nit:

nit.c:
int main(void)
{
        f(param1, "Long string that fits to 80 chars .........................",
          param2, param3);
}

nit.cocci:
@@
expression list L;
@@
- f(L);
+ g(L);

output:
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: nit.c
diff = 
--- nit.c
+++ /tmp/cocci-output-30698-a2be52-nit.c
@@ -1,5 +1,4 @@
 int main(void)
 {
-       f(param1, "Long string that fits to 80 chars .........................",
-         param2, param3);
+       g(param1, "Long string that fits to 80 chars .........................", param2, param3);
 }

Here the whole list of parameters is put on single line after the substitution
which sometimes creates 150 chars long lines for printf-like functions.

Unfortunatelly I cannot think of a good solution here. Conservative one would
be keeping the parameters as they are, but that would break anyway if function
name lenght, number or lenght of parameters changes.

-- 
Cyril Hrubis
chrubis at suse.cz

  parent reply	other threads:[~2014-10-02  9:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 13:02 [Cocci] string parameter concatenation Cyril Hrubis
2014-10-01 13:08 ` Julia Lawall
2014-10-01 13:21   ` SF Markus Elfring
2014-10-01 13:26     ` Julia Lawall
2014-10-01 18:28   ` Luis R. Rodriguez
2014-10-02  9:35   ` Cyril Hrubis [this message]
2014-10-02 10:24     ` Julia Lawall
2014-10-02 12:52 ` SF Markus Elfring
2014-10-02 13:04   ` Julia Lawall
2014-10-02 13:07   ` Cyril Hrubis
2014-10-02 13:37     ` Julia Lawall
2014-10-02 13:42       ` Cyril Hrubis
2014-10-02 17:00 ` Julia Lawall
2014-10-06 10:25   ` Cyril Hrubis
2014-10-06 10:49     ` Julia Lawall
2014-10-06 11:02       ` [Cocci] Configuration for alignment of function parameters? SF Markus Elfring
2014-10-17  5:53     ` [Cocci] string parameter concatenation Julia Lawall
2014-12-03  8:33       ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141002093551.GA30575@rei.suse.cz \
    --to=chrubis@suse.cz \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.