Skip to contentSkip to conversation

parsing_cocci: parse_cocci: Extend is_permissible_proto list

PATCH In review Jaskaran Singh 2 participants 3 messages Jul 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parsing_cocci: parse_cocci: Extend is_permissible_proto list

Add more tokens (binary operators and colon) to the match ladder in is_permissible_proto. These cases would otherwise cause parsing errors for function calls after these tokens.

---
 parsing_cocci/parse_cocci.ml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
parsing_cocci/parse_cocci.ml +18 -1
index 598cdc0b..e30039dc 100644
@@ -1052,7 +1052,8 @@ let find_function_names l =
       ((PC.TMid0(_),_) | (PC.TAnd0(_),_))::
       (PC.TOPar0(_),_)::_ -> false
     | (PC.TOPar0(_),_)::rest
-    | (PC.TCPar0(_),_)::rest -> is_permissible_proto rest
+    | (PC.TCPar0(_),_)::rest
+    | (PC.TMul(_),_)::rest -> is_permissible_proto rest
     | x::rest when is_mid x ->
         let rec loop = function
           [] -> false
@@ -1076,6 +1077,21 @@ let find_function_names l =
     | (PC.TMetaId(_),_)::_
     | (PC.TMetaLocalIdExp(_),_)::_
     | (PC.TEq(_),_)::_
+    | (PC.TEqEq(_),_)::_
+    | (PC.TNotEq(_),_)::_
+    | (PC.TShROp(_),_)::_
+    | (PC.TShLOp(_),_)::_
+    | (PC.TSub(_),_)::_
+    | (PC.TPlus(_),_)::_
+    | (PC.TMinus(_),_)::_
+    | (PC.TDmOp(_),_)::_
+    | (PC.TAnd(_),_)::_
+    | (PC.TOr(_),_)::_
+    | (PC.TXor(_),_)::_
+    | (PC.TLogOp(_),_)::_
+    | (PC.TAndLog(_),_)::_
+    | (PC.TOrLog(_),_)::_
+    | (PC.TDotDot(_),_)::_
     | (PC.TPtrOp(_),_)::_
     | (PC.TEllipsis(_),_)::_
     | (PC.TOEllipsis(_),_)::_
@@ -1086,6 +1102,7 @@ let find_function_names l =
     | (PC.TOBrace(_),_)::_
     | (PC.TCBrace(_),_)::_
     | (PC.TOPar(_),_)::_
+    | (PC.TOCro(_),_)::_
     | (PC.TIdent(_),_)::_ -> false
     | _ -> true in
   let decl_or_proto clt info bef aft =
Signature · 6 lines
2.21.3

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
#1 lore raw
Quoted 3 lines · Jaskaran Singh

Add more tokens (binary operators and colon) to the match ladder in is_permissible_proto. These cases would otherwise cause parsing errors for function calls after these tokens.

Thanks, but it doesn't apply:

Applying: parsing_cocci: parse_cocci: Extend is_permissible_proto list
error: parsing_cocci/parse_cocci.ml: does not match index

julia

Quoted 51 lines
---
 parsing_cocci/parse_cocci.ml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
parsing_cocci/parse_cocci.ml +18 -2
index 598cdc0b..e30039dc 100644
@@ -1052,7 +1052,8 @@ let find_function_names l =
       ((PC.TMid0(_),_) | (PC.TAnd0(_),_))::
       (PC.TOPar0(_),_)::_ -> false
     | (PC.TOPar0(_),_)::rest
-    | (PC.TCPar0(_),_)::rest -> is_permissible_proto rest
+    | (PC.TCPar0(_),_)::rest
+    | (PC.TMul(_),_)::rest -> is_permissible_proto rest
     | x::rest when is_mid x ->
         let rec loop = function
           [] -> false
@@ -1076,6 +1077,21 @@ let find_function_names l =
     | (PC.TMetaId(_),_)::_
     | (PC.TMetaLocalIdExp(_),_)::_
     | (PC.TEq(_),_)::_
+    | (PC.TEqEq(_),_)::_
+    | (PC.TNotEq(_),_)::_
+    | (PC.TShROp(_),_)::_
+    | (PC.TShLOp(_),_)::_
+    | (PC.TSub(_),_)::_
+    | (PC.TPlus(_),_)::_
+    | (PC.TMinus(_),_)::_
+    | (PC.TDmOp(_),_)::_
+    | (PC.TAnd(_),_)::_
+    | (PC.TOr(_),_)::_
+    | (PC.TXor(_),_)::_
+    | (PC.TLogOp(_),_)::_
+    | (PC.TAndLog(_),_)::_
+    | (PC.TOrLog(_),_)::_
+    | (PC.TDotDot(_),_)::_
     | (PC.TPtrOp(_),_)::_
     | (PC.TEllipsis(_),_)::_
     | (PC.TOEllipsis(_),_)::_
@@ -1086,6 +1102,7 @@ let find_function_names l =
     | (PC.TOBrace(_),_)::_
     | (PC.TCBrace(_),_)::_
     | (PC.TOPar(_),_)::_
+    | (PC.TOCro(_),_)::_
     | (PC.TIdent(_),_)::_ -> false
     | _ -> true in
   let decl_or_proto clt info bef aft =
--
Quoted 3 lines

2.21.3

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#2 lore raw
Quoted 8 lines · Julia Lawall
Quoted 4 lines · Jaskaran Singh

Add more tokens (binary operators and colon) to the match ladder in is_permissible_proto. These cases would otherwise cause parsing errors
for function calls after these tokens.

Quoted 6 lines

Thanks, but it doesn't apply:

Applying: parsing_cocci: parse_cocci: Extend is_permissible_proto list
error: parsing_cocci/parse_cocci.ml: does not match index

That's weird, it applies fine on gitlab/master for me.

Maybe do a git am --abort and try again?

Cheers,
Jaskaran.

Quoted 48 lines

julia

Quoted 46 lines
---
 parsing_cocci/parse_cocci.ml | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
parsing_cocci/parse_cocci.ml +17 -1
index 598cdc0b..e30039dc 100644
@@ -1052,7 +1052,8 @@ let find_function_names l =
       ((PC.TMid0(_),_) | (PC.TAnd0(_),_))::
       (PC.TOPar0(_),_)::_ -> false
     | (PC.TOPar0(_),_)::rest
-    | (PC.TCPar0(_),_)::rest -> is_permissible_proto rest
+    | (PC.TCPar0(_),_)::rest
+    | (PC.TMul(_),_)::rest -> is_permissible_proto rest
     | x::rest when is_mid x ->
         let rec loop = function
           [] -> false
@@ -1076,6 +1077,21 @@ let find_function_names l =
     | (PC.TMetaId(_),_)::_
     | (PC.TMetaLocalIdExp(_),_)::_
     | (PC.TEq(_),_)::_
+    | (PC.TEqEq(_),_)::_
+    | (PC.TNotEq(_),_)::_
+    | (PC.TShROp(_),_)::_
+    | (PC.TShLOp(_),_)::_
+    | (PC.TSub(_),_)::_
+    | (PC.TPlus(_),_)::_
+    | (PC.TMinus(_),_)::_
+    | (PC.TDmOp(_),_)::_
+    | (PC.TAnd(_),_)::_
+    | (PC.TOr(_),_)::_
+    | (PC.TXor(_),_)::_
+    | (PC.TLogOp(_),_)::_
+    | (PC.TAndLog(_),_)::_
+    | (PC.TOrLog(_),_)::_
+    | (PC.TDotDot(_),_)::_
     | (PC.TPtrOp(_),_)::_
     | (PC.TEllipsis(_),_)::_
     | (PC.TOEllipsis(_),_)::_
@@ -1086,6 +1102,7 @@ let find_function_names l =
     | (PC.TOBrace(_),_)::_
     | (PC.TCBrace(_),_)::_
     | (PC.TOPar(_),_)::_
Quoted 8 lines
Quoted 8 lines
parsing_cocci/parse_cocci.ml +1 -1
+    | (PC.TOCro(_),_)::_
     | (PC.TIdent(_),_)::_ -> false
     | _ -> true in
   let decl_or_proto clt info bef aft =
--

2.21.3

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci