libabigail/tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr
Dodji Seketeli 1eecd89ee1 Bug 19619 - failing to suppress added aliased function reports for C++
Libabigail is designed to avoid suppressing a change report about an
added (or removed) function if that function has aliases.  For the
change report to be suppressed, the condition of the suppression
specification must match all the aliases of the symbol of the
function.  This is to avoid suppressing change reports about aliases
by error.

If the binary results from a C program, the name of the function is
the same as the name of its underlying symbol.  So if the condition of
the suppression specification is the property "name_regexp", the value
of the condition can be made to match the names of all the aliases of
the underlying symbol of the function.  In that case, if value of the
property name_regexp does *NOT* match all the aliases, then it's OK
for the "change report suppression sub-system" to avoid suppressing
the change report.

But if the binary results from a C++ program, the name of the function
is *different* from the name of its underlying symbol.  If the
condition of the suppression specification is the property
"name_regexp", there is *NO* way for the user to provide a value which
matches *ANY* of the names of the underlying function symbols while
also matching the name of the function.  So in this case, the "change
report suppression sub-system" should assume that the user wants to
suppress the change reports about all the aliases of the function.

In this problem report, the issue is that in the case of a C++ program
for which the user provided the "name_regexp" property, Libabigail is
expecting the "name_regexp" to match all the aliased symbol
names. Which is not possible.  So the suppression specification is not
suppressing the change report about the added function, just because
the function has an alias.

This patch fixes the issue by taking into account the difference
between languages where the name of the function is the same as the
name of their underlying symbol and languages where it is not.

	* src/abg-comparison.cc
	(function_suppression::suppresses_function): Make the evaluation
	of the "name" and "name_regexp" consider the cases of languages in
	which the function name is the same as the symbol name and the
	case of languages in which it is not.  In the former case, all
	symbol alias names must be matched.  In the latter case, if "name"
	and "name_regexp" match the function name, the suppression
	specification is considered to match the report about the function
	change.  Also, use the elf_symbol::is_main_symbol() predicate to
	test for the symbol being a main symbol, rather than using
	error-prone pointer equality.
	* tests/data/test-diff-suppr/test27-add-aliased-function-0.suppr:
	New test input.
	* tests/data/test-diff-suppr/test27-add-aliased-function-1.suppr: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-2.suppr: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-3.suppr: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-4.suppr: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-5.txt: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-v0.cc: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-v0.o: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-v1.cc: Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-v1.o: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-0.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-1.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-2.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-4.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-5.suppr: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-5.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-6.txt: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-v0.c: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-v0.o: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-v1.c: Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-v1.o: Likewise.
	* tests/data/Makefile.am: Add the new test material above to the
	source distribution.
	* tests/test-diff-suppr.cc: Add the new test inputs above to this
	test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-13 08:47:41 +01:00

3 lines
74 B
Plaintext

[suppress_function]
symbol_name = bar
change_kind = added-function