> a couple of developers expressed an interest in a port of coccinelle,
> I made a start but it doesn't work (even the simplest test reports
> 'No matches found') and knowing approximately 0 about ocaml, I have
> no clue how to even start to debug it.
> 
> I probably won't do anything with it now, so rather than duplicate
> work, if anyone's interested in picking this up, here's a tgz to get
> you started.
> 
> $ spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> HANDLING: demos/simple.c
> No matches found for f
> Skipping:demos/simple.c

NB copied all demos into a cocci folder in /home

when you run it with -debug I get this message

# spatch -debug -sp simple.cocci simple.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
-----------------------------------------------------------------------
processing semantic patch file: simple.cocci
with isos from: /usr/local/share/coccinelle/standard.iso
-----------------------------------------------------------------------
@@ expression E; @@

- f(E);
+ f(E,3);


HANDLING: simple.c
No matches found for f
Skipping:simple.c
Check duplication for 1 files
grep failed: egrep -q '(\bf\b)' simple.c

I might be completely wrong on this, but still posting if somebody else 
can take it forward.

If you pull up $WRKSRC/cocci.ml, then you get to the possible root of the 
problem, see around line 485.

egrep fails because it relies on \b which is not supported in BSD grep?

I tried several versions 0.2.3, 0.2.4, 0.2.5 and hit the same issue. 
Note, I had to change patch-configure a little bit for it to work. current 
patches work on 0.2.5, but on older versions you have to have this 
modified version of stuart's patch.

$OpenBSD$
--- configure.orig      Fri May  6 20:38:38 2011
+++ configure   Fri May  6 20:43:27 2011
@@ -176,7 +176,7 @@ if ($opt eq ".opt") {
 pr2 "";

 $error += check_config(
-  "make -v 2>&1 |grep Make|",
+  "${MAKE_PROGRAM} -v 2>&1 |grep Make|",
   "GNU Make [^0-9]*3\.[0-9]+.*", #version 3.79.1, 3.81
   "make (gnu version) is present.",
   "The program gnu make is missing or is not a good version.
@@ -332,11 +332,11 @@ my $pythonprefix = $python ? "yes" : "no";
 pr2 "Support for python scripting : $pythonprefix";
 `cd python; ln -sf ${pythonprefix}_pycocci.ml pycocci.ml; `;
 `cd python; ln -sf ${pythonprefix}_pycocci_aux.ml pycocci_aux.ml;`;
-`cd python; make depend`;
+`cd python; ${MAKE_PROGRAM} depend`;

 pr2 "Support for ocaml scripting : $ocamlprefix";
 `cd ocaml; ln -sf ${ocamlprefix}_prepare_ocamlcocci.ml 
prepare_ocamlcocci.ml;`;
-`cd ocaml; make depend`;
+`cd ocaml; ${MAKE_PROGRAM} depend`;

 pr2 "Modifying globals/config.ml";
 my $command = "perl -p -e 's#Not_found.\*#Not_found->\\\"$src\\\"#' 
globals/config.ml.in
> globals/config.ml";

Reply via email to