libabigail/tests/data/test-diff-pkg-ctf/test-rpm-report-0.txt
Dodji Seketeli 19d4131964 Improve type naming
There are a number of glitches when pretty-printing type names.

This is particularly true for derived types like pointer to functions,
array of pointer to functions and the likes.

For instance, we can see in
tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt that a
function N that takes no parameter and returns a pointer to an array
of 7 int is pretty-printed as:

    int[7]* N()

That obviously doesn't respect the type naming rules of C or C++.

With this patch, function N is declared as:

    int(*N(void))[7]

To learn more about the impact of the patch on how types are
pretty-printed, you can look at the parts of the patch that are
adjustments to the expected output of the regression tests.

For instance, here is how the expected output of type pretty-printing
in tests/data/test-abidiff-exit/PR30048-test-2 is modified by this
patch:

    diff --git a/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt b/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt
    index 2650b5a0..7bbbc2e2 100644
    --- a/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt
    +++ b/tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt
    @@ -3,22 +3,22 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

     7 functions with some indirect sub-type change:

    -  [C] 'function int[7]* N()' at PR30048-test-2-v0.cc:62:1 has some indirect sub-type changes:
    +  [C] 'function int(*N(void))[7]' at PR30048-test-2-v0.cc:62:1 has some indirect sub-type changes:
	 return type changed:
    -      entity changed from 'int[7]*' to 'int'
    +      entity changed from 'int(*)[7]' to 'int'
	   type size changed from 64 to 32 (in bits)

    -  [C] 'function int* O()' at PR30048-test-2-v0.cc:64:1 has some indirect sub-type changes:
    +  [C] 'function int* O(void)' at PR30048-test-2-v0.cc:64:1 has some indirect sub-type changes:
	 return type changed:
	   entity changed from 'int*' to 'int'
	   type size changed from 64 to 32 (in bits)

    -  [C] 'function int ()* P()' at PR30048-test-2-v0.cc:67:1 has some indirect sub-type changes:
    +  [C] 'function int (*P(void))(void)' at PR30048-test-2-v0.cc:67:1 has some indirect sub-type changes:
	 return type changed:
    -      entity changed from 'int ()*' to 'int'
    +      entity changed from 'int (*)(void)' to 'int'
	   type size changed from 64 to 32 (in bits)

Note that the change to the CTF test
tests/data/test-read-ctf/test9.o.abi is triggered by a change in the
sorting of types because types are sorted alphabetically.

All in all, this is clearly an overdue improvement to the type name
pretty-printing.

	* include/abg-fwd.h (is_npaf_type, is_pointer_to_function_type)
	(is_pointer_to_array_type, is_pointer_to_npaf_type): Declare new
	functions.
	(is_pointer_type, is_reference_type, is_array_type): Take a
	boolean parameter to look through qualifiers.
	* include/abg-ir.h (is_pointer_type): Do not make this function a
	friend of the type_or_decl_base class anymore.
	* src/abg-ir.cc (pointer_declaration_name, array_declaration_name)
	(stream_pretty_representation_of_fn_parms)
	(add_outer_pointer_to_fn_type_expr)
	(add_outer_pointer_to_array_type_expr): Define new static
	functions.
	(is_npaf_type, is_pointer_to_function_type)
	(is_pointer_to_array_type, is_pointer_to_npaf_type): Define new
	functions.
	(get_type_representation): Remove the overload for array_type_def.
	(get_function_type_name, get_method_type_name)
	(function_decl::get_pretty_representation_of_declarator): Use the
	new stream_pretty_representation_of_fn_parms.  This actually
	factorizes parameters pretty-printing by reusing
	stream_pretty_representation_of_fn_parms.
	(is_pointer_type, is_reference_type, is_array_type): Take a
	boolean parameter to look through qualifiers.
	(is_void_pointer_type): Use const where it's due.
	(pointer_type_def::get_qualified_name): Use the new
	pointer_declaration_name in lieu of the old and removed
	get_name_of_pointer_to_type.
	(array_type_def::{get_pretty_representation, get_qualified_name}):
	Use the new array_declaration_name instead of the old and removed
	get_type_representation.
	(var_decl::get_pretty_representation): Use the new
	array_declaration_name and pointer_declaration_name.
	(function_decl::get_pretty_representation): Use the new
	add_outer_pointer_to_array_type_expr, and
	add_outer_pointer_to_array_type_expr function to support the
	proper syntax for function returning pointers and arrays.
	(function_decl::parameter::get_pretty_representation): Fix the
	pretty-printing of each function parameter.
	* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
	* tests/data/test-abicompat/test0-fn-changed-report-2.txt:
	Likewise.
	* tests/data/test-abicompat/test1-fn-removed-report-0.txt:
	Likewise.
	* tests/data/test-abicompat/test3-fn-removed-report-0.txt:
	Likewise.
	* tests/data/test-abidiff-exit/PR30048-test-2-report-1.txt: Likewise.
	* tests/data/test-abidiff-exit/PR30048-test-report-0.txt: Likewise.
	* tests/data/test-abidiff-exit/PR30329/PR30329-report-1.txt: Likewise.
	* tests/data/test-abidiff-exit/PR30503/libsdl/libsdl-1.2.60-1.2.64-report.txt: Likewise.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-1.txt: Likewise.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt: Likewise.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-fun-param-report.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-ld-2.28-210.so--ld-2.28-211.so.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-leaf-fun-type-report.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-leaf-more-report.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-leaf-stats-report.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-net-change-report0.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test-net-change-report2.txt:
	Likewise.
	* tests/data/test-abidiff-exit/test2-filtered-removed-fns-report0.txt:
	Likewise.
	* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
	* tests/data/test-abidiff/test-crc-report-0-1.txt: Likewise.
	* tests/data/test-abidiff/test-crc-report-1-0.txt: Likewise.
	* tests/data/test-abidiff/test-crc-report-1-2.txt: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test24-added-fn-parms-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test5-report.txt: Likewise.
	* tests/data/test-diff-filter/test-PR26739-2-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Likewise.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test6-report.txt: Likewise.
	* tests/data/test-diff-filter/test7-report.txt: Likewise.
	* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Likewise.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/libxcrypt-4.1.1-6.el8.x86_64--libxcrypt-compat-4.4.18-3.el9.x86_64-report-1.txt:
	Likewise.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
	Likewise.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Likewise.
	* tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg-ctf/test-rpm-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt:
	Likewise.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-2.txt:
	Likewise.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-3.txt:
	Likewise.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test27-add-aliased-function-report-0.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/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-4.txt:
	Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-report-5.txt:
	Likewise.
	* tests/data/test-diff-suppr/test30-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test32-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test32-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-report-1.txt:
	Likewise.
	* tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-read-ctf/test9.o.abi: Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test7.so.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2023-12-01 15:43:53 +01:00

11 lines
373 B
Plaintext

================ changes of 'libdwarf.so.1.20180129.0'===============
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 Added function:
[A] 'function int dwarf_get_str_2(void)' {dwarf_get_str_2}
================ end of changes of 'libdwarf.so.1.20180129.0'===============