- Fixed environment management when script rule uses cache. Thanks to
Bissyande for finding the problem.
- when false matches if with no else
+- ensure { ... } with whencode checks to the end of the function. Thanks to
+ Rene Rydhof Hansen for finding the problem.
* 0.2.2
** Language:
-Release coccinelle-0.2.3rc5
+Release coccinelle-0.2.3rc6
-Release Candidate 5 for coccinelle-0.2.3
+Release Candidate 6 for coccinelle-0.2.3
\normal{-macro\_file $\langle$file$\rangle$}{
Extra macro definitions to be taken into account when parsing the C
- files.}
+ files. This uses the provided macro definitions in addition to those in
+ the default macro file.}
\normal{-macro\_file\_builtins $\langle$file$\rangle$}{
Builtin macro definitions to be taken into account when parsing the C
- files.}
+ files. This causes the macro definitions provided in the default macro
+ file to be ignored and the ones in the specified file to be used instead.}
\rare{-ifdef\_to\_if,-no\_ifdef\_to\_if}{
The option {\bf -ifdef\_to\_if}
(match d with
Ast.MINUS(_,_,_,_) -> None
| _ ->
+ let pv =
+ (* no nested braces, because only dots *)
+ string2var ("p1") in
+ let paren_pred =
+ CTL.Pred(Lib_engine.Paren pv,CTL.Control) in
Some (
make_seq
- [start_brace;
+ [ctl_and start_brace paren_pred;
match whencode with
[] -> CTL.True
| _ ->
CTL.True
| Ast.WhenModifier(_) -> prev)
CTL.True whencode) in
- ctl_au leftarg (make_match stripped_rbrace)]))
+ ctl_au leftarg
+ (ctl_and
+ (make_match stripped_rbrace)
+ paren_pred)]))
| _ -> None)
| _ -> None in
let optim2 =
-let version = "0.2.3rc5"
+let version = "0.2.3rc6"
let path =
try (Sys.getenv "COCCINELLE_HOME")
let minus_or_comment_or_space_nocpp = function
T2(_,Min adj,_) -> true
| (T2(Parser_c.TCommentSpace _,Ctx,_i)) -> true
- | (T2 (Parser_c.TCommentNewline _,Ctx,_i)) -> false
- | x -> is_minusable_comment_nocpp x in
+ | (T2(Parser_c.TCommentNewline _,Ctx,_i)) -> false
+ | x -> false in
let (minus,rest) = Common.span minus_or_comment_or_space_nocpp rest in
- (match (minus,rest) with
- ([],_) -> a::outer_spaces@(drop_space_at_endline rest)
- | (_,(((T2 (Parser_c.TCommentNewline _,Ctx,_i)) as a) :: rest)) ->
- (* drop trailing spaces *)
- minus@a::(drop_space_at_endline rest)
- | _ -> a :: outer_spaces @ minus @ (drop_space_at_endline rest))
+ let fail _ = a :: outer_spaces @ minus @ (drop_space_at_endline rest) in
+ if List.exists (function T2(_,Min adj,_) -> true | _ -> false) minus
+ then
+ match rest with
+ ((T2(Parser_c.TCommentNewline _,Ctx,_i)) as a)::rest ->
+ (* drop trailing spaces *)
+ minus@a::(drop_space_at_endline rest)
+ | _ -> fail()
+ else fail()
| a :: rest -> a :: drop_space_at_endline rest
(* if a removed ( is between two tokens, then add a space *)
*)
+(*
+ * Copyright 2010, INRIA, University of Copenhagen
+ * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
+ * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
+ * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
+ * This file is part of Coccinelle.
+ *
+ * Coccinelle is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, according to version 2 of the License.
+ *
+ * Coccinelle is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The authors reserve the right to distribute this or future versions of
+ * Coccinelle under other licenses.
+ *)
+
+
(*
* Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
* Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
--- /dev/null
+int getlen(int *input, size_t maxlen, int delim, size_t *result) {
+ size_t i;
+ for (i = 0; i < maxlen; ++i) {
+ if (input[i] == delim) {
+ if (result != NULL) {
+ *result = i;
+ }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+int getlen(int *input, size_t maxlen, int delim, size_t *result) {
+ size_t i;
+ for (i = 0; i < maxlen; ++i) {
+ if (input[i] == delim) {
+ if (result != NULL) {
+ *result = i;
+ }
+ return 0;
+ }
+ }
+}
+
--- /dev/null
+@ voidfunc @
+function fn;
+position voidpos;
+@@
+ void fn@voidpos(...) {
+ ...
+ }
+
+@ func disable ret exists @
+type T;
+function fn;
+position pos != voidfunc.voidpos;
+@@
+ T
+- fn@pos
++ newname
+ (...) {
+ ... WHEN != return ...;
+ }
--- /dev/null
+int getlen(int *input, size_t maxlen, int delim, size_t *result) {
+ size_t i;
+ for (i = 0; i < maxlen; ++i) {
+ if (input[i] == delim) {
+ if (result != NULL) {
+ *result = i;
+ }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+int newname(int *input, size_t maxlen, int delim, size_t *result) {
+ size_t i;
+ for (i = 0; i < maxlen; ++i) {
+ if (input[i] == delim) {
+ if (result != NULL) {
+ *result = i;
+ }
+ return 0;
+ }
+ }
+}
+