It would certainly need to include a lot of things to find the declaration of
printf. You could try -recursive_includes.
The usage of this parameter is not explained by the manual so far while it is
mentioned by the command "spatch -longhelp".
Is the parameter "all_includes" also needed?
elfring@Sonne:~/Projekte/Geany/lokal> LANG=C spatch -sp_file ../pattern1.cocci
src/log.c -I /usr/include -I /usr/lib64/gcc/x86_64-suse-linux/4.6/include -I
/usr/include/gtk-2.0 -I /usr/include/gail-1.0 -I /usr/include/glib-2.0 -I
/usr/include/gio-unix-2.0 -I /usr/include/scintilla -all_includes
-recursive_includes > Test1.txt
HANDLING: src/log.c
Fatal error: exception Failure("lexical error ~ and :: not allowed in C
identifiers, try -c++ option
=File "/usr/include/sys/cdefs.h", line 106, column 43, charpos = 3508
around = 'std::name', whole content = # define __USING_NAMESPACE_STD(name)
using std::name;")
You will also need a lot of -I options to specify all of the paths where
it should look for these include files. Finally, you don't want to match
the definition of the function, but its prototype.
Is it possible to determine which header files were processed for the source
code analysis by your tool?
elfring@Sonne:~/Projekte/Geany/lokal> LANG=C && P=../pattern1.cocci &&
INCLUDES='-I /usr/include -I /usr/lib64/gcc/x86_64-suse-linux/4.6/include -I
/usr/include/gtk-3.0/gdk -I /usr/include/gtk-2.0 -I /usr/lib64/glib-2.0/include
-I /usr/include/gail-1.0 -I /usr/include/glib-2.0 -I /usr/include/glib-2.0/glib
-I /usr/include/gio-unix-2.0 -I /usr/include/scintilla -I /usr/include/cairo -I
/usr/include/pango-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/atk-1.0 -I
/usr/include/wine/windows -I tagmanager/include -all_includes
-recursive_includes -c++' && spatch -sp_file $P src/log.c $INCLUDES > Test1.txt
&& spatch -sp_file $P src/main.c $INCLUDES > Test2.txt
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: src/log.c
(ONCE) TYPE: header machine/ansi.h not found
(ONCE) TYPE: header sys/_types.h not found
(ONCE) TYPE: header lowlevellock.h not found
(ONCE) TYPE: header tls.h not found
(ONCE) TYPE: header pthread-functions.h not found
(ONCE) TYPE: header bp-sym.h not found
Note: processing took 85.3s: src/log.c
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: src/main.c
(ONCE) TYPE: header machine/ansi.h not found
(ONCE) TYPE: header sys/_types.h not found
(ONCE) TYPE: header lowlevellock.h not found
(ONCE) TYPE: header tls.h not found
(ONCE) TYPE: header pthread-functions.h not found
(ONCE) TYPE: header bp-sym.h not found
Note: processing took 124.1s: src/main.c
Do I need to define or exclude any preprocessor definitions explicitly?
I'm also unsure if the following statements are really needed from the file
"/usr/include/bits/libc-lock.h" for the situation in my Linux environment.
...
#ifdef _LIBC
# include <lowlevellock.h>
# include <tls.h>
# include <pthread-functions.h>
#endif
...
Do the mentioned dependencies need to be resolved by alternative ways?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)