KMI Whitelists: Add functionality to make whitelists additive
authorMatthias Maennich <maennich@google.com>
Tue, 14 Jan 2020 17:34:49 +0000 (17:34 +0000)
committerMatthias Maennich <maennich@google.com>
Tue, 21 Jan 2020 18:37:43 +0000 (18:37 +0000)
commit4ecde9a80019eb79ac717210e23ce070d3378faf
tree2838f8a67884c23b9708e609c6a4ca7e9c57ade1
parent68910c530148591d55a5834933fe95b4136e75c5
KMI Whitelists: Add functionality to make whitelists additive

If multiple KMI whitelists are specified, either by passing
--kmi-whitelist several times or by having multiple whitelist sections
in the whitelist files, the generated suppressions are created as an
intersection of symbols. That is rather unusual, as whitelisting should
rather work additive. That means that the symbols (or expressions
thereof) defined across several sections or files shall be considered a
union of symbols. This patch combines the whitelist parsing to create
exactly one function_suppression and one variable suppression. A test
case has been added to ensure the functionality is working.

Please note, migrating the existing code to this new functionality is
done in a separate commit.

* include/abg-tools-utils.h
(gen_suppr_spec_from_kernel_abi_whitelists): New function.
* src/abg-tools-utils.cc
(gen_suppr_spec_from_kernel_abi_whitelists): Likewise.
* tests/.gitignore: Ignore new test executable.
* tests/Makefile.am: Add new test executable.
* tests/data/test-kmi-whitelist/whitelist-with-another-single-entry:
New test input file.
* tests/data/test-kmi-whitelist/whitelist-with-duplicate-entry:
Likewise.
* tests/data/test-kmi-whitelist/whitelist-with-single-entry:
Likewise.
* tests/data/test-kmi-whitelist/whitelist-with-two-sections:
Likewise.
* tests/data/Makefile.am: Add above test material.
* tests/test-kmi-whitelist.cc: Add new test executable.

Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
include/abg-tools-utils.h
src/abg-tools-utils.cc
tests/.gitignore
tests/Makefile.am
tests/data/Makefile.am
tests/data/test-kmi-whitelist/whitelist-with-another-single-entry [new file with mode: 0644]
tests/data/test-kmi-whitelist/whitelist-with-duplicate-entry [new file with mode: 0644]
tests/data/test-kmi-whitelist/whitelist-with-single-entry [new file with mode: 0644]
tests/data/test-kmi-whitelist/whitelist-with-two-sections [new file with mode: 0644]
tests/test-kmi-whitelist.cc [new file with mode: 0644]