From: Coccinelle Date: Sun, 3 Oct 2010 12:04:16 +0000 (+0200) Subject: Release coccinelle-0.2.3rc6 X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/commitdiff_plain/18b1275a488603d2b4fcf2a36dd4ac14e0518268 Release coccinelle-0.2.3rc6 Release Candidate 6 for coccinelle-0.2.3 --- diff --git a/changes.txt b/changes.txt index de87876..b360c4d 100644 --- a/changes.txt +++ b/changes.txt @@ -77,6 +77,8 @@ - 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: diff --git a/commitmsg b/commitmsg index 9ce0a37..06f3452 100644 --- a/commitmsg +++ b/commitmsg @@ -1,3 +1,3 @@ -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 diff --git a/docs/manual/main_grammar.pdf b/docs/manual/main_grammar.pdf index d296693..c3194d8 100644 Binary files a/docs/manual/main_grammar.pdf and b/docs/manual/main_grammar.pdf differ diff --git a/docs/manual/manual.pdf b/docs/manual/manual.pdf index cef8de5..4d33b18 100644 Binary files a/docs/manual/manual.pdf and b/docs/manual/manual.pdf differ diff --git a/docs/manual/options.pdf b/docs/manual/options.pdf index 4684b60..5be7c1b 100644 Binary files a/docs/manual/options.pdf and b/docs/manual/options.pdf differ diff --git a/docs/manual/spatch_options.tex b/docs/manual/spatch_options.tex index b470d2d..3d35786 100644 --- a/docs/manual/spatch_options.tex +++ b/docs/manual/spatch_options.tex @@ -263,11 +263,13 @@ stored in a cache. \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} diff --git a/engine/asttoctl2.ml b/engine/asttoctl2.ml index 5706df1..5b7cd6f 100644 --- a/engine/asttoctl2.ml +++ b/engine/asttoctl2.ml @@ -2221,9 +2221,14 @@ and statement stmt after quantified minus_quantified (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 | _ -> @@ -2267,7 +2272,10 @@ and statement stmt after quantified minus_quantified 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 = diff --git a/globals/config.ml.in b/globals/config.ml.in index 5bfcac7..4c6280f 100644 --- a/globals/config.ml.in +++ b/globals/config.ml.in @@ -1,4 +1,4 @@ -let version = "0.2.3rc5" +let version = "0.2.3rc6" let path = try (Sys.getenv "COCCINELLE_HOME") diff --git a/parsing_c/unparse_c.ml b/parsing_c/unparse_c.ml index 7ce193e..15217bd 100644 --- a/parsing_c/unparse_c.ml +++ b/parsing_c/unparse_c.ml @@ -761,15 +761,18 @@ let rec drop_space_at_endline = function 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 *) diff --git a/test.ml b/test.ml index 7c915be..74df4b7 100644 --- a/test.ml +++ b/test.ml @@ -190,6 +190,30 @@ *) +(* + * 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 . + * + * 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 diff --git a/tests/retval2.c b/tests/retval2.c new file mode 100644 index 0000000..2076bc4 --- /dev/null +++ b/tests/retval2.c @@ -0,0 +1,25 @@ +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; + } + } +} + diff --git a/tests/retval2.cocci b/tests/retval2.cocci new file mode 100644 index 0000000..1e095a4 --- /dev/null +++ b/tests/retval2.cocci @@ -0,0 +1,19 @@ +@ 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 ...; + } diff --git a/tests/retval2.res b/tests/retval2.res new file mode 100644 index 0000000..8fcf301 --- /dev/null +++ b/tests/retval2.res @@ -0,0 +1,25 @@ +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; + } + } +} +