All of lore.kernel.org
 help / color / mirror / Atom feed
From: christof@warlich.name (Christof Warlich)
To: cocci@systeme.lip6.fr
Subject: [Cocci] adding function declarations
Date: Thu, 01 Jan 2015 15:43:33 +0100	[thread overview]
Message-ID: <54A55D15.5020306@warlich.name> (raw)

Hi,

being absolutely new to Coccinelle, I see that fascinating things can be 
done with it, but I kind of fail to adopt things towards my own needs:

I'd like to adapt the header files of a huge C project (gcc) so that 
they may alternatively be included by C++ (g++) code. But many of the 
header files do contain numerous inline function definitions of the form

static inline __attribute__((always_inline)) <someReturnType> 
<someFunctionName>(<someParameters) {
     <someCode>
}

While gcc happily accepts this type of code, g++ complains that 
specifying attributes is not allowed during function definition, but 
only during function declaration. Thus, the fix is straight forward: All 
these occurrences must be replaced by something like

static inline __attribute__((always_inline)) <someReturnType> 
<someFunctionName>(<someParameters);
<someReturnType> <someFunctionName>(<someParameters) {
     <someCode>
}

Can anyone give me some guidance on how I can express this as a semantic 
patch?

Thanks for any help,

Chris

             reply	other threads:[~2015-01-01 14:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 14:43 Christof Warlich [this message]
2015-01-01 16:02 ` [Cocci] adding function declarations Julia Lawall
2015-01-01 19:06   ` Christof Warlich
2015-01-01 19:54     ` Julia Lawall
2015-01-01 23:50       ` Christof Warlich
2015-01-02  6:05         ` Julia Lawall
2015-01-02  8:23           ` Christof Warlich
2015-01-01 17:33 ` Julia Lawall
2015-01-02 10:22   ` Christof Warlich
2015-01-02 10:30     ` Julia Lawall
2015-01-02 11:11       ` Christof Warlich

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=54A55D15.5020306@warlich.name \
    --to=christof@warlich.name \
    --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.