const diff*
peel_qualified_diff(const diff* dif);
+const diff*
+peel_fn_parm_diff(const diff* dif);
+
const diff*
peel_pointer_or_qualified_type_diff(const diff* dif);
const diff*
peel_typedef_or_qualified_type_diff(const diff* dif);
+
+const diff*
+peel_typedef_qualified_type_or_parameter_diff(const diff *dif);
}// end namespace comparison
}// end namespace abigail
return dif;
}
+/// If a diff node is about changes between two function parameters
+/// get the diff node about changes between the types of the parameters.
+///
+/// @param dif the dif node to consider.
+///
+/// @return the diff of the types of the parameters.
+const diff*
+peel_fn_parm_diff(const diff* dif)
+{
+ const fn_parm_diff *d = 0;
+ while ((d = is_fn_parm_diff(dif)))
+ dif = d->type_diff().get();
+ return dif;
+}
+
/// If a diff node is about changes between two pointer, reference or
/// qualified types, get the diff node about changes between the
/// underlying types.
return dif;
}
+/// If a diff node is about changes between two typedefs or qualified
+/// types, get the diff node about changes between the underlying
+/// types.
+///
+/// Note that this function walks the tree of underlying diff nodes
+/// returns the first diff node about types that are neither typedef,
+/// qualified type nor parameters.
+///
+/// @param dif the dif node to consider.
+///
+/// @return the diff node about changes between the underlying types.
+const diff*
+peel_typedef_qualified_type_or_parameter_diff(const diff *dif)
+{
+ while (true)
+ {
+ if (const typedef_diff *d = is_typedef_diff(dif))
+ dif = peel_typedef_diff(d);
+ else if (const qualified_type_diff *d = is_qualified_type_diff(dif))
+ dif = peel_qualified_diff(d);
+ else if (const fn_parm_diff *d = is_fn_parm_diff(dif))
+ dif = peel_fn_parm_diff(d);
+ else
+ break;
+ }
+ return dif;
+}
+
/// Test if a diff node represents a diff between two class or union
/// types.
///
bool
has_basic_type_change_only(const diff *d)
{
+ d = peel_typedef_qualified_type_or_parameter_diff(d);
+
if (is_diff_of_basic_type(d, true) && d->has_changes())
return true;
else if (const var_diff * v = dynamic_cast<const var_diff*>(d))
{
diff_sptr type_diff = d.type_diff();
ABG_ASSERT(type_diff->has_changes());
- diff_category saved_category = type_diff->get_category();
- // Parameter type changes are never redundants.
- type_diff->set_category(saved_category & ~REDUNDANT_CATEGORY);
+
out << indent;
if (f->get_is_artificial())
out << "implicit ";
out << "' changed:\n";
type_diff->report(out, indent + " ");
- type_diff->set_category(saved_category);
}
}
test-diff-filter/test-PR28013-fn-variadic.c.report.txt \
test-diff-filter/test-PR28013-fn-variadic.c.0.abi \
test-diff-filter/test-PR28013-fn-variadic.c.1.abi \
+test-diff-filter/test-PR29387-v1.c \
+test-diff-filter/test-PR29387-v0.c \
+test-diff-filter/test-PR29387-v1.o \
+test-diff-filter/test-PR29387-v0.o \
+test-diff-filter/test-PR29387-report.txt \
\
test-diff-suppr/test0-type-suppr-v0.cc \
test-diff-suppr/test0-type-suppr-v1.cc \
--- /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 void f0(Integer, char)' at PR29387-test-v1.c:4:1 has some indirect sub-type changes:
+ parameter 1 of type 'typedef Integer' changed:
+ underlying type 'int' changed:
+ type name changed from 'int' to 'long int'
+ type size changed from 32 to 64 (in bits)
+
+ [C] 'function void f1(Integer, unsigned char)' at PR29387-test-v1.c:10:1 has some indirect sub-type changes:
+ parameter 1 of type 'typedef Integer' changed:
+ underlying type 'int' changed:
+ type name changed from 'int' to 'long int'
+ type size changed from 32 to 64 (in bits)
+
--- /dev/null
+typedef int Integer;
+
+void
+f0(Integer i, char c)
+{
+ i + c;
+}
+
+void
+f1(Integer i, unsigned char c)
+{
+ i + c;
+}
--- /dev/null
+typedef long int Integer;
+
+void
+f0(Integer i, char c)
+{
+ i + c;
+}
+
+void
+f1(Integer i, unsigned char c)
+{
+ i + c;
+}
"data/test-diff-filter/test-PR28013-fn-variadic.c.report.txt",
"output/test-diff-filter/test-PR28013-fn-variadic.c.report.txt",
},
+ {
+ "data/test-diff-filter/test-PR29387-v0.o",
+ "data/test-diff-filter/test-PR29387-v1.o",
+ "--no-default-suppression",
+ "data/test-diff-filter/test-PR29387-report.txt",
+ "output/test-diff-filter/test-PR29387-report.txt",
+ },
// This should be the last entry
{NULL, NULL, NULL, NULL, NULL}
};