[Cocci] Can we stop supporting OCaml 3.11?

2015-08-26 Thread Sébastien Hinderer
Dear all,

At the moment, the oldest version of OCaml which can be used to compile
Coccinelle is 3.11.
However, it turns out that OCaml 3.11.2 (released in January 2010)
has a bug that pevents from compiling the optimized version o
Coccinelle.

We would like to drop our support of OCaml 3.11 and start with OCaml
3.12.0 that has been released in August 2010.

Is anybody still using OCaml 3.11?

Thanks a lot for your reponse,

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


Re: [Cocci] release: 1.0.2: Software evolution around parallelisation support

2015-08-26 Thread SF Markus Elfring
>> Can it be determined from the content of a semantic patch language script
>> if the spawned subprocesses need any more data exchange (with the parent 
>> process)
>> besides the usual files like standard output and standard error?
> 
> In the short term, there is no improvement planned in this direction.
> It is important that Coccinelle does not know anything about the script code

Thanks for your feedback.


> - we don't want to include parsers for other languages,

I assume that might mean that no such extensions will be added in the near 
future.
I guess that the scripting interfaces are generally extensible so that
other programming languages can be integrated in principle if someone would be
keen enough to invest further software development efforts.


> and it would further raise the barrier for adding other scripting languages.

The inherent system complexity was already increased just by the added
parallelisation support with the parmap interface.


> If you need initialize and finalize, just use the current parallelism 
> solution.

I am using this approach around the parameters "--index" and "--max" for a 
while.
I came similar challenges along during the development of my make scripts.


I imagine that these SmPL rules can still be executed by the main process
while the execution of the other rules will be delegated to subprocesses
(or even threads). The scripting environments in the subprocesses would 
additionally
check then which variables accesses should be transformed into data processing
requests for the main process.
When would you like to pick corresponding software development challenges up
around inter-process communication?


> You will get n results instead of 1 result, but it is better than getting
> 15 000 results, as would happen with parmap.

There are some trade-offs involved. I find it nicer when the Coccinelle software
can be directly reused for more use cases.

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


[Cocci] [PATCH v2] coccinelle: add style check for assignment in if

2015-08-26 Thread Kris Borer
Add a semantic patch for fixing some cases of checkpatch.pl error:

ERROR: do not use assignment in if condition

Signed-off-by: Kris Borer 
Acked-by: Julia Lawall 
---
 scripts/coccinelle/style/assignment_in_if.cocci | 128 
 1 file changed, 128 insertions(+)
 create mode 100644 scripts/coccinelle/style/assignment_in_if.cocci

diff --git a/scripts/coccinelle/style/assignment_in_if.cocci 
b/scripts/coccinelle/style/assignment_in_if.cocci
new file mode 100644
index 000..b23db8f
--- /dev/null
+++ b/scripts/coccinelle/style/assignment_in_if.cocci
@@ -0,0 +1,128 @@
+/// move assignments out of if conditions
+///
+//# This script is designed to correct code where assignments exist in if
+//# conditions. It is only capable of handling a subset of such problems.
+//# Ideally it would handle all checkpatch errors of the following type:
+//#ERROR: do not use assignment in if condition
+//#
+//# For example:
+//#if(result = myfun())
+//#
+//# would become:
+//#result = myfun();
+//#if(result)
+//
+// Confidence: Moderate
+// Copyright: (C) 2015 Kris Borer.  GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Comments:
+// Options: --no-includes --include-headers
+
+virtual patch
+
+
+// if ( (ret = call()) )
+// if ( (ret = call()) < 0 )
+@if1@
+expression i;
+expression E, E2;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+- (i = E)
++ i
+  b ...
+|
+- (i = E),
+  E2
+)
+  ) S1 else S2
+
+
+// if ( ptr->fun && (ret = ptr->fun()) )
+@if2@
+expression i2;
+expression E1, E2;
+@@
+
++ if( E1 ) {
++   i2 = E2;
++   if (i2) {
+- if( E1 && (i2 = E2) ) {
+  ...
+- }
++   }
++ }
+
+
+// if ( ptr->fun && (ret = ptr->fun()) < 0 )
+@if3@
+expression i2;
+expression E1, E2;
+constant c;
+binary operator b;
+@@
+
++ if( E1 ) {
++   i2 = E2;
++   if (i2 b c) {
+- if( E1 && ((i2 = E2) b c) ) {
+  ...
+- }
++   }
++ }
+
+
+// if ( (ret = call()) && ret != -1 )
+// if ( (ret = call()) < 0 && ret != -1 )
+@if4@
+expression i;
+expression E, E2;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+  (
+- (i = E)
++ i
+  b
+  ...)
+)
+  && E2 ) S1 else S2
+
+
+// if ( (ret = call()) && ret != -1 && ret != -2 )
+// if ( (ret = call()) < 0 && ret != -1 && ret != -2 )
+@if5@
+expression i;
+expression E, E2, E3;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+  (
+- (i = E)
++ i
+  b
+  ...)
+)
+  && E2 && E3 ) S1 else S2
-- 
1.9.1

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


[Cocci] [RFC v3] coccinelle: add style check for assignment in if

2015-08-26 Thread Kris Borer
Add a semantic patch for fixing some cases of checkpatch.pl error:

ERROR: do not use assignment in if condition

Signed-off-by: Kris Borer 
---
Differences from Julia's version:
 - removed some disjuction variations that led to improper transformations
 - fixed header format
 - added and updated comments
 - reformatted some rules

 scripts/coccinelle/style/assignment_in_if.cocci | 140 
 1 file changed, 140 insertions(+)
 create mode 100644 scripts/coccinelle/style/assignment_in_if.cocci

diff --git a/scripts/coccinelle/style/assignment_in_if.cocci 
b/scripts/coccinelle/style/assignment_in_if.cocci
new file mode 100644
index 000..57f692d
--- /dev/null
+++ b/scripts/coccinelle/style/assignment_in_if.cocci
@@ -0,0 +1,140 @@
+/// move assignments out of if conditions
+///
+//# This script is designed to correct code where assignments exist in if
+//# conditions. It is only capable of handling a subset of such problems.
+//# Ideally it would handle all checkpatch errors of the following type:
+//#ERROR: do not use assignment in if condition
+//#
+//# For example:
+//#if(result = myfun())
+//#
+//# would become:
+//#result = myfun();
+//#if(result)
+//
+// Confidence: Moderate
+// Copyright: (C) 2015 Kris Borer.  GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Comments:
+// Options: --no-includes --include-headers
+
+virtual patch
+
+
+// if ( (ret = call()) )
+// if ( (ret = call()) < 0 )
+@if1@
+expression i;
+expression E, E2;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+- (i = E)
++ i
+  b ...
+|
+- (i = E),
+  E2
+)
+  ) S1 else S2
+
+
+// if ( ptr->fun && (ret = ptr->fun()) )
+@if2@
+expression i2;
+expression E1, E2;
+@@
+
++ if( E1 ) {
++   i2 = E2;
++   if (i2) {
+- if( E1 && (i2 = E2) ) {
+  ...
+- }
++   }
++ }
+
+
+// if ( ptr->fun && (ret = ptr->fun()) < 0 )
+@if3@
+expression i2;
+expression E1, E2;
+constant c;
+binary operator b;
+@@
+
++ if( E1 ) {
++   i2 = E2;
++   if (i2 b c) {
+- if( E1 && ((i2 = E2) b c) ) {
+  ...
+- }
++   }
++ }
+
+
+// if ( (ret = call()) && ret != -1 )
+// if ( (ret = call()) < 0 && ret != -1 )
+@if4@
+expression i;
+expression E, E2;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+  (
+- (i = E)
++ i
+  b
+  ...)
+)
+  && E2 ) S1 else S2
+
+
+// if ( (ret = call()) && ret != -1 && ret != -2 )
+// if ( (ret = call()) < 0 && ret != -1 && ret != -2 )
+@if5@
+expression i;
+expression E, E2, E3;
+statement S1, S2;
+binary operator b;
+@@
+
++ i = E;
+  if (
+(
+- (i = E)
++ i
+|
+  (
+- (i = E)
++ i
+  b
+  ...)
+)
+  && E2 && E3 ) S1 else S2
+
+
+// warn about any assignments that were missed
+@if6@
+expression i,e;
+statement S1,S2;
+@@
+
+  if (<+...
+- i = e
++ BAD
+  ...+>) S1 else S2
-- 
1.9.1

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


Re: [Cocci] release: 1.0.2: Software evolution around parallelisation support

2015-08-26 Thread Julia Lawall


On Wed, 26 Aug 2015, SF Markus Elfring wrote:

> > There is no shared memory in ocaml.
>
> How do you think about to reuse any other application programming interfaces
> for inter-process communication?
> https://ocaml.github.io/ocamlunix/sockets.html
>
>
> Can it be determined from the content of a semantic patch language script
> if the spawned subprocesses need any more data exchange (with the parent 
> process)
> besides the usual files like standard output and standard error?

In the short term, there is no improvement planned in this direction.  It
is important that Coccinelle does not know anything about the script code
- we don't want to include parsers for other languages, and it would
further raise the barrier for adding other scripting languages.  If you
need initialize and finalize, just use the current parallelism solution.
You will get n results instead of 1 result, but it is better than getting
15 000 results, as would happen with parmap.

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