|| (is_var_diff(d)
&& (!(d->has_local_changes()
& LOCAL_NON_TYPE_CHANGE_KIND)))
+ // A function parameter with non-type local changes
+ // should not see redundancy propagation either. But
+ // a function parameter with local type changes can
+ // definitely be redundant.
+ || (is_fn_parm_diff(d)
+ && (!(d->has_local_changes()
+ & LOCAL_NON_TYPE_CHANGE_KIND)))
))
{
bool has_non_redundant_child = false;
return false;
}
+/// For a @ref qualified_type_diff node, report the changes of its
+/// underlying type.
+///
+/// @param d the @ref qualified_type_diff node to consider.
+///
+/// @param out the output stream to emit the report to.
+///
+/// @param indent the white string to use for indentation.
+///
+/// @return true iff a local change has been emitted. In this case,
+/// the local change is a name change.
+void
+default_reporter::report_underlying_changes_of_qualified_type
+(const qualified_type_diff& d, ostream& out, const string& indent) const
+{
+ if (!d.to_be_reported())
+ return;
+
+ diff_sptr dif = d.leaf_underlying_type_diff();
+ ABG_ASSERT(dif);
+ ABG_ASSERT(dif->to_be_reported());
+ RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2(dif,
+ "unqualified "
+ "underlying type");
+
+ string fltname = dif->first_subject()->get_pretty_representation();
+ out << indent << "in unqualified underlying type '" << fltname << "'";
+ report_loc_info(dif->second_subject(), *d.context(), out);
+ out << ":\n";
+ dif->report(out, indent + " ");
+}
+
/// Report a @ref qualified_type_diff in a serialized form.
///
/// @param d the @ref qualified_type_diff node to consider.
// It makes a little sense to detail the changes in extenso here.
return;
- diff_sptr dif = d.leaf_underlying_type_diff();
- ABG_ASSERT(dif);
- ABG_ASSERT(dif->to_be_reported());
- RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2(dif,
- "unqualified "
- "underlying type");
-
- string fltname = dif->first_subject()->get_pretty_representation();
- out << indent << "in unqualified underlying type '" << fltname << "'";
- report_loc_info(dif->second_subject(), *d.context(), out);
- out << ":\n";
- dif->report(out, indent + " ");
+ report_underlying_changes_of_qualified_type(d, out, indent);
}
/// Report the @ref pointer_diff in a serialized form.
{
const array_type_def* ty2 = is_array_type(second);
// TODO: Handle int[5][2] vs int[2][5] better.
- if (ty1->get_size_in_bits() != ty2->get_size_in_bits()
- || ty1->get_dimension_count() != ty2->get_dimension_count()
- || !types_have_similar_structure(ty1->get_element_type(),
- ty2->get_element_type(),
- /*indirect_type=*/true))
+ if (!indirect_type)
+ {
+ if (ty1->get_size_in_bits() != ty2->get_size_in_bits()
+ || ty1->get_dimension_count() != ty2->get_dimension_count())
+ return false;
+ }
+
+ if (!types_have_similar_structure(ty1->get_element_type(),
+ ty2->get_element_type(),
+ /*indirect_type=*/true))
return false;
return true;
return;
report_local_qualified_type_changes(d, out, indent);
+
+ // Note that changes that are local to the underlying type of a
+ // qualified type are considered to be local to the qualified type
+ // itself. So let's go ahead and report the local changes of the
+ // underlying type.
+ report_underlying_changes_of_qualified_type(d, out, indent);
}
/// Report the changes carried by a @ref pointer_diff node.
test-abidiff-exit/ada-subrange/test1-ada-subrange/v1/test1.adb \
test-abidiff-exit/ada-subrange/test1-ada-subrange/v1/test1.ads \
test-abidiff-exit/ada-subrange/test1-ada-subrange/v1/test1.o \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-1.txt \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-2.txt \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.adb \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.ads \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.o \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.adb \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.ads \
+test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.o \
\
test-diff-dwarf/test0-v0.cc \
test-diff-dwarf/test0-v0.o \
--- /dev/null
+Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+2 functions with some indirect sub-type change:
+
+ [C] 'function test__my_int[101] test__first_function(test__my_int[101]&)' at test.adb:6:1 has some indirect sub-type changes:
+ return type changed:
+ type name changed from 'test__my_int[101]' to 'test__my_int[201]'
+ array type size changed from 101000 to 201000
+ array type subrange 1 changed length from 101 to 201
+
+ [C] 'function test__my_index test__second_function(const test__my_index)' at test.adb:12:1 has some indirect sub-type changes:
+ return type changed:
+ upper bound of range 'test__my_index' change from '100' to '200'
+ underlying type of range '<range test__my_index>[101]' changed:
+ type size changed from 8 to 16 (in bits)
+
--- /dev/null
+Leaf changes summary: 4 artifacts changed
+Changed leaf types summary: 2 leaf types changed
+Removed/Changed/Added functions summary: 0 Removed, 2 Changed, 0 Added function
+Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
+
+2 functions with some sub-type change:
+
+ [C] 'function test__my_int[101] test__first_function(test__my_int[101]&)' at test.adb:6:1 has some sub-type changes:
+ return type changed:
+ type name changed from 'test__my_int[101]' to 'test__my_int[201]'
+ array type size changed from 101000 to 201000
+ array type subrange 1 changed length from 101 to 201
+
+ [C] 'function test__my_index test__second_function(const test__my_index)' at test.adb:12:1 has some sub-type changes:
+ return type changed:
+ upper bound of range 'test__my_index' change from '100' to '200'
+ parameter 1 of type 'const test__my_index' changed:
+ in unqualified underlying type '<range test__my_index>[101]':
+ upper bound of range 'test__my_index' change from '100' to '200'
+
+'test__Tmy_indexB' changed:
+ type size changed from 8 to 16 (in bits)
+'<range test__my_index>[101]' changed:
+ upper bound of range 'test__my_index' change from '100' to '200'
--- /dev/null
+-- Compile this file with:
+-- gcc -g -c test.adb
+
+package body Test is
+
+function First_Function (A: My_Int_Array) return My_Int_Array is
+begin
+ return A;
+end First_Function;
+
+
+function Second_Function (A: My_Index) return My_Index is
+begin
+ return My_Index'Last;
+end Second_Function;
+
+end Test;
--- /dev/null
+package Test is
+
+type My_Int is range 0 .. 1000;
+type My_Index is range 0 .. 100;
+type My_Int_Array is array (My_Index) of My_Int;
+
+function First_Function (A: My_Int_Array) return My_Int_Array;
+
+function Second_Function (A: My_Index) return My_Index;
+
+end Test;
\ No newline at end of file
--- /dev/null
+-- Compile this file with:
+-- gcc -g -c test.adb
+
+package body Test is
+
+function First_Function (A: My_Int_Array) return My_Int_Array is
+begin
+ return A;
+end First_Function;
+
+
+function Second_Function (A: My_Index) return My_Index is
+begin
+ return My_Index'Last;
+end Second_Function;
+
+end Test;
--- /dev/null
+package Test is
+
+type My_Int is range 0 .. 1000;
+type My_Index is range 0 .. 200;
+type My_Int_Array is array (My_Index) of My_Int;
+
+function First_Function (A: My_Int_Array) return My_Int_Array;
+
+function Second_Function (A: My_Index) return My_Index;
+
+end Test;
\ No newline at end of file
[C] 'function const int foo2(S2&)' at test45-basic-type-change-v1.cc:32:1 has some sub-type changes:
return type changed:
'const int' changed to 'const char'
+ in unqualified underlying type 'int':
+ type name changed from 'int' to 'char'
+ type size changed from 32 to 8 (in bits)
[C] 'function int foo3(S2&)' at test45-basic-type-change-v1.cc:36:1 has some sub-type changes:
return type changed:
"data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt",
"output/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt"
},
+ {
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.o",
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.o",
+ "",
+ "",
+ "",
+ "--no-default-suppression",
+ abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-1.txt",
+ "output/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-1.txt"
+ },
+ {
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v0/test.o",
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/v1/test.o",
+ "",
+ "",
+ "",
+ "--no-default-suppression --leaf-changes-only",
+ abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+ "data/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-2.txt",
+ "output/test-abidiff-exit/ada-subrange/test2-ada-subrange-redundant/test2-ada-subrange-redundant-report-2.txt"
+ },
#ifdef WITH_BTF
{
"data/test-abidiff-exit/btf/test0-v0.o",