All of lore.kernel.org
 help / color / mirror / Atom feed
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [bug-cocci] "badly compiled mcode" error
Date: Tue, 22 Jul 2014 14:55:57 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1407221455390.2366@hadrien> (raw)
In-Reply-To: <20140721184219.GA7903@rlp>

A patch is below.

julia

diff --git a/parsing_cocci/iso_compile.ml b/parsing_cocci/iso_compile.ml
index 5e39b9c..7921f44 100644
--- a/parsing_cocci/iso_compile.ml
+++ b/parsing_cocci/iso_compile.ml
@@ -52,7 +52,7 @@ let process_info l =
 	 let safe_add p pos =
 	   (* don't add pos var where a pos var is already present *)
 	   if Common.inter_set previously_used pos = [] then p::pos else pos in
-	 let p =
+	 let new_previously_used =
 	   if List.for_all (List.for_all (function e -> List.length e = 1)) a
 	   then
 	     let p = get_p() in
@@ -60,22 +60,23 @@ let process_info l =
 	       (List.iter
 		  (List.iter (function (_,pos) -> pos := safe_add p !pos)))
 	       a;
-	     [p]
+	     p::previously_used
 	   else
 	     let all = r @ List.concat xs in
-	     let rec find_first_available a = function
+	     let rec find_first_available a previously_used = function
 		 [] -> raise Not_found
 	       | (str,pos)::xs ->
 		   if str = a && Common.inter_set previously_used !pos = []
 		   then pos
-		   else find_first_available a xs in
+		   else find_first_available a previously_used xs in
 	     List.fold_left
 	       (function prev ->
 		 function (str,pos) ->
 		   if Common.inter_set previously_used !pos = []
 		   then
 		     try
-		       let entries = List.map (find_first_available str) all in
+		       let entries =
+			 List.map (find_first_available str prev) all in
 		       let p = get_p() in
 		       pos := p::!pos;
 		       List.iter (function pos -> pos := p :: !pos) entries;
@@ -83,8 +84,8 @@ let process_info l =
 		     with Not_found -> prev
 		   (* otherwise already annotated *)
 		   else prev)
-	       [] f in
-	 loop (p at previously_used) xs
+	       previously_used f in
+	 loop new_previously_used xs
      | _ -> failwith "bad iso" in
    loop l

  parent reply	other threads:[~2014-07-22 12:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 18:42 [Cocci] [bug-cocci] "badly compiled mcode" error Riccardo Lucchese
2014-07-21 19:47 ` Julia Lawall
2014-07-22 12:55 ` Julia Lawall [this message]
2014-07-22 13:43   ` Riccardo Lucchese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1407221455390.2366@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.