All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Incorrect skipping on custom types in type list
@ 2013-11-27 22:26 Michael Stefaniuc
  2013-11-27 22:46 ` Julia Lawall
  2013-11-28  8:42 ` Julia Lawall
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Stefaniuc @ 2013-11-27 22:26 UTC (permalink / raw)
  To: cocci

Hello,

@@
typedef VOID;
typedef LPVOID;
typedef PVOID;
{void *, VOID *, LPVOID, PVOID} ppv;
identifier QI =~ "_QueryInterface$";
@@
* QI(..., ppv)

executed on

int IFoo_QueryInterface(int *iface, long *riid, void **ppv)
{
    return IBar_QueryInterface(iface, riid, *ppv);
}

gives:
$ spatch QI.cocci /tmp/qi.c
HANDLING: /tmp/qi.c
No matches found for PVOID
Skipping:/tmp/qi.c

Putting LPVOID or VOID* last in the type list gives:
No matches found for LPVOID
respectively
No matches found for VOID

With void* in there I wouldn't have expected it to skip any files at all.

bye
	michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] Incorrect skipping on custom types in type list
  2013-11-27 22:26 [Cocci] Incorrect skipping on custom types in type list Michael Stefaniuc
@ 2013-11-27 22:46 ` Julia Lawall
  2013-11-28  8:42 ` Julia Lawall
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2013-11-27 22:46 UTC (permalink / raw)
  To: cocci

On Wed, 27 Nov 2013, Michael Stefaniuc wrote:

> Hello,
> 
> @@
> typedef VOID;
> typedef LPVOID;
> typedef PVOID;
> {void *, VOID *, LPVOID, PVOID} ppv;
> identifier QI =~ "_QueryInterface$";
> @@
> * QI(..., ppv)
> 
> executed on
> 
> int IFoo_QueryInterface(int *iface, long *riid, void **ppv)
> {
>     return IBar_QueryInterface(iface, riid, *ppv);
> }
> 
> gives:
> $ spatch QI.cocci /tmp/qi.c
> HANDLING: /tmp/qi.c
> No matches found for PVOID
> Skipping:/tmp/qi.c
> 
> Putting LPVOID or VOID* last in the type list gives:
> No matches found for LPVOID
> respectively
> No matches found for VOID
> 
> With void* in there I wouldn't have expected it to skip any files at all.

Thanks for the report.  I will look into it.  I expect to make a new 
release soon.

julia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] Incorrect skipping on custom types in type list
  2013-11-27 22:26 [Cocci] Incorrect skipping on custom types in type list Michael Stefaniuc
  2013-11-27 22:46 ` Julia Lawall
@ 2013-11-28  8:42 ` Julia Lawall
  2013-11-28 21:10   ` Michael Stefaniuc
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2013-11-28  8:42 UTC (permalink / raw)
  To: cocci

A patch is below.  Thanks for the report!

julia

diff --git a/parsing_cocci/get_constants2.ml b/parsing_cocci/get_constants2.ml
index 80a512c..ed6e038 100644
--- a/parsing_cocci/get_constants2.ml
+++ b/parsing_cocci/get_constants2.ml
@@ -309,12 +309,12 @@ let do_get_constants constants keywords env neg_pos =
   let rec type_collect res = function
       TC.ConstVol(_,ty) | TC.Pointer(ty) | TC.FunctionPointer(ty)
     | TC.Array(ty) -> type_collect res ty
-    | TC.Decimal _ -> keywords "decimal"
+    | TC.Decimal _ -> build_or res (keywords "decimal")
     | TC.MetaType(tyname,_,_) ->
-	inherited tyname
-    | TC.TypeName(s) -> constants s
-    | TC.EnumName(TC.Name s) -> constants s
-    | TC.StructUnionName(_,TC.Name s) -> constants s
+	build_or res (inherited tyname)
+    | TC.TypeName(s) -> build_or res (constants s)
+    | TC.EnumName(TC.Name s) -> build_or res (constants s)
+    | TC.StructUnionName(_,TC.Name s) -> build_or res (constants s)
     | ty -> res in

   (* no point to do anything special for records because glimpse is

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cocci] Incorrect skipping on custom types in type list
  2013-11-28  8:42 ` Julia Lawall
@ 2013-11-28 21:10   ` Michael Stefaniuc
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Stefaniuc @ 2013-11-28 21:10 UTC (permalink / raw)
  To: cocci

On 11/28/2013 09:42 AM, Julia Lawall wrote:
> A patch is below.  Thanks for the report!
> 
> julia
> 
> diff --git a/parsing_cocci/get_constants2.ml b/parsing_cocci/get_constants2.ml
> index 80a512c..ed6e038 100644
> --- a/parsing_cocci/get_constants2.ml
> +++ b/parsing_cocci/get_constants2.ml
> @@ -309,12 +309,12 @@ let do_get_constants constants keywords env neg_pos =
>    let rec type_collect res = function
>        TC.ConstVol(_,ty) | TC.Pointer(ty) | TC.FunctionPointer(ty)
>      | TC.Array(ty) -> type_collect res ty
> -    | TC.Decimal _ -> keywords "decimal"
> +    | TC.Decimal _ -> build_or res (keywords "decimal")
>      | TC.MetaType(tyname,_,_) ->
> -	inherited tyname
> -    | TC.TypeName(s) -> constants s
> -    | TC.EnumName(TC.Name s) -> constants s
> -    | TC.StructUnionName(_,TC.Name s) -> constants s
> +	build_or res (inherited tyname)
> +    | TC.TypeName(s) -> build_or res (constants s)
> +    | TC.EnumName(TC.Name s) -> build_or res (constants s)
> +    | TC.StructUnionName(_,TC.Name s) -> build_or res (constants s)
>      | ty -> res in
> 
>    (* no point to do anything special for records because glimpse is
> 

Thanks Julia, that fixed it.

bye
	michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-28 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27 22:26 [Cocci] Incorrect skipping on custom types in type list Michael Stefaniuc
2013-11-27 22:46 ` Julia Lawall
2013-11-28  8:42 ` Julia Lawall
2013-11-28 21:10   ` Michael Stefaniuc

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.