Hello Giuliano,
Giuliano Procida <gprocida@google.com> a écrit:
> This change adds a test which exercises libabigail's handling of
> qualified typedefs of arrays. The base type in the test case is an
> array of pointers (chosen so we can also use restrict).
>
> Various typedefs and (indirect) qualifications of this type are
> created. In all cases, the resulting type should be an array of
> qualified pointers.
>
> However, abidiff reports things like
>
> 'const volatile void* const'
>
> changed to
>
> 'restrict const volatile volatile void* const'
>
> I've not attempted to check whether DWARF and ABI XML faithfully
> reflect the source types. There may be trouble there as well.
Yeah, or there might be a bug somewhere. In any case, it'd be good to
look into this. I didn't have time until now, but I feel adding these
tests is improvement already. We can dig into this issue later. Maybe
we should file a bug for it?
[...]
> diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
> index 84447185..516a7f4d 100644
> --- a/tests/data/Makefile.am
> +++ b/tests/data/Makefile.am
> @@ -184,6 +184,14 @@ test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.c \
> test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.o \
> test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.c \
> test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.o \
> +test-abidiff-exit/qualifier-typedef-array-v0.c \
> +test-abidiff-exit/qualifier-typedef-array-v0.o \
> +test-abidiff-exit/qualifier-typedef-array-v1.c \
> +test-abidiff-exit/qualifier-typedef-array-v1.o \
> +test-abidiff-exit/qualifier-typedef-array-report0.txt \
> +test-abidiff-exit/qualifier-typedef-array-report1.txt \
> +test-abidiff-exit/qualifier-typedef-array-report2.txt \
> +test-abidiff-exit/qualifier-typedef-array-report3.txt \
There actual name of the reference report files that are added by the
patch is qualifier-typedef-array-report-{0-3}.txt. Note the '-'
character before the {0-3}. I fixed that when applying the patch.
[...]
> * tests/data/Makefile.am: Add new test files
> * tests/data/test-abidiff-exit/qualifier-typedef-array-v0.c:
> New test file.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-v0.o:
> New test file.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-v1.c:
> New test file.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-v1.o:
> New test file.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-report-0.txt:
> Plain diff report.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
> Harmless diff report.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-report-2.txt:
> Leaf changes report.
> * tests/data/test-abidiff-exit/qualifier-typedef-array-report-3.txt:
> Harmless leaf changes report.
> * tests/test-abidiff-exit.cc: Run new test.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>
Applied to master.
Thanks!
[...]
Cheers,
@@ -184,6 +184,14 @@ test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.c \
test-abidiff-exit/test-headers-dirs/test-headers-dir-v0.o \
test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.c \
test-abidiff-exit/test-headers-dirs/test-headers-dir-v1.o \
+test-abidiff-exit/qualifier-typedef-array-v0.c \
+test-abidiff-exit/qualifier-typedef-array-v0.o \
+test-abidiff-exit/qualifier-typedef-array-v1.c \
+test-abidiff-exit/qualifier-typedef-array-v1.o \
+test-abidiff-exit/qualifier-typedef-array-report0.txt \
+test-abidiff-exit/qualifier-typedef-array-report1.txt \
+test-abidiff-exit/qualifier-typedef-array-report2.txt \
+test-abidiff-exit/qualifier-typedef-array-report3.txt \
\
test-diff-dwarf/test0-v0.cc \
test-diff-dwarf/test0-v0.o \
new file mode 100644
@@ -0,0 +1,3 @@
+Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
new file mode 100644
@@ -0,0 +1,81 @@
+Functions changes summary: 0 Removed, 1 Changed, 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+1 function with some indirect sub-type change:
+
+ [C] 'function void fun(S*)' at qualifier-typedef-array-v1.c:37:1 has some indirect sub-type changes:
+ parameter 1 of type 'S*' has sub-type changes:
+ in pointed to type 'struct S' at qualifier-typedef-array-v1.c:10:1:
+ type size hasn't changed
+ 12 data member changes:
+ type of 'A S::c_a' changed:
+ entity changed from 'typedef A' to compatible type 'void* const[7]'
+ array element type 'void*' changed:
+ entity changed from 'void*' to 'void* const'
+ type size hasn't changed
+ type size hasn't changed
+ type of 'A S::v_a' changed:
+ entity changed from 'typedef A' to compatible type 'void* volatile[7]'
+ array element type 'void*' changed:
+ entity changed from 'void*' to 'void* volatile'
+ type size hasn't changed
+ type size hasn't changed
+ type of 'A S::r_a' changed:
+ entity changed from 'typedef A' to compatible type 'void*[7]'
+ type of 'B S::c_b' changed:
+ typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
+ underlying type 'typedef A' at qualifier-typedef-array-v0.c:1:1 changed:
+ entity changed from 'typedef A' to compatible type 'void* const[7]'
+ array element type 'void*' changed:
+ entity changed from 'void*' to 'void* const'
+ type size hasn't changed
+ type size hasn't changed
+ type of 'B S::v_b' changed:
+ typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
+ underlying type 'typedef A' at qualifier-typedef-array-v0.c:1:1 changed:
+ entity changed from 'typedef A' to compatible type 'void* volatile[7]'
+ array element type 'void*' changed:
+ entity changed from 'void*' to 'void* volatile'
+ type size hasn't changed
+ type size hasn't changed
+ type of 'B S::r_b' changed:
+ typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
+ underlying type 'typedef A' at qualifier-typedef-array-v0.c:1:1 changed:
+ entity changed from 'typedef A' to compatible type 'void*[7]'
+ type of 'C S::v_c' changed:
+ entity changed from 'typedef C' to compatible type 'const volatile void* const[7]'
+ array element type 'void* const' changed:
+ 'void* const' changed to 'const volatile void* const'
+ type name changed from 'void*[7]' to 'volatile void* const[7]'
+ type size hasn't changed
+ type of 'C S::r_c' changed:
+ entity changed from 'typedef C' to compatible type 'restrict void* const[7]'
+ array element type 'void* const' changed:
+ 'void* const' changed to 'restrict const void* const'
+ type name changed from 'void*[7]' to 'restrict void* const[7]'
+ type size hasn't changed
+ type of 'D S::v_d' changed:
+ entity changed from 'typedef D' to compatible type 'const volatile void* const[7]'
+ array element type 'void* const' changed:
+ 'void* const' changed to 'const volatile void* const'
+ type name changed from 'void*[7]' to 'volatile void* const[7]'
+ type size hasn't changed
+ type of 'D S::r_d' changed:
+ entity changed from 'typedef D' to compatible type 'restrict void* const[7]'
+ array element type 'void* const' changed:
+ 'void* const' changed to 'restrict const void* const'
+ type name changed from 'void*[7]' to 'restrict void* const[7]'
+ type size hasn't changed
+ type of 'E S::r_e' changed:
+ entity changed from 'typedef E' to compatible type 'restrict const volatile void* const[7]'
+ array element type 'const volatile void* const' changed:
+ 'const volatile void* const' changed to 'restrict const volatile volatile void* const'
+ type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+ type size hasn't changed
+ type of 'F S::r_f' changed:
+ entity changed from 'typedef F' to compatible type 'restrict const volatile void* const[7]'
+ array element type 'const volatile void* const' changed:
+ 'const volatile void* const' changed to 'restrict const volatile volatile void* const'
+ type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+ type size hasn't changed
+
new file mode 100644
@@ -0,0 +1,5 @@
+Leaf changes summary: 0 artifact changed
+Changed leaf types summary: 0 leaf type changed
+Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
+Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
+
new file mode 100644
@@ -0,0 +1,5 @@
+Leaf changes summary: 0 artifact changed
+Changed leaf types summary: 0 leaf type changed
+Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
+Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
+
new file mode 100644
@@ -0,0 +1,37 @@
+typedef void * A[7];
+typedef A B;
+typedef const B C;
+typedef C D;
+typedef volatile D E;
+typedef E F;
+typedef restrict F G;
+typedef G H;
+
+struct S {
+ A c_a;
+ A v_a;
+ A r_a;
+ B c_b;
+ B v_b;
+ B r_b;
+ C c_c;
+ C v_c;
+ C r_c;
+ D c_d;
+ D v_d;
+ D r_d;
+ E c_e;
+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dAI^_wbMwuX=N_)Qp6l03fR10P9bTT;pWFXvHdoE&
zDo$g?E7kl3Z=u!5wY>9nubgW-#W}Y@a|>QI+wvOqs^^xob+1W#oAZnRvbL$o$wS%Q
zC){G)@zg4E2lprqYaI%fk3GKfG>PT37)!*hE7<d9*!f`zI(96Te#4kd_M8HtZSFeq
z@rlvhzq&cmkZxvleYJHReiNQ<Vye$*)Mw)B*iB3dzL@J=CiSkfvBA9088In&A3hF!
z7cptwC!V%|HyG-}>S_GPBgR*_EqaH2fLdpduEh56t_Ii%(f0OnB^qv<SM4t-JgR1X
zQ{lI=C&UlG|0hCru6st|3o1C8N3WUJgS)*dX{AN^$M0j$Dm#}6uaokPm3dqk%uT;N
z*R<Ajmz$I?J57i3#YThjzB}jS%Wkn%ovnM71^5EpDHeTqsl)B~j#tGU42R6sJy(aI
z1m#N$^YbpQW!_t8x_MmvT%+lfUQ$7BZMNb&^R8O>|D47U&%M(9)aeRJSv^+@GdC>T
z0N572VNZrhAw3$u3qC#v|22LeVxu{^oUZ?I$4gz$<*z&cnJVB3%N5m-+ser2ih26X
z;wK`I!x+2O|3lUNO7Zj*<?`RIsExUwtA>p0Ks86Xyw7gypHZJG9nb4$Q*`}h*rGXM
zqF+^g{u>vTD3|{-b*q0-)z^LE`h2gW^%r5|oO+#513Ah`As2&jZP4}g{3=}C;%}+=
zt!tryrsMSdx{8m`=tmVFwd*)-e^13njv3ui@e`V;X1#xHej5r?3)-OOYhC)szYaQH
z_m$TZt<5P$)JJhfEttRG{Hqg<=XVmldoWQ=o&W6&LK59S=j|5%iCX{7P%Nv__`d;!
CO%PN7
literal 0
HcmV?d00001
new file mode 100644
@@ -0,0 +1,37 @@
+typedef void * A[7];
+typedef A B;
+typedef const B C;
+typedef C D;
+typedef volatile D E;
+typedef E F;
+typedef restrict F G;
+typedef G H;
+
+struct S {
+ const A c_a; // +const
+ volatile A v_a; // +volatile
+ restrict A r_a; // +restrict
+ const B c_b; // +const
+ volatile B v_b; // +volatile
+ restrict B r_b; // +restrict
+ const C c_c; // same
+ volatile C v_c; // +volatile
+ restrict C r_c; // +restrict
+ const D c_d; // same
+ volatile D v_d; // +volatile
+ restrict D r_d; // +restrict
+ const E c_e; // same
+ volatile E v_e; // same
+ restrict E r_e; // +restrict
+ const F c_f; // same
+ volatile F v_f; // same
+ restrict F r_f; // +restrict
+ const G c_g; // same
+ volatile G v_g; // same
+ restrict G r_g; // same
+ const H c_h; // same
+ volatile H v_h; // same
+ restrict H r_h; // same
+};
+
+void fun(struct S * s) { (void) s; }
new file mode 100644
GIT binary patch
literal 3408
zcmbtWU2GIp6h3!;+NHCdZvUXA2n#6!i8HjKP|#va`6-c@s=*hdb#{05C$`f%yIWd~
zkr1Qs28r=6K9Cp_!;6pdCW)Hpi{X*PXbg$bNAW>Pc+l_6-dm>ADGz#+Irn_$eCM2d
z&)m7YZ=E=EQWJvI5OkF8BV{GJoVl-0MCt_fQV*S-zVz$#r8n<he(CF<H6kN&Wugq(
z`w=b8iW#&?5+XMVi|#-eEX)GLvv}HGWI;N+4HoU0c1X%(bfy?3h)p#XtZ7pu^lna|
zFEcz&!mwD=-(`4$gxU86!}lSKt4f%h;43_;8gmRbL_#}BqRrwE{Rg()QbIdLqP@=)
zaQw!$J8Og)0QSSFvNF+NLnO3m5*dr*^kKHSYedKMG+~O4%*W`YRh;!mSQht#tR)6n
z`vvG@R>+{!o&;C~tw6%I4gq`)8bFu*B)~7(kU`Go#tevTakfaJ+qwWWBeF}3dhBn2
zE($P#dhKf{dxM!J5`ESc`0g?jsNen`XhZ`OXmiA@YGC>#wpgFRcU1!uXu!S(bc>ll
zgZ5TzFsFlACb8A}3BG9^OrRnAHqdz;OrUM{4lu7XvqIt_>o55JU?$LZ`yS9<15BVD
zHXqPe3^1!C^40;M4-GJZcG_b=H<<~v%N_^Hm}J%w&%0AEg&W*iZU!WFx4{(+bvnf-
zKf-I*;p=BjyHcgD%rRs_|HN*)*V64FyIb_M=eEGRne@yN>j~?yb-EXC^<m=4c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6X)Ko2Wc<Hh@E0`z
literal 0
HcmV?d00001
@@ -337,6 +337,50 @@ InOutSpec in_out_specs[] =
"data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt",
"output/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt"
},
+ {
+ "data/test-abidiff-exit/qualifier-typedef-array-v0.o",
+ "data/test-abidiff-exit/qualifier-typedef-array-v1.o",
+ "",
+ "",
+ "",
+ "",
+ abigail::tools_utils::ABIDIFF_OK,
+ "data/test-abidiff-exit/qualifier-typedef-array-report-0.txt",
+ "output/test-abidiff-exit/qualifier-typedef-array-report-0.txt"
+ },
+ {
+ "data/test-abidiff-exit/qualifier-typedef-array-v0.o",
+ "data/test-abidiff-exit/qualifier-typedef-array-v1.o",
+ "",
+ "",
+ "",
+ "--harmless",
+ abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+ "data/test-abidiff-exit/qualifier-typedef-array-report-1.txt",
+ "output/test-abidiff-exit/qualifier-typedef-array-report-1.txt"
+ },
+ {
+ "data/test-abidiff-exit/qualifier-typedef-array-v0.o",
+ "data/test-abidiff-exit/qualifier-typedef-array-v1.o",
+ "",
+ "",
+ "",
+ "--leaf-changes-only",
+ abigail::tools_utils::ABIDIFF_OK,
+ "data/test-abidiff-exit/qualifier-typedef-array-report-2.txt",
+ "output/test-abidiff-exit/qualifier-typedef-array-report-2.txt"
+ },
+ {
+ "data/test-abidiff-exit/qualifier-typedef-array-v0.o",
+ "data/test-abidiff-exit/qualifier-typedef-array-v1.o",
+ "",
+ "",
+ "",
+ "--harmless --leaf-changes-only",
+ abigail::tools_utils::ABIDIFF_OK,
+ "data/test-abidiff-exit/qualifier-typedef-array-report-3.txt",
+ "output/test-abidiff-exit/qualifier-typedef-array-report-3.txt"
+ },
{0, 0, 0 ,0, 0, 0, abigail::tools_utils::ABIDIFF_OK, 0, 0}
};