Support the "name_not_regexp" property in the [suppress_type] section
authorDodji Seketeli <dodji@redhat.com>
Wed, 4 Sep 2019 08:36:31 +0000 (10:36 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 30 Sep 2019 12:56:52 +0000 (14:56 +0200)
commitd2c88645e88a85812331fbed8b2a1471c59b5b5b
treefd607bb59e8586a28979091f6d5a10571b7751e8
parentbdd927f66395e9a4a9c3febf86304a1fa71cf198
Support the "name_not_regexp" property in the [suppress_type] section

When writting a suppression specification in which the user wants to
keep a family of types (whose names set is specified by a regular
expression) and suppress/drop all other types, one needs to write
something like:

[suppress_type]
  name_regexp = (?!the-regexp-of-the-types-to-keep)

It would be nicer (like what is done for other properties that take
regular expressions as value in suppression specifications) to be able
to write:

[suppress_type]
  name_not_regexp = the-regexp-of-types-to-keep

This patch does just that.

It augments the abigail::suppr::type_suppression type to make it carry
the new 'name_not_regex' property.  It updates the suppression engine
to take the 'name_not_regex' property into account when interpreting
instances of abigail::suppr::type_suppression.  The parser for type
suppression directives is updated to recognize the new name_not_regexp
property.  The manual has been updated accordingly to describe the new
property.  New regression tests have been added.

* doc/manuals/libabigail-concepts.rst: Update this to document the
new name_not_regexp property of the suppress_type directive.
* include/abg-suppression.h
(type_suppression::{g,s}et_type_name_not_regex_str): Declare new accessors.
* src/abg-suppression-priv.h
(type_suppression::priv::{type_name_not_regex_str_,
type_name_not_regex_}): Define new data members.
(type_suppression::priv::{get_type_name_not_regex,
set_type_name_not_regex, get_type_name_not_regex_str,
set_type_name_not_regex_str}): Define new member functions.
* src/abg-suppression.cc
(type_suppression::get_type_name_regex_str): Fix comments.
(type_suppression::{set_type_name_not_regex_str,
get_type_name_not_regex_str}): Define new data members.
(suppression_matches_type_name): Adapt to support the new
type_name_not_regex property.
(read_type_suppression): Support parsing the type_name_not_regexp
property.
* tests/data/test-diff-suppr/test42-negative-suppr-type-report-0.txt:
New test reference output.
* tests/data/test-diff-suppr/test42-negative-suppr-type-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-1.txt:
New test input.
* tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-2.txt: Likewise.
* tests/data/test-diff-suppr/test42-negative-suppr-type-v0.{cc, o}: Likewise.
* tests/data/test-diff-suppr/test42-negative-suppr-type-v1.{cc,
o}: Likewise.
* tests/data/Makefile.am: Add the test files above to source
distribution.
* tests/test-diff-suppr.cc (int_out_specs): Add the new tests to
the harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
14 files changed:
doc/manuals/libabigail-concepts.rst
include/abg-suppression.h
src/abg-suppression-priv.h
src/abg-suppression.cc
tests/data/Makefile.am
tests/data/test-diff-suppr/test42-negative-suppr-type-report-0.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-report-1.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-1.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-2.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-v0.cc [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-v0.o [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-v1.cc [new file with mode: 0644]
tests/data/test-diff-suppr/test42-negative-suppr-type-v1.o [new file with mode: 0644]
tests/test-diff-suppr.cc