Skip to contentSkip to conversation

commas in parameter lists

Cocci Julia Lawall 1 participant 1 message Dec 28, 2015

lore
Share & tools
lore
#0 lore raw

The patch below allows a pattern like

...,
+ T i,
int x,...

to match even when int x is the first parameter declaration.

julia

---------

commit 6afbb70fbf0fca0ec94c6b4a67edf9355d5406fc

Author: julia <[email protected]>
Date:   Mon Dec 28 09:49:40 2015 +0100

resolve leading or trailing comma problem by just making all commas unfavored

parsing_cocci/compute_lines.ml +0 -3
index e70b08e..fc81062 100644
@@ -454,7 +454,6 @@ let rec expression e =
       let ln = promote_mcode name in
       mkres e (Ast0.MetaExprList(name,a,b)) ln ln
   | Ast0.EComma(cm) ->
-      (*let cm = bad_mcode cm in*) (* why was this bad??? *)
       let cm = normal_mcode cm in
       let ln = promote_mcode cm in
       mkres e (Ast0.EComma(cm)) ln ln
@@ -850,7 +849,6 @@ and parameterTypeDef p =
       let ln = promote_mcode name in
       mkres p (Ast0.MetaParamList(name,a,b)) ln ln
   | Ast0.PComma(cm) ->
-      (*let cm = bad_mcode cm in*) (* why was this bad??? *)
       let cm = normal_mcode cm in
       let ln = promote_mcode cm in
       mkres p (Ast0.PComma(cm)) ln ln
@@ -880,7 +878,6 @@ let rec define_param p =
     Ast0.DParam(id) ->
       let id = ident id in mkres p (Ast0.DParam(id)) id id
   | Ast0.DPComma(cm) ->
-      (*let cm = bad_mcode cm in*) (* why was this bad??? *)
       let cm = normal_mcode cm in
       let ln = promote_mcode cm in
       mkres p (Ast0.DPComma(cm)) ln ln
parsing_cocci/insert_plus.ml +29 -34

74 lines not on this page · raw message