From: Jani Nikula <jani.nikula@intel.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@inria.fr
Subject: Re: [cocci] spatch #include statements and include search path
Date: Mon, 13 Jan 2025 14:40:46 +0200 [thread overview]
Message-ID: <87frlmj38x.fsf@intel.com> (raw)
In-Reply-To: <40a550cc-984f-8d-6c3b-8c9c0a7fa5c@inria.fr>
On Mon, 13 Jan 2025, Julia Lawall <julia.lawall@inria.fr> wrote:
> On Mon, 13 Jan 2025, Jani Nikula wrote:
>
>>
>> I want to use a non-trivial match rule in multiple other rules, in
>> multiple .cocci files. I'm trying put the match rule in a separate file,
>> and #include that in the other files, to avoid duplication. (I'm
>> referring to the "include_cocci ::= #include string" usage of #include,
>> not transformations.)
>>
>> It works when the current working directory is the same as the file to
>> be included, but I seem to be unable to make it work from another
>> directory.
>>
>> It doesn't matter if the .cocci files are all in the same directory or
>> not, it doesn't seem to matter what I pass as -I to spatch on the
>> command-line. I see #include mentioned in the SmPL Grammar as well as
>> some tutorials, but I can't find any proper, working examples for it.
>>
>> How is the #include and the search path supposed to work? There seems to
>> be some conflation in the documentation about include_cocci in .cocci
>> and #includes in the .c files.
>>
>> Specifically, I'm running spatch in my kernel repo, and I keep the
>> .cocci files in a separate directory outside the kernel repo.
>
> 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.
Thanks, though.
BR,
Jani.
>
> I see an example in tests/gadget_soa_defs.cocci that contains
>
> #include "tests/gadget_match.cocci"
>
> There was a problem about the files coming in the wrong order in the case
> of multiple included files. I've pushed the recent changes out to github
> just now, so that fix should be there.
>
> julia
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-01-14 17:45 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 [this message]
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
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=87frlmj38x.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=cocci@inria.fr \
--cc=julia.lawall@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.