All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Victor Gambier <victor.gambier@inria.fr>,
	Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@inria.fr
Subject: Re: [cocci] spatch #include statements and include search path
Date: Thu, 23 Jan 2025 15:21:48 +0200	[thread overview]
Message-ID: <878qr1mzrn.fsf@intel.com> (raw)
In-Reply-To: <19e808d6-9c84-4582-88db-7917ccec96ee@inria.fr>

On Wed, 22 Jan 2025, Victor Gambier <victor.gambier@inria.fr> wrote:
> Hi Jani,
>
> Could you give me a precise example of what you're trying to do? The 
> following works on my end (commit 8aa44ca):
>
> .
> ├── A
> │   ├── cocciincludemain.c
> │   └── cocciincludemain.cocci
> └── B
>      └── cocciinclude1.cocci
>
> (...)/A $ spatch --sp-file ./cocciincludemain.cocci ./cocciincludemain.c
>
> Absolute and relative includes in cocciincludemain.cocci both work:
>
> #include 
> "/home/vgambier/Documents/git/coccinelle/playground/B/cocciinclude1.cocci"
>
> #include "../B/cocciinclude1.cocci"

This is what I'm trying to do:

+- A
|  +- main.c
+- B
   +- main.cocci
   +- include.cocci

$ cd A
$ spatch --sp-file ../B/main.cocci main.c

With main.cocci having:

#include "include.cocci"

Currently spatch looks for the include in the CWD only, not next to the
.cocci being processed, nor does -I help in specifying where to look for
the include.

BR,
Jani.

>
> Thanks,
> Victor
>
> On 13/01/2025 17:59, Jani Nikula wrote:
>> On Mon, 13 Jan 2025, Julia Lawall <julia.lawall@inria.fr> wrote:
>>> On Mon, 13 Jan 2025, Jani Nikula wrote:
>>>
>>>> On Mon, 13 Jan 2025, Julia Lawall <julia.lawall@inria.fr> wrote:
>>>>> I don't think there is any search path for .cocci files.
>>>> Oh, so it's always relative to the current working directory? That's a
>>>> bit of a bummer.
>>> It's not a well developed feature.  If an include path for it would be
>>> useful, we can add that.
>> It might be. Or do you have any other ideas for reusing match rules or,
>> say, "iterator name" lists, without duplicating them into all .cocci
>> files?
>>
>> So I guess I can try working around not having include search path by
>> running spatch outside of my kernel repo. Does spatch otherwise handle
>> that scenario well, or any caveats there?
>>
>>
>> BR,
>> Jani.
>>
>>

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-01-27 16:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 11:54 [cocci] spatch #include statements and include search path Jani Nikula
2025-01-13 12:09 ` Julia Lawall
2025-01-13 12:40   ` Jani Nikula
2025-01-13 12:43     ` Julia Lawall
2025-01-13 16:59       ` Jani Nikula
2025-01-14 17:50         ` Julia Lawall
2025-01-22 16:38         ` Victor Gambier
2025-01-23 13:21           ` Jani Nikula [this message]
2025-01-31 10:24             ` [cocci] [cocci-mirror] " Victor Gambier

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=878qr1mzrn.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@inria.fr \
    --cc=victor.gambier@inria.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.