From: mcgrof@suse.com (Luis R. Rodriguez)
To: cocci@systeme.lip6.fr
Subject: [Cocci] string parameter concatenation
Date: Wed, 1 Oct 2014 20:28:45 +0200 [thread overview]
Message-ID: <20141001182845.GL14081@wotan.suse.de> (raw)
In-Reply-To: <alpine.DEB.2.10.1410011504340.2489@hadrien>
On Wed, Oct 01, 2014 at 03:08:54PM +0200, Julia Lawall wrote:
> On Wed, 1 Oct 2014, Cyril Hrubis wrote:
>
> > Hi!
> > I've found a small nit in the handling of strings that spans over
> > multiple lines:
> >
> > nit.c:
> > int main(void)
> > {
> > f("This is a string that continues to the next line"
> > " just string continuation");
> > }
> >
> > nit.cocci:
> > @@
> > expression list L;
> > @@
> > - f(L);
> > + g(L);
> >
> >
> > spatch nit.cocci nit.c
> > init_defs_builtins: /usr/local/share/coccinelle/standard.h
> > HANDLING: nit.c
> > diff =
> > --- nit.c
> > +++ /tmp/cocci-output-8374-71ffd9-nit.c
> > @@ -1,5 +1,4 @@
> > int main(void)
> > {
> > - f("This is a string that continues to the next line"
> > - " just string continuation");
> > + g("This is a string that continues to the next line"" just string continuation");
> > }
> >
> > While this produces perfectly correct C code it would be nicer if the
> > strings were merged into one single C string. Othewise this still breaks
> > what LKML coding style says about being able to grep user-visible
> > strings in the source code.
>
> I can try to see what to do about it. String made up of multiple
> concatenated strings are perhaps not so well supported. I don't think
> that automatic concatenation would be a good idea, because some users
> might not want it.
If at any point in time you find some odd things C may do which might be
real hard to gramatically handle within Coccinelle it may be worthwhile
for us to consider on the kernel as something to consider to avoid as
coding practice. This obviously cannot apply to all odd-ball C hacks
possible I certainly would not rule it out given the gains.
Luis
next prev parent reply other threads:[~2014-10-01 18:28 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 [this message]
2014-10-02 9:35 ` Cyril Hrubis
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=20141001182845.GL14081@wotan.suse.de \
--to=mcgrof@suse.com \
--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.