./devel/coccinelle, Tool for writing and applying semantic patches

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 1.1.1nb2, Package name: coccinelle-1.1.1nb2, Maintainer: pkgsrc-users

Coccinelle is a program matching and transformation engine which provides
the language SmPL (Semantic Patch Language) for specifying desired matches
and transformations in C code. Coccinelle was initially targeted towards
performing collateral evolutions in Linux. Such evolutions comprise the
changes that are needed in client code in response to evolutions in library
APIs, and may include modifications such as renaming a function, adding a
function argument whose value is somehow context-dependent, and reorganizing
a data structure. Beyond collateral evolutions, Coccinelle is successfully
used (by us and others) for finding and fixing bugs in systems code.


Required to run:
[lang/ocaml] [lang/camlp4] [lang/python37]

Required to build:
[devel/ocaml-findlib] [pkgtools/cwrappers]

Master sites:

Filesize: 2679.157 KB

Version history: (Expand)


CVS history: (Expand)


   2023-08-14 07:25:36 by Thomas Klausner | Files touched by this commit (1247)
Log message:
*: recursive bump for Python 3.11 as new default
   2023-06-06 14:42:56 by Taylor R Campbell | Files touched by this commit (1319)
Log message:
Mass-change BUILD_DEPENDS to TOOL_DEPENDS outside mk/.

Almost all uses, if not all of them, are wrong, according to the
semantics of BUILD_DEPENDS (packages built for target available for
use _by_ tools at build-time) and TOOL_DEPEPNDS (packages built for
host available for use _as_ tools at build-time).

No change to BUILD_DEPENDS as used correctly inside buildlink3.

As proposed on tech-pkg:
https://mail-index.netbsd.org/tech-pkg/2023/06/03/msg027632.html
   2022-06-30 13:19:02 by Nia Alarie | Files touched by this commit (524)
Log message:
*: Revbump packages that use Python at runtime without a PKGNAME prefix
   2022-06-04 12:47:48 by Thomas Klausner | Files touched by this commit (2)
Log message:
coccinelle: add upstream bug report URL
   2022-06-04 12:44:31 by Thomas Klausner | Files touched by this commit (5) | Package updated
Log message:
coccinelle: update to 1.1.1.

* 1.1.1
** Language:
- Semantic patch for other languages
- Support metavariables, virtual rules and virtual identifiers
  in initialize and finalize rules
- Support for matching #ifdef, etc.
- function-typed metavariables
- virtual typedef, declarer name, iterator name
- regexps for type metavariables
- 'symbol' metadeclaration for C identifiers that are guaranteed not intended as \ 
meta variables.
- allow mixing isomorpisms with normal rules

** Features:
- New scripting languages
- more than one SP on the command line
- interpret #if, as is done for #ifdef
- restored support for with-python in configure and support for --python option
  in the command line to use a specific python interpreter

** Bugfix:
- Add more information in documentation, man pages and wiki
- typedefs from C code should not be used before their point of inference
  (saved_typedefs in cprogram_of_file)

* 1.1.0
** Language
- Allow fresh ids to be generated from a script
- Account for metavariables used as the argument of typeof
- Allow for annotations as metavariables
- Allow auto as type when processing a C++ file (C++ >= 11)
- bool is now a known typedef
- Add support for statement list
- Better handling of annotations
** Features
- Allow command line options to be written in cocci files using the #spatch
  directive
- Add --opt-c option to try and process a C file only if it exists (ignore
  its absence otherwise)
- Allow for user to optionally specify the C++ version with the --c++ argument
- More efficient management of header files
** Bugfix
- Improved documentation (mostly metadecl)
- Improved pretty printing
- Improved error reporting
- Better handling of "complex" pointer types (e.g. char * const *)
- Fix expected grammar to better fit C99's:
  - Allow assigning to the dereferencing of a function call. Problem reported
    by Joe Perches
- Camlp4 is no longer needed
- Removed the pygtk dependency
- Stop relying on Pervasives but on Stdcompat.Stdlib for backward compatibility

* 1.0.9
** Language:
- More kinds of string and char constants, mostly from C11. Not typed
  correctly. Requested by Michael Stefaniuc.
- Field conj, disj, and opt can now successfully match field metavariables
** Features:
- Try to avoid passing arguments of macro calls with no trailing semicolon
** Bugfix:
* 1.0.8
** Language:
- Support for long double complex, double complex and float complex at the
  C and SmPL level.
- Add conjunction for identifiers.
- Simplify pragma matching.
- Support llu in C code and SmPL code.  Suggested by Timur Tabi.
- Add support for macros with an initialiser as the body.  Requested by
  Thomas Pedersen.
- Allow scripts on comment metavariables.  Requested by Christoph Böhmwalder.
** Features:
- Some changes to the kinds of transformation allowed on declarations or
  fields with multiple variables.  See the last paragrph of the
  declarations section in the manual.
- Minimal support for multi-line pragmas.  C parsing is supported, but
  matching is not.
- Allow changing the extension of the name of the file checked by
  --compare-with-expected, using the --expected-extension flag.
- Optimize case of { ... } when the braces are removed to avoid going
  through the body.
- Allow const on signed/unsigned in SmPL.
** Bugfix:
- check identifier constraints when an identifier metavariable appears in a
  struct-typed metavariable.
- type for eg &a->b should be const when a is const
- Allow modifications within a function pointer typedef - reported by
  Jerome Glisse
* 1.0.7
** Language:
- Allow constraints on any metavariables. Constraints can be specified
  by comprehension (= { ... } or != { ... }, with each item referring
  to a constant identifier or an inherited meta-variable, and
  curly-brackets can be omitted for a single item), regular expression
  (=~ "..." or !~ "..."), integer comparison (<=, <, \ 
>=, >) or scripts
  (:script:...). Constraints can be used in conjunctions (&&),
  disjunctions (||) and can be negated (!)  and parenthesized.
  Sub-expression constraints (<=) are still dealt separately and can
  only be used individually or in conjunction with other constraints
  (not under a disjunction or a negation). See tests/constraints.cocci
  and tests/type_constraints.cocci
- Allow script finalizers for parallel computation.  See
  tests/countcalls.cocci and tests/countcalls_python.cocci
- Allow disjunctions on a wider range of syntactic constructions (function
  definitions, variable declarations, ...). See tests/disj.cocci.
- Finalizers now occur before iteration loop and can register new
  iterations.
- Multiple initializers and finalizers are allowed for the same language.
- Support function pointer types in casts.
- Allow something identified as a MacroDecl as a structure field.
- Conjunctions, ie ( & ), for declarations.
- Optional bitfield annotation on expression meta-variables. Requested by
  Kumar Gala. See tests/bitfield_matching.cocci
- Bit-field matching, see tests/bitfield.cocci
- Anonymous field matching, see tests/anonfield.cocci
- current_element position information in position structure (ocaml &
  python)
- matching and transformation of a single attribute after a variable name
  in a variable declaration.
- add conjunctions on types.
- make addition of __attribute__((...)) on function definitions work
- add typeof to the semantic patch language
- require "name" when declaring attribute names.
- Support some changes on function pointer typedefs.
- allow a coccinelle ocaml script to detect whether parallelism is used,
  via Flag.parmap_core (None for no pararallelism, and Some x for x cores)
- Make it possible to match or add an empty struct type declaration.
  Suggestion of Michele Martone.
- --backup-suffix replaced by --suffix and made applicable to --out-place
** Features:
- Better error reporting for unparsable terms when using make_expr etc in
  script code.  Problem reported by Markus Elfring.
- --ignore command line argument to specify a prefix of the names of files
  that should be ignored.
- added --max-width to adjust the line width for generated code.  Requested
  by Kumar Gala.
- forall and exists for quantifying over the success of matching depends on
  constraints.
- --verbose-includes option to show what files are actually included
- allow casts to unknown typedefs on more kinds of constants (reported by
  Yann Droneaud)
- Pick up header files that have the same name as the desired one if they
  are unique in the provided include paths.
- Caching of parsed header files, --no-include-cache to disable.
- --force-kr and --prevent-kr options to control whether K&R parsing is
  considered.
- Generalization of script constraints to allow reference to metavariables
  defined in the same rule, only when the constrained metavariable always
  occurs in rule_elems that also mention any other local metavariables
  mentioned in the script constraint.  Referenced local variables must be
  declared before the constrained one.
- Allow more variety in #pragmas
- Add macro names to Coccilib.current_element
- Get rid of code that depends on unbound virtual rules
- Bash-completion scripts are now installed in share/bash-completion/completions
  (overridable with the new with-bash-completion option,
  reported by Himanshu Jha)
- Allow using -o when only the main file changes, even if headers have been
  matched.
- Preserve spacing for comments in statement and declaration metavariables,
  when they are used in + code.
** Bugfix:
- Improved detection of metavariables in strings.  Problem reported by
  Wolfram Sang.
- Don't require all metavars in type exp meta constraint to be bound,
  unless only one type is specified.  Problem reported by Michael Stefaniuc.
- Finalization scripts are executed even in case there is no other script rules.
- spatch should find standard.iso and Python modules even if COCCINELLE_HOME
  and PYTHONPATH are not set (either in the directory where the executable is
  if it contains standard.iso, or in ../lib/coccinelle relatively to where the
  executable is).
- Improve SmPL parsing of added __attribute__.  Problem repported by
  Eduardo Habkost.
- In python scripts, virtuals should not overwrite locals with the same
  name.  Problem reported by Bhumika Goyal.
- Identify typedefs in type metavariable constraints, problem identified by
  Michele Martone.
- #ifdefs and cpp directives should not be able to be bound to MetaField
  metavariables.  Problem found using an example contributed by Michele
  Martone.
* 1.0.6
** Language:
- Allow \ in #define in semantic patch rules, to allow body with multiple
  lines, potentially including changes.  As a side effect, \ is also
  allowed in when specifications, again to allow patterns to stretch over
  multiple lines.
- Add identifier list metavariables for #define parameter lists
** Features:
- Add Coccilib.version() allowing ocaml code to access the version of
  spatch being used.
- Per file profiling with --profile-per-file for processing of directories.
- allow -j9 and -Ifoo, as used in some other tools
** Bugfix:
- Allow parallel compilation for bundles.  Issue identified by Luis Rodriguez.
- Allow the use of absolute path names with id-utils.  Issue identified by
Luis Rodriguez.
- Clean up temporary files when using parmap.  Issue identified by Luis
Rodriguez.
- Do nothing when there are no files to work on, avoiding parmap temporary
  file creation issues.
* 1.0.5
** Language:
- In the Coccilib interface, the function file, giving the file being
  currently processed, has become files, returning a list of file names,
  because Coccinelle can work on more than one file at once.
- For typedefs, symbols, iterator names, and declarer names, allow
  redeclaration as either the same kind, or temporary redeclaration as a
  metavariable.
- Support for Python 3. Pycaml has been patched. The bundled version is
  systematically used, even if Pycaml is already installed locally.
- Support for iterations in Python scripts
- Metavariable initialization in Python scripts to a number of kinds of
  AST structures
** Features:
- addition of --file-groups option
- ocaml code allowed as constraints on position variables
- --enable-release configure option not accepted any longer.
- Extend pycocci SmPL <=> Patch equivalence proof with [ -c | --clean-proof ]
  support to enable support for a quiet and clean SmPL patch proof, this will
  nuke any temporary branches used for the proof if everything went well.
- Add support for SmPL <=> Patch equivalence using pycocci using patches,
  for an example refer to:
	o tests/pycocci/patches/0001-proto3*
	o tests/pycocci/code/0001-proto3/
  To test, use: ./scripts/pycocci-check.sh after building Coccinelle.
  This will touch your reflog though, and as such is disabled by default,
  to clean your reflog you can use: git reflog expire --all --expire=now
- Added --tmp-dir option, to specify the name of the temporary directory
  used to hold the results obtained on the different cores with the -j option.
- --defined and --undefined arguments now apply to #if as well as #ifdef.
  The expression has to be written exactly as it appears in the code, minus
  leading whitespace and any comments (leading or nonleading).
- Compare the standard output of scripts in test files with testfile.stdout
  if provided (with --compare-with-expected)
- Compatible with OCaml 4.03.0
** Bugfix:
- pycocci: skip proof when git dir is dirty
- pycocci: fix gitname use, when using SmPL <=> patch equivalence proof
  support and a relative path was used as target the git project base
  directory was not being found, using absolute paths fixes this.
- Don't complain about unreferenced variables in ungenerated rules
- Be flexible about the matching of the first or last comma in a
  ... parameter or expression list, also in the case of transformation.
- Fix various omissions related to binary and assignment metavariables.
- Add whitespace on C code/transformed code boundary.
- Types declared in header files are now taken into account while parsing
  C files.
- ( and & now allowed at the start of a line in a SmPL rule header
- Remove added space when removing unneeded parens at the start of an
  arglist, reported by Daniel Lundqvist
- Better pretty printing of array type declarations that result from T i;
  where at least T is a metavariable.
- Various improvements in the pretty printing of C code stored in
  metavariables.
- Bundled Menhir can now be used to compile the mly grammar.
- Bundled PCRE now links correctly.
* 1.0.4
** Language:
- Length for statement list metavariables
** Features:
- file in declaration for depends on constraints
** Bugfix:
- build system: delete pregenerated parsers if menhir is installed
* 1.0.3
** Language:
- Conjunction (analogous to disjunction)
- Drop Circles, Stars
- Drop Unique
- Default values for script metavariables
** Features:
- Removed the extlib and sexp bundles which were not used any more.
- Drop support for OCaml 3.11 which did not allow to compile coccinelle in
  native code
- Print metavariables properly for script code.
- Print metavariables properly for cocci code.
- SYSCALL_DEFINE macros, contributed by Jörn Engel
- --indent option, giving default indent, for projects not using tabs
- Introduce .cocciconfig configuration file
- Add some support for MetaStmtList.  Allowed at top level of {}.
- timeout of 0 is no timeout, to allow cancelling this option.
- --print-options-only to see accumulated options.
** Bugfix:
- Allow virtual variable definition to contain an =.
- Improvement when exists rule contains when forall.
- The presence of camlp4 is no longer checked when not needed
  (only required to compile the bundled OCaml bindings for Python)
* 1.0.2
** Language:
** Features:
- Positions of C tokens are now computed while lexing rather than
  during a distinct pass. This makes use of the Lexing.new_line function
  which has been introduced in OCaml 3.11.
  Coccinelle can thus no longer be compiled with OCaml 3.10.
- --use-gitgrep falls back to --use-coccigrep for a non-git repository.
- ocaml coccilib allows propagating identifiers, expressions, statements,
  listlens, and positions to subsequent matching rules, via new ocaml code
  constructors: make_ident, make_expr, make_expr_with_env etc.
- Allow @S, for statement metavariable S on expressions
- Exploit explicit positive constraints (no regexps) on identifiers in
  file filtering
- Ability to declare a rule as matching an identifier.  Doesn't work
  properly for names of typedefs, enums, structures, or unions.
- autogen creates a version number that corresponds to the most recent commit.
** Bugfix:
- Coccinelle's "make install" now copies files to /usr/local/lib instead of
  /usr/local/share
- Iso: allow mixed for model for the case where the model is just a metavar
  Thanks to Kris Borer for reporting the problem
- Allow ! to propagate into == or other ops in more cases.
   2022-05-24 20:51:57 by Jaap Boender | Files touched by this commit (118) | Package updated
Log message:
Recursive revbump associated with update of ocaml.

Also change of mk/ocaml.mk to lang/ocaml/ocaml.mk.
   2021-10-26 12:20:11 by Nia Alarie | Files touched by this commit (3016)
Log message:
archivers: Replace RMD160 checksums with BLAKE2s checksums

All checksums have been double-checked against existing RMD160 and
SHA512 hashes

Could not be committed due to merge conflict:
devel/py-traitlets/distinfo

The following distfiles were unfetchable (note: some may be only fetched
conditionally):

./devel/pvs/distinfo pvs-3.2-solaris.tgz
./devel/eclipse/distinfo eclipse-sourceBuild-srcIncluded-3.0.1.zip
   2021-10-07 15:44:44 by Nia Alarie | Files touched by this commit (3017)
Log message:
devel: Remove SHA1 hashes for distfiles