diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 47d63a7a..604c76e3 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -14807,13 +14807,16 @@ build_ir_node_from_die(read_context& ctxt,
bool type_suppressed =
type_is_suppressed(ctxt, scope, die, type_is_private);
if (type_suppressed && type_is_private)
- // The type is suppressed because it's private. If other
- // non-suppressed and declaration-only instances of this
- // type exist in the current corpus, then it means those
- // non-suppressed instances are opaque versions of the
- // suppressed private type. Lets return one of these opaque
- // types then.
- result = get_opaque_version_of_type(ctxt, scope, die, where_offset);
+ {
+ // The type is suppressed because it's private. If other
+ // non-suppressed and declaration-only instances of this
+ // type exist in the current corpus, then it means those
+ // non-suppressed instances are opaque versions of the
+ // suppressed private type. Lets return one of these opaque
+ // types then.
+ result = get_opaque_version_of_type(ctxt, scope, die, where_offset);
+ maybe_canonicalize_type(is_type(result), ctxt);
+ }
else if (!type_suppressed)
{
enum_type_decl_sptr e = build_enum_type(ctxt, die, scope,
@@ -14837,13 +14840,16 @@ build_ir_node_from_die(read_context& ctxt,
type_is_suppressed(ctxt, scope, die, type_is_private);
if (type_suppressed && type_is_private)
- // The type is suppressed because it's private. If other
- // non-suppressed and declaration-only instances of this
- // type exist in the current corpus, then it means those
- // non-suppressed instances are opaque versions of the
- // suppressed private type. Lets return one of these opaque
- // types then.
- result = get_opaque_version_of_type(ctxt, scope, die, where_offset);
+ {
+ // The type is suppressed because it's private. If other
+ // non-suppressed and declaration-only instances of this
+ // type exist in the current corpus, then it means those
+ // non-suppressed instances are opaque versions of the
+ // suppressed private type. Lets return one of these opaque
+ // types then.
+ result = get_opaque_version_of_type(ctxt, scope, die, where_offset);
+ maybe_canonicalize_type(is_type(result), ctxt);
+ }
else if (!type_suppressed)
{
Dwarf_Die spec_die;
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 53faec67..576309e8 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -556,6 +556,12 @@ test-read-dwarf/test-suppressed-alias.c \
test-read-dwarf/test-suppressed-alias.o \
test-read-dwarf/test-suppressed-alias.o.abi \
test-read-dwarf/test-suppressed-alias.suppr \
+test-read-dwarf/PR27700/include-dir/priv.h \
+test-read-dwarf/PR27700/include-dir/pub.h \
+test-read-dwarf/PR27700/pub-incdir/inc.h \
+test-read-dwarf/PR27700/test-PR27700.abi \
+test-read-dwarf/PR27700/test-PR27700.c \
+test-read-dwarf/PR27700/test-PR27700.o \
\
test-annotate/test0.abi \
test-annotate/test1.abi \
diff --git a/tests/data/test-read-dwarf/PR27700/include-dir/priv.h b/tests/data/test-read-dwarf/PR27700/include-dir/priv.h
new file mode 100644
index 00000000..e76683d4
--- /dev/null
+++ b/tests/data/test-read-dwarf/PR27700/include-dir/priv.h
@@ -0,0 +1,7 @@
+enum foo
+{
+ foo_e0,
+ foo_e1,
+ foo_e2,
+ foo_e3
+};
diff --git a/tests/data/test-read-dwarf/PR27700/include-dir/pub.h b/tests/data/test-read-dwarf/PR27700/include-dir/pub.h
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h b/tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.abi b/tests/data/test-read-dwarf/PR27700/test-PR27700.abi
new file mode 100644
index 00000000..5c49e369
--- /dev/null
+++ b/tests/data/test-read-dwarf/PR27700/test-PR27700.abi
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.c b/tests/data/test-read-dwarf/PR27700/test-PR27700.c
new file mode 100644
index 00000000..b44a3226
--- /dev/null
+++ b/tests/data/test-read-dwarf/PR27700/test-PR27700.c
@@ -0,0 +1,6 @@
+#include "include-dir/priv.h"
+
+void
+foo(enum foo* c __attribute__((unused)))
+{
+}
diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.o b/tests/data/test-read-dwarf/PR27700/test-PR27700.o
new file mode 100644
index 0000000000000000000000000000000000000000..3f084d2132f0f43a683769ea91e9733fc599700a
GIT binary patch
literal 3248
zcmb_e&2Jl35TCbe$1dAAAFfJ6in1V}DZ*s*VTGc
zLJ^`85>f>cL2!d365@u0#6N(zapR7-AaUhZi37~+&T}@e8x;Yg_|433X5P%3_py2Z
zxfeDJAwZFUH8|1~3h-^=NN&Vp1I|Dh_O@>Qwsq^h+lO!b@Cm|s5Jj>YG~7=^nyi#!
zc7{VJzc3?a3)A-km^on<*DTB0F0WWmSx;J`43K*WENjg&OSlwAJUwR?
z6WfJ33TvFZF-Kk#c~FM!vT+WeFoj{;Xo1J507?yUA7Y6HRqPmG;br7`^u2^!2=QlW
zk{GQKe<&;@lc8>)JY}MgB9RwxYV2|L1H;6a{b1yG1L@g*5W(h4d-i&L*{;`}np3lv
zYD;zcvln;KVatu!P^n$CD}!i1kgHu8$k1=2>W1y!>cN%EmCKLYl`dfWoAOe^Y6+_+
zYzeBp;Xqcsq4%a=?fOx*@3-8R-*x?db!T^JdAU}rMsgI5s-7FUu~-SE>s7qB-LRuv
zfLto<@3jA?N&TSR-}hw2^Fuv>mhW2VUw3){o9pW<_9Axf;y-8`@5UMC;>IqBgK05;
zx==jCEj*7n{fOc-aJ4l3p|L(Wv4IW=oH^17$iW|fWf^gkvtTg!Wflnhco9fT_-f4SHZwZmw
zgL_a;uUgGaIIT|UvnUf0PQMLOkj^G-jI#>&u|PXEzNjca$~euTY9Q!p3a7kH);Bf0
z!}^OFK4AS74S$vO*EO6~z+)eiUZ?5_)tP4>V$^3M-T%P^9`|97^+z=P3)X8I{x$1Q
zX!!T6uW0y>tUt?Kug7MbdY|q;IHPw4k=sHZg$eH|DUt^fIP_A1(;AJy31#1PJlWds
zHvOP8L|ZJotyU;#?o>vR+kT5D
zmc3>tbO(|b@*mke##4{fzN+aOER639>*SlJ2T&nQe^H)KJEdej{sP+Qy#L$yI>zdA
zQaY9YGg4Bd`_lKBUcE-jCl>i|+Z-^1Ao;1gi68lxR&mtlB*QPU6(D4;nC`oS1|1{c
z9R}5XI4PdinN`2d8>-@|etNC-`aQ(5^50}oy&LEjlkQ9JQC9vP&VR^pl%L)&J^wYt
zXiilpiZT7ni6R9sSNRox7xAq4O}^Ye-6j5`6XMH!AggzY|D5ABH+V)r(Cnb files;
+ suppression_sptr suppr =
+ abigail::tools_utils::gen_suppr_spec_from_headers(path, files);
+
+ if (suppr)
+ {
+ suppr->set_drops_artifact_from_ir(true);
+ suppressions_type supprs;
+ supprs.push_back(suppr);
+ add_read_context_suppressions(read_ctxt, supprs);
+ }
+}
+
/// The task that peforms the tests.
struct test_task : public abigail::workers::task
{
@@ -477,7 +565,8 @@ struct test_task : public abigail::workers::task
virtual void
perform()
{
- string in_elf_path, in_abi_path, in_suppr_spec_path, out_abi_path;
+ string in_elf_path, in_abi_path, in_suppr_spec_path, in_public_headers_path,
+ out_abi_path;
abigail::ir::environment_sptr env;
in_elf_path = in_elf_base + spec.in_elf_path;
@@ -486,6 +575,11 @@ struct test_task : public abigail::workers::task
else
in_suppr_spec_path.clear();
+ if (spec.in_public_headers_path)
+ in_public_headers_path = spec.in_public_headers_path;
+ if (!in_public_headers_path.empty())
+ in_public_headers_path = in_elf_base + spec.in_public_headers_path;
+
env.reset(new abigail::ir::environment);
abigail::dwarf_reader::status status =
abigail::dwarf_reader::STATUS_UNKNOWN;
@@ -498,6 +592,9 @@ struct test_task : public abigail::workers::task
if (!in_suppr_spec_path.empty())
set_suppressions(*ctxt, in_suppr_spec_path);
+ if (!in_public_headers_path.empty())
+ set_suppressions_from_headers(*ctxt, in_public_headers_path);
+
abigail::corpus_sptr corp = read_corpus_from_elf(*ctxt, status);
// if there is no output and no input, assume that we do not care about the
// actual read result, just that it succeeded.
@@ -541,7 +638,11 @@ struct test_task : public abigail::workers::task
of.close();
string abidw = string(get_build_dir()) + "/tools/abidw";
- string cmd = abidw + " --abidiff " + in_elf_path;
+ string drop_private_types;
+ if (!in_public_headers_path.empty())
+ drop_private_types += "--headers-dir " + in_public_headers_path +
+ " --drop-private-types";
+ string cmd = abidw + " " + drop_private_types + " --abidiff " + in_elf_path;
if (system(cmd.c_str()))
{
error_message = string("ABIs differ:\n")