Skip to contentSkip to conversation

Searching only for header files with the Coccinelle software

Cocci Markus Elfring 2 participants 3 messages Mar 28, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

The Coccinelle software can search for header files in addition to source files if the option “--include-headers” was specified.
https://github.com/coccinelle/coccinelle/blob/287374196da8c7cfd169e721a2d23f1e462422f1/docs/manual/spatch_options.tex#L43

How can it be achieved that only header files will be searched by this tool for special source code analysis and transformation approaches?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 8 lines · Markus Elfring

Hello,

The Coccinelle software can search for header files in addition to source files if the option “--include-headers” was specified.
https://github.com/coccinelle/coccinelle/blob/287374196da8c7cfd169e721a2d23f1e462422f1/docs/manual/spatch_options.tex#L43

How can it be achieved that only header files will be searched by this tool for special source code analysis and transformation approaches?

Probably the simplest is to put the names of the header files in a file, eg find . -name "*h" > header_list, and then give the arguement --file-groups header_list to Coccinelle.

Another option is to use python in te semantic patch to detect the current file and then abort if it doesn't end in .h. But that would be much slower because the undesired files would still be parsed.

julia

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 5 lines · Markus Elfring
Quoted 3 lines

Probably the simplest is to put the names of the header files in a file, eg find . -name "*h" > header_list, and then give the arguement --file-groups header_list to Coccinelle.

How are the chances to add support for another program option like “--find-headers”?

In the last 15 years I have never wanted to do this. And we already have a huge number of command line options, so I'm not going to add this.

julia

Quoted 6 lines

Will any other file filters become also relevant here?

Regards,
Markus

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci