Re: [Cocci] [PATCH] --c++ --test will assume .cpp extension, not .c

2019-06-25 Thread Julia Lawall



On Wed, 26 Jun 2019, Michele Martone wrote:

> --c++ --test will assume .cpp extension, not .c
>
> Signed-off-by: Michele Martone 

Applied, thanks.

julia

> ---
> diff --git a/testing.ml b/testing.ml
> index 258e6c6f..784040fe 100644
> --- a/testing.ml
> +++ b/testing.ml
> @@ -97,7 +97,7 @@ let testone prefix x compare_with_expected =
>let x= if x =~ "\\(.*\\)_ver0$" then matched1 x else x in
>let base = if x =~ "\\(.*\\)_ver[0-9]+$" then matched1 x else x in
>
> -  let cfile  = prefix ^ x ^ ".c" in
> +  let cfile  = if !Flag.c_plus_plus then prefix ^ x ^ ".cpp" else prefix 
> ^ x ^ ".c" in
>let cocci_file = prefix ^ base ^ ".cocci" in
>
>let expected_out = prefix ^ base ^ out_suffix in
>
> ___
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH] --c++ --test will assume .cpp extension, not .c

2019-06-25 Thread Michele Martone
--c++ --test will assume .cpp extension, not .c

Signed-off-by: Michele Martone 
---
diff --git a/testing.ml b/testing.ml
index 258e6c6f..784040fe 100644
--- a/testing.ml
+++ b/testing.ml
@@ -97,7 +97,7 @@ let testone prefix x compare_with_expected =
   let x= if x =~ "\\(.*\\)_ver0$" then matched1 x else x in
   let base = if x =~ "\\(.*\\)_ver[0-9]+$" then matched1 x else x in

-  let cfile  = prefix ^ x ^ ".c" in
+  let cfile  = if !Flag.c_plus_plus then prefix ^ x ^ ".cpp" else prefix ^ 
x ^ ".c" in
   let cocci_file = prefix ^ base ^ ".cocci" in

   let expected_out = prefix ^ base ^ out_suffix in

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] More precise distinction of types for source code searches?

2019-06-25 Thread Markus Elfring
> @@
> expression x;
> constant c1,c2;
> @@
>
> x = c1;
> (
> x = c1;
> |
> *x = c2;
> )

Thanks for your suggestion of the possible usage of a SmPL disjunction.

* Does it indicate a search attempt to match the first assignment statement 
twice
  (for the implementation of exclusion of duplicate source code)?

* How many implementation details will become relevant for the corresponding
  documentation of the Coccinelle software?


Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] More precise distinction of types for source code searches?

2019-06-25 Thread Julia Lawall



On Tue, 25 Jun 2019, Markus Elfring wrote:

> > The expected difference can trigger the need to express this detail
> > by the usage of two identifiers based on the same metavariable type.
>
> I guess that this wording should be clarified a bit more according to
> the current software development status around the semantic patch language.
> A selection of different metavariable types is supported already.
> https://github.com/coccinelle/coccinelle/blob/c6d7554edf7c4654aeae4d33c3f040e300682f23/docs/manual/cocci_syntax.tex#L199
>
> So it seems to be occasionally appropriate to use metavariables with
> the same type while different names are chosen then for the corresponding
> variable declaration.
>
>
> Another SmPL script example:
> @test@
> constant c1, c2;
> @@
>  x =
> *c1
>  ;
>  x =
> *c2
>  ;

@@
expression x;
constant c1,c2;
@@

x = c1;
(
x = c1;
|
*x = c2;
)

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] More precise distinction of types for source code searches?

2019-06-25 Thread Markus Elfring
> The expected difference can trigger the need to express this detail
> by the usage of two identifiers based on the same metavariable type.

I guess that this wording should be clarified a bit more according to
the current software development status around the semantic patch language.
A selection of different metavariable types is supported already.
https://github.com/coccinelle/coccinelle/blob/c6d7554edf7c4654aeae4d33c3f040e300682f23/docs/manual/cocci_syntax.tex#L199

So it seems to be occasionally appropriate to use metavariables with
the same type while different names are chosen then for the corresponding
variable declaration.


Another SmPL script example:
@test@
constant c1, c2;
@@
 x =
*c1
 ;
 x =
*c2
 ;


Such a source code search specification is too generic so far
when you would really like to determine if these assignments (or its elements)
are equivalent or even identical (or not).

I am looking again for possibilities to improve language distinctions here.

* How can a single metavariable remember a mapping to a previous instance
  from its type?

* How will it become possible to match only a subset of a known base type?

* How often do you want to exclude something because of a previous match with
  a similar type?


Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci