On Thu, Oct 11, 2018 at 06:57:39PM +0200, Julia Lawall wrote:
> > > Of course, you would want to use a regular expression for the macro name,
> > > or do something to avoid changing all two argument macros.
> > >
> > > Macros are often defined in header files, so you may want to use the
> > > command line options --no-includes --include-headers.  --no-includes means
> > > ignore header files when they are included into .c files and
> > > --include-headers means treat both .c an .h files.  Otherwise, you only 
> > > get
> > > .c files.
> >
> >  I am using --include-headers. I didn't get the --no-includes use with
> >  --include-headers though.
> >
> > What happens if I don't pass --no-includes?  Do the header files included
> > from C files also get matched then? Then in that case I shouldn't need to
> > pass anything (neither --include-headers nor --no-includes) and all included
> > headers from C files should also be matched/parsed/patched - since every
> > header should atleast be included *somewhere* otherwise its existinence is
> > pointless. Could you help me understand this better? Thanks a lot!
> 
> 1. Coccinelle desn't know about the make file.  So there are many header
> files that it may not be able to find.
> 
> 2. Many header files are irrelevant to your problem and included in many
> .c files, meaning that if you rely on the .c files to get the prcessing of
> the .h files, you will be processing the same code over and over.
> 
> If you use --no-includes --include-headers then every files will be
> processed and it will be processed only once.
> 
> Including headers, which can be done with eg --all-includes (all files
> mentioned explicitly in the .c file) or --recursive-includes (files
> included by other .h files) is useful if you need type information in
> processing the .c file and if the processing of the .h file relies on
> information present in the .c file.  If you only need type information
> then the option --include-headers-for-types is useful, as the headers will
> only be taken into account during the type inference phase, and then
> ignored during matching and transformation, whih provides a significant
> performance benefit.

Got it, I understand it now. Thanks!

 - Joel

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

Reply via email to