Skip to contentSkip to conversation

Improvements for source code analysis with inclusion of header files

Cocci SF Markus Elfring 3 participants 11 messages Mar 30, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

Some filter patterns can be specified in the semantic patch language so that they will also work without inclusion of header files. Some other source code analysis approaches will need all relevant data (e. g. macros and type declarations) from them.

Various compilers provide a functionality to store processed information from such headers in an alternative data format.
http://en.wikipedia.org/wiki/Precompiled_header

Would another intermediate form help to reduce analysis and transformation time by the Coccinelle software here?

How do you think about to store the results from a step "precompilation" like corresponding abstract syntax graphs in a kind of dedicated data base?
http://en.wikipedia.org/wiki/Graph_database#Graph_database_projects

Regards,
Markus

#1 lore raw
Quoted 11 lines · SF Markus Elfring

Hello,

Some filter patterns can be specified in the semantic patch language so that they will also work without inclusion of header files. Some other source code analysis approaches will need all relevant data (e. g. macros and type declarations) from them.

Various compilers provide a functionality to store processed information from such headers in an alternative data format.
http://en.wikipedia.org/wiki/Precompiled_header

Quoted 6 lines

Would another intermediate form help to reduce analysis and transformation time by the Coccinelle software here?

How do you think about to store the results from a step "precompilation" like corresponding abstract syntax graphs in a kind of dedicated data base?
http://en.wikipedia.org/wiki/Graph_database#Graph_database_projects

Coccinelle already allows you to cache abstract syntax trees on disk. Relevant command line arguments are --use-cache and --cache-limit.

julia

#2 lore raw
Quoted 2 lines

Coccinelle already allows you to cache abstract syntax trees on disk. Relevant command line arguments are --use-cache and --cache-limit.

Will any more documentation become available than a terse option description like "Use preparsed versions of the C files that are stored in a cache."?

Regards,
Markus

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

Coccinelle already allows you to cache abstract syntax trees on disk. Relevant command line arguments are --use-cache and --cache-limit.

Will any more documentation become available than a terse option description like "Use preparsed versions of the C files that are stored in a cache."?

Not sure what more documentation one would want.

julia

#4 lore raw
Quoted 1 line

Not sure what more documentation one would want.

I would find a clarification nice for details like the following.

1. Which "C files" are referenced here?

2. File formats for the cache

3. Explanation for abstract syntax trees in this context

Regards,
Markus

#5 lore raw
Quoted 5 lines · SF Markus Elfring
Quoted 1 line

Not sure what more documentation one would want.

I would find a clarification nice for details like the following.

1. Which "C files" are referenced here?

The ones Coccinelle was asked to work on.

Quoted 1 line

2. File formats for the cache

Doesn't matter to the user.

Quoted 1 line

3. Explanation for abstract syntax trees in this context

Likewise.

The cache is something that Coccinelle writes into and reads out of. Only Coccinelle cares what that format is.

julia

#6 lore raw
Quoted 3 lines
Quoted 1 line

1. Which "C files" are referenced here?

The ones Coccinelle was asked to work on.

Do you distinguish headers from source files in this use case?

Quoted 3 lines
Quoted 1 line

2. File formats for the cache

Doesn't matter to the user.

I guess that such information will become more interesting for other software developers, won't it?

Quoted 6 lines
Quoted 1 line

3. Explanation for abstract syntax trees in this context

Likewise.

The cache is something that Coccinelle writes into and reads out of. Only Coccinelle cares what that format is.

I would appreciate if more details could be eventually documented in an other format than the original OCaml source code.

Regards,
Markus

#7 lore raw
Quoted 5 lines · SF Markus Elfring
Quoted 3 lines
Quoted 1 line

1. Which "C files" are referenced here?

The ones Coccinelle was asked to work on.

Do you distinguish headers from source files in this use case?

No that I recall.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

2. File formats for the cache

Doesn't matter to the user.

I guess that such information will become more interesting for other software developers, won't it?

I don't think so. No more than any ordinary user is interested in the format that a web browser uses for its cache.

In general, a cache has a short lifetime. The software changes, or one wants to use Coccinelle with other options, and then one would rather start over with a new cache. The cache is mostly useful when one does iteration. In that case, I usually limit the size of the cache as well, because the format is not particularly concise. This further implies that it is not useful to anything other than the current run.

julia

#8 lore raw
Quoted 3 lines
Quoted 1 line

Do you distinguish headers from source files in this use case?

No that I recall.

Would you like to support any variant of precompiled header files?

Quoted 2 lines

The software changes, or one wants to use Coccinelle with other options, and then one would rather start over with a new cache.

I imagine that caches can also be generated for data representations with a longer "life time".

Quoted 3 lines

In that case, I usually limit the size of the cache as well, because the format is not particularly concise. This further implies that it is not useful to anything other than the current run.

I am becoming a bit more interested in conciseness for relevant data structures. How can it be achieved to make the intermediate data storage useful for several different source code analysis runs?

Regards,
Markus

#9 lore raw
In reply to Julia Lawall

Julia,

Quoted 1 line

Not sure what more documentation one would want.

Coccinelle is getting to be widely used.

When is the O'Reilly book coming out :-)

Signature · 3 lines
Derek M. Jones                  tel: +44 (0) 1252 520 667
Knowledge Software Ltd          blog:shape-of-code.coding-guidelines.com
Software analysis               http://www.knosof.co.uk
#10 lore raw
Quoted 7 lines · Derek M Jones

Julia,

Quoted 1 line

Not sure what more documentation one would want.

Coccinelle is getting to be widely used.

When is the O'Reilly book coming out :-)

I think it will coincide with the release of 1.0.0 :)

julia