diff mbox series

Bug 27267 - Better support for opaque enum types

Message ID 87h7msf94s.fsf@redhat.com
State New
Headers show
Series Bug 27267 - Better support for opaque enum types | expand

Commit Message

Dodji Seketeli Feb. 4, 2021, 9:57 a.m. UTC
Hello,

Upon a request to build the IR for a opaque enum type,
get_opaque_version_of_type wrongly returns a nil type even though the
code is in there to construct an opaque variant of the enum.

This patch cleans up that code to let it build an opaque enum type.
It also ensures the opaque enum type is properly added to its lexical
scope to ensure proper life cycle management.

	* src/abg-dwarf-reader.cc (get_opaque_version_of_type): Do not
	quit early for enum types, because the code that comes a bit later
	can handle enums.  Add the newly built enum to its scope for
	proper life cycle management.
	* tests/data/test-diff-suppr/PR27267/include-dir-v{0,1}/include.h: New
	include files for the input test library.
	* tests/data/test-diff-suppr/PR27267/libtestpr27267-v{0,1}.so: New
	input test library.
	* tests/data/test-diff-suppr/PR27267/report-1.txt: New reference
	output for the comparison.
	* tests/data/test-diff-suppr/PR27267/v{0,1}.c: Source code for the
	new input test library.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
	above to the test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-dwarf-reader.cc                       |   7 +----
 tests/data/Makefile.am                        |   7 +++++
 .../PR27267/include-dir-v0/include.h          |   8 +++++
 .../PR27267/include-dir-v1/include.h          |   8 +++++
 .../PR27267/libtestpr27267-v0.so              | Bin 0 -> 17376 bytes
 .../PR27267/libtestpr27267-v1.so              | Bin 0 -> 17400 bytes
 .../data/test-diff-suppr/PR27267/report-1.txt |   0
 tests/data/test-diff-suppr/PR27267/v0.c       |  25 ++++++++++++++++
 tests/data/test-diff-suppr/PR27267/v1.c       |  28 ++++++++++++++++++
 tests/test-diff-suppr.cc                      |  10 +++++++
 10 files changed, 87 insertions(+), 6 deletions(-)
 create mode 100644 tests/data/test-diff-suppr/PR27267/include-dir-v0/include.h
 create mode 100644 tests/data/test-diff-suppr/PR27267/include-dir-v1/include.h
 create mode 100755 tests/data/test-diff-suppr/PR27267/libtestpr27267-v0.so
 create mode 100755 tests/data/test-diff-suppr/PR27267/libtestpr27267-v1.so
 create mode 100644 tests/data/test-diff-suppr/PR27267/report-1.txt
 create mode 100644 tests/data/test-diff-suppr/PR27267/v0.c
 create mode 100644 tests/data/test-diff-suppr/PR27267/v1.c
diff mbox series

Patch

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 13f1fe61..13c81821 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -15906,12 +15906,6 @@  get_opaque_version_of_type(read_context	&ctxt,
       && tag != DW_TAG_enumeration_type)
     return result;
 
-  if (tag == DW_TAG_union_type)
-    // TODO: also handle declaration-only unions.  To do that, we mostly
-    // need to adapt add_or_update_union_type to make it schedule
-    // declaration-only unions for resolution too.
-    return result;
-
   string type_name, linkage_name;
   location type_location;
   die_loc_and_name(ctxt, type_die, type_location, type_name, linkage_name);
@@ -15973,6 +15967,7 @@  get_opaque_version_of_type(read_context	&ctxt,
 							    underlying_type,
 							    enumeratorz,
 							    linkage_name));
+	  add_decl_to_scope(enum_type, scope);
 	  result = enum_type;
 	}
     }
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 68ad902b..a427659d 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -1482,6 +1482,13 @@  test-diff-suppr/libtest48-soname-abixml-suppr.txt \
 test-diff-suppr/libtest48-soname-abixml-suppr-2.txt \
 test-diff-suppr/libtest48-soname-abixml-suppr-3.txt \
 test-diff-suppr/libtest48-soname-abixml-suppr-4.txt \
+test-diff-suppr/PR27267/include-dir-v0/include.h \
+test-diff-suppr/PR27267/include-dir-v1/include.h \
+test-diff-suppr/PR27267/v0.c \
+test-diff-suppr/PR27267/v1.c \
+test-diff-suppr/PR27267/libtestpr27267-v0.so \
+test-diff-suppr/PR27267/libtestpr27267-v1.so \
+test-diff-suppr/PR27267/report-1.txt \
 \
 test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1 \
 test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi \
diff --git a/tests/data/test-diff-suppr/PR27267/include-dir-v0/include.h b/tests/data/test-diff-suppr/PR27267/include-dir-v0/include.h
new file mode 100644
index 00000000..0b915537
--- /dev/null
+++ b/tests/data/test-diff-suppr/PR27267/include-dir-v0/include.h
@@ -0,0 +1,8 @@ 
+enum opaque_enum;
+struct opaque_struct;
+
+typedef enum opaque_enum opaque_enum;
+typedef struct opaque_struct opaque_struct;
+
+void
+fn(opaque_struct *, opaque_enum *e);
diff --git a/tests/data/test-diff-suppr/PR27267/include-dir-v1/include.h b/tests/data/test-diff-suppr/PR27267/include-dir-v1/include.h
new file mode 100644
index 00000000..0b915537
--- /dev/null
+++ b/tests/data/test-diff-suppr/PR27267/include-dir-v1/include.h
@@ -0,0 +1,8 @@ 
+enum opaque_enum;
+struct opaque_struct;
+
+typedef enum opaque_enum opaque_enum;
+typedef struct opaque_struct opaque_struct;
+
+void
+fn(opaque_struct *, opaque_enum *e);
diff --git a/tests/data/test-diff-suppr/PR27267/libtestpr27267-v0.so b/tests/data/test-diff-suppr/PR27267/libtestpr27267-v0.so
new file mode 100755
index 0000000000000000000000000000000000000000..58df0022f6686c2f3ab34b284a30a91796eec4ec
GIT binary patch
literal 17376
zcmeHOUu+b|8K1qqv(G+rw)t0sDJ+qrLepFSA%FoH&NjA>3J7%}DpJvU?{4pIqx<9D
z?tzKg6qOW(AS&`uHEQxup+2N9sE<+e0s^IdOry3@RH?F(rb?u=byc-8t;F^FcII2(
zuGc{OfK+M6+WqGH^ZRDz+u51f^UQarj!#D<iBXc-VTN3~hfC5zv3N*ifTY<d>wvq$
zb~v`t71gTTf>07=!Y`H)Lu<kN=}u84qNGQ$<5EE|B*nSA^ku;kZN;^LF0OKe_+c;Y
zi*Q~MlyJx*P7ydo;E3K9^&}eSZk#$|Jx7H<KOGQuM9~)0s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~j%t3GTlnkcx9wd6{}X}#
z6%{0?AOFQQ@TCzB_~|3?&#Zy(+QWf!kHGI2cz-*~0{{LRcxneydUsn*)6a5lSp*z^
sM8PtsKhU^}zYkL1;Rt>o#ouTk<)|Reu6kDZvr!QKje{I8@d*5X02toN82|tP

literal 0
HcmV?d00001

diff --git a/tests/data/test-diff-suppr/PR27267/libtestpr27267-v1.so b/tests/data/test-diff-suppr/PR27267/libtestpr27267-v1.so
new file mode 100755
index 0000000000000000000000000000000000000000..fdf648a5c2494ffd99f87e88bf7e8b385e6ca794
GIT binary patch
literal 17400
zcmeHOU1%KF6~41S(n>3@B-?S<R$`A+h00BKB(39rWUnMkS{K`KRU2YT7|rg^t|sh{
zx-)A_fwrbjO<c#|Jd}o#hY|uwUqYZSp?Ro7Li*B&G*F6PirO^bKxkD;irf}&&$;)W
z(d=ktyL~Ve=7^bd&(C-6oilgl-dWxI{i&1FAw^+CVRn?El<5<ij5Mqskp*BGc93<!
zS!KJpZ)DB1uCyqP#F>nXbwtry%6>j7n?#)KsOBM61Ouu3?D7|-NZgC-09#BG4zZ)H
zJQ)(QDmmd$M4T#ds>Bh$DcearCc^MGVmlAYcz!-8{fMJ4(wWbk0xzpvbgzr9^HHfL
zPPlIZ4%_*lL}{Ou^=*`wRe62HrO2;uD^wPSW9IZZ*8J*1U*z^4?N>doy}9?xmq*_D
z_m17z7QB4C&xn)l`vDX=q5jsz^HOThu$^if6UJ+&e`*8$H0U3P!%ycxv6;o$9hs0J
za?tfsrB>B#$EZ8H&h!&!Pw54-Zk8<DG3#efO_pm_^Q@68o5I%KqURS4y=Ya9vh{+=
zid9y&a(T_JY5UpC$rBTkdRj|s`>0OH7G4*U0)Ni}r~A~{VRd0PbKDC3nEJ1jSEOT~
zPyde8Cw+R7myd}6cyFj~)ZF&y@g5Sbc=UMhiB>&&>XT?oW`sv4Ft1){gL9C9AOk@L
zf(!&12r>|4Ajm+Ffgl49GXsC`-TBY#<u78{YtdW7jAeg#(+M>{&R+g7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#lCy25L4T;gZ5GYq*P<DYQ@3&r7=8h2<{BjkYE(;WqE#(oRAI{H>gENK
z%2w5+GGwY<xBYK*_(sLaU`PTt+TTiX<>wTMOoP%t;M<4rbFx5uP<qmLk(e#Ja6T!+
zZ#}}({DAlk>5BEjqw0QN(sx=0bQqiPNm&u`D%iY)F}#!o0l)1CPxB4pI9?!8`^k?u
z?mNYAMUrV=LR>{KkiY#x%UD6$2>-6Eh&aBdk*I#kA6-9QAI6?QC!jeLJe>RxkKf3C
z{37TuC-gn;zJKL=*gxXR@PH6x1M}iliE}wQN=~nL;@|V(Gtxl(j~n1g{h|*~;~8-n
znOex-{vSy^<)5k2U2^}-!jFH|hgT(zctM6EM)@cCbtoj@aPRL?VR83ylcVH>C;m3*
zd*L8F%@g}H0U$pKcke&xe+dS~gQxjq@;-Qq_iHF%-=X?x-bwrHZ(?vD${W>7_y1$C
zdF!Y7>GCj#F;y`4OnBn>UG2rQjC36lT$Lg*!V&)i7_jWNKO;O<i6=jy6?IV=`KNGT
z{n8y(oCq(|NNVnj0%DN9fP;UGbBVe0=QGrPa+G$;qZC;P>^>K6T7XYkB!9d7zWp2E
ze<ty_L>Tw%$3M0Kekm;=Z@5TN@Z+D{0RPxt;a|KD{(!{$uk*6R<8KyTqWZnuefB+$
z&ps`LRhe-7T?Ol){y^_l{N0fHjzEa>8T{=AC{Gm$aoxSbpOf0*e{om<Chmj(4|hk>
A1poj5

literal 0
HcmV?d00001

diff --git a/tests/data/test-diff-suppr/PR27267/report-1.txt b/tests/data/test-diff-suppr/PR27267/report-1.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/data/test-diff-suppr/PR27267/v0.c b/tests/data/test-diff-suppr/PR27267/v0.c
new file mode 100644
index 00000000..74527dc0
--- /dev/null
+++ b/tests/data/test-diff-suppr/PR27267/v0.c
@@ -0,0 +1,25 @@ 
+/**
+ *
+ * Compile with:
+ *   gcc -shared -g -Wall -o libtestpr27267-v0.so v0.c
+ *
+ */
+
+#include "include-dir-v0/include.h"
+
+enum opaque_enum
+{
+  e0,
+  e1
+};
+
+struct opaque_struct
+{
+  opaque_enum m0;
+};
+
+void
+fn(opaque_struct * s, opaque_enum *e)
+{
+  s->m0 = *e;
+}
diff --git a/tests/data/test-diff-suppr/PR27267/v1.c b/tests/data/test-diff-suppr/PR27267/v1.c
new file mode 100644
index 00000000..c36d09ae
--- /dev/null
+++ b/tests/data/test-diff-suppr/PR27267/v1.c
@@ -0,0 +1,28 @@ 
+/**
+ *
+ * Compile with:
+ *   gcc -shared -g -Wall -o libtestpr27267-v1.so v1.c
+ *
+ */
+
+#include "include-dir-v1/include.h"
+
+enum opaque_enum
+{
+  e0,
+  e1,
+  e2
+};
+
+struct opaque_struct
+{
+  opaque_enum m0;
+  opaque_enum m1;
+};
+
+void
+fn(opaque_struct * s, opaque_enum *e)
+{
+  s->m0 = *e;
+  s->m1 = s->m0;
+}
diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc
index c7b73fd6..5b4d08d3 100644
--- a/tests/test-diff-suppr.cc
+++ b/tests/test-diff-suppr.cc
@@ -2026,6 +2026,16 @@  InOutSpec in_out_specs[] =
     "data/test-diff-suppr/libtest48-soname-abixml-report-1.txt",
     "output/test-diff-suppr/libtest48-soname-abixml-report-1_suppr4.txt"
   },
+  {
+    "data/test-diff-suppr/PR27267/libtestpr27267-v0.so",
+    "data/test-diff-suppr/PR27267/libtestpr27267-v1.so",
+    "data/test-diff-suppr/PR27267/include-dir-v0",
+    "data/test-diff-suppr/PR27267/include-dir-v1",
+    "",
+    "--drop-private-types --no-default-suppression",
+    "data/test-diff-suppr/PR27267/report-1.txt",
+    "output/test-diff-suppr/PR27267/report-1.txt"
+  },
   // This should be the last entry
   {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
 };