Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread SF Markus Elfring
> Some features would need a proper integration with Coccinelle though,

Have you got any further details in mind already?


> and that's another nontrivial task.

Do you know any more software developers who would like to help here?

Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread Julia Lawall


On Tue, 8 Mar 2016, SF Markus Elfring wrote:

> >> An option like "--enable-menhirLib" is provided under the configuration 
> >> category
> >> "Optional Features", isn't it?
> >
> > This is for the parsing of the semantic patch.
>
> Does this information mean that the software library "Menhir" is not so 
> optional at the moment?

Menhirlib is needed from the Coccinelle sources if you do not already have
menhir installed on your machine.  Thus there are two options.

> >>> Yoann Padioleau:
> >>> Parsing C/C++ Code without Pre-processing. CC 2009: 109-125
> >>
> >> How much did the software design and corresponding implementation evolve 
> >> further
> >> since the description of this approach?
> >
> > Not at all.
>
> I have got an other impression through the years.
>
> Your software supports source code transformations also without
> including header files and other pre-processing stuff.
>
> Example:
> The option "--include-headers-for-types" was added by the release "Coccinelle 
> 1.0.0-rc22".

It's true, but that has nothing to do with the parsing algorithm.  It has
to do with what files are selected for parsing.  I don't think there has
been any substantial change in the actual parsing algorithm.

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread SF Markus Elfring
> If you are talking about using Coccinelle as a bug finder,
> and empower it with alias analysis,

I am also curious on how such technologies will fit together.


> then I have spent about a year working on a similar idea.

How similar was this approach?


> I am available to discuss my experience with you,

Nice …


> if you want.

Yes, please.


> I don't know exactly in what direction you want to "improve" Coccinelle 
> results,
> but let me warn you that in principle alias analysis may just give you
> a lot more false positives.

Do you need also a special software infrastructure to reduce the probability
for the undesired reporting of false positives?


> Sometimes, in functions with complex manipulation of pointers,
> I find that alias analysis hurts more than it helps.

Interesting view …


> That said, I think advanced Coccinelle users could make good use
> of aliasing information.

How would these data be integrated for the use in SmPL scripts?

Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread Sébastien Hinderer
SF Markus Elfring (2016/03/08 10:20 +0100):
> Would the Coccinelle software benefit from the tool "Menhir" if it will
> take care for the parsing of C source files, too?

From a performance point of view it is not sure there would be any gain.
But obviously it would make more sense to use only one parser generator
rather than two. However a bug in Menhir currently prevents its usage to
generate the C parser. Once that bug will be fixed then using Menhir to
generate the C parser will become an option.

Sébastien.
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread SF Markus Elfring
>> The software library "http://cristal.inria.fr/~fpottier/menhir/;
>> is involved to some degree.
> 
> No, not for parsing C. Currently, Menhir (an advanced alternative to
> ocamlyacc) is used only to generate the SmPL parser, not the C parser.

Thanks also for your clarification.

Would the Coccinelle software benefit from the tool "Menhir" if it will
take care for the parsing of C source files, too?

Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Coccinelle Compilation Problem: configure file

2016-03-08 Thread Sébastien Hinderer
Dear Aftab,

Many thanks for your interest in Coccinelle.

> Hi Julia Lawall and the Coccinelle Team,
> 
> I really appreciate your response. I was able to generate the configure
> file using *>./autogen*,
> and all the installation steps. Thank you so much. Unfortunately, now I'm
> unable to execute spatch.
> 
> On executing this:
> 
> *spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c*
> 
> I get "spatch is not installed".

Odd. What does
which spatch
say? Can you look at the file it points to?
This file should be a shell script that tries to find the real spatch
executable. If you are a bit familiar with shell scripts, perhaps you
can go through this file and see whether the executables it tries to
look for are there?

> Also when I execute the following to test spatch,
> 
> 
> *COCCINELLE_HOME=/home/aftab/workspace/coccinelle-master ./scripts/spatch
> -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c*
> I get,
> 
> *bash: ./scripts/spatch: No such file or directory*

You can try to replace ./scripts/spatch by ./spatch in this command, I
think it should work better.

> I would like to let you know that I performed all the installation steps 
> (make,
> make install), and I noticed no errors.
> However, I am sceptical about why "make install" is carrying out the
> following operations,
> 
> 
> 
> *rm -f /usr/local/lib/coccinelle/spatchrm -f
> /usr/local/lib/coccinelle/spatch.optrm -f /usr/local/bin/pycocci*
> 
> I wonder whether this is causing the problem. I would be most glad if you
> could please help me install spatch.

I don't think these commands can cause a problem: they are supposed to
make sure there is nothing left from previous installs.

Feel free to send us the output of make install to make sure there is no
problem there.


> 
> Just in case, I installed the latest versions of OCaml and Menhir using
> OPAM.

Okay. FYI, Coccinelle is also packaged for opam. It is not the latest
version but depending on what you intend to do it might be good enough,
at least for a start.

Sébastien.
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Parsing C source files by Coccinelle

2016-03-08 Thread Sébastien Hinderer
Hi,

SF Markus Elfring (2016/03/07 19:39 +0100):
> > I am interested in exploring how Coccinelle is parsing C programs,
> 
> The software library "http://cristal.inria.fr/~fpottier/menhir/;
> is involved to some degree.

No, not for parsing C. Currently, Menhir (an advanced alternative to
ocamlyacc) is used only to generate the SmPL parser, not the C parser.

Sébastien.
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci