From patchwork Wed Apr 8 12:20:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39083 From: gprocida@google.com (Giuliano Procida) Date: Wed, 8 Apr 2020 13:20:43 +0100 Subject: [PATCH 1/2] Improve readability of represent helper function. Message-ID: <20200408122044.192132-1-gprocida@google.com> This change: - makes local variables const where possible - gives local variables more descriptive names - factors out some more expressions as local variables - simplifies the logic around anonymous data members There are no behavioural changes. * src/abg-reporter-priv.cc (represent): In the var_diff_sptr overload, rename pretty_representation to o_pretty_representation, introduce n_pretty_representation where needed and replace the duplicate tr1 and tr2 with these; rename all other variables foo1 and foo2 to o_foo and n_foo respectively, using _type instead of _t; introduce o_anon and n_anon and use them to make the local variable is_strict_anonymous_data_member_change const, make ABG_ASSERT in anonymous data member handling more obvious in the case where anonymity has changed and allow simplification of formatting in this case; move declarations of const local variables above those of the non-const, state-tracking, variables. Signed-off-by: Giuliano Procida Reviewed-by: Matthias Maennich --- src/abg-reporter-priv.cc | 117 +++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 67 deletions(-) diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc index 5fb5fbc5..a46c0e9d 100644 --- a/src/abg-reporter-priv.cc +++ b/src/abg-reporter-priv.cc @@ -409,14 +409,21 @@ represent(const var_diff_sptr &diff, if (!ctxt->get_reporter()->diff_to_be_reported(diff.get())) return; - var_decl_sptr o = diff->first_var(); - var_decl_sptr n = diff->second_var(); - string name1 = o->get_qualified_name(); - string name2 = n->get_qualified_name(); - uint64_t size1 = get_var_size_in_bits(o); - uint64_t size2 = get_var_size_in_bits(n); - uint64_t offset1 = get_data_member_offset(o); - uint64_t offset2 = get_data_member_offset(n); + const var_decl_sptr o = diff->first_var(); + const var_decl_sptr n = diff->second_var(); + const bool o_anon = !!is_anonymous_data_member(o); + const bool n_anon = !!is_anonymous_data_member(n); + const bool is_strict_anonymous_data_member_change = o_anon && n_anon; + const string o_name = o->get_qualified_name(); + const string n_name = n->get_qualified_name(); + const uint64_t o_size = get_var_size_in_bits(o); + const uint64_t n_size = get_var_size_in_bits(n); + const uint64_t o_offset = get_data_member_offset(o); + const uint64_t n_offset = get_data_member_offset(n); + const string o_pretty_representation = o->get_pretty_representation(); + + const bool show_size_offset_changes = ctxt->get_allowed_category() + & SIZE_OR_OFFSET_CHANGE_CATEGORY; // Has the main diff text been output? bool emitted = false; @@ -424,39 +431,31 @@ represent(const var_diff_sptr &diff, bool begin_with_and = false; // Have we reported a size change already? bool size_reported = false; - // Are we reporting a change to an anonymous member? - bool is_strict_anonymous_data_member_change = false; - string pretty_representation = o->get_pretty_representation(); - bool show_size_offset_changes = ctxt->get_allowed_category() - & SIZE_OR_OFFSET_CHANGE_CATEGORY; - - if (is_anonymous_data_member(o) && is_anonymous_data_member(n)) + if (is_strict_anonymous_data_member_change) { - is_strict_anonymous_data_member_change = true; - string tr1 = o->get_pretty_representation(); - string tr2 = n->get_pretty_representation(); - type_base_sptr t1 = o->get_type(), t2 = n->get_type(); - if (tr1 != tr2) + const string n_pretty_representation = n->get_pretty_representation(); + const type_base_sptr o_type = o->get_type(), n_type = n->get_type(); + if (o_pretty_representation != n_pretty_representation) { show_offset_or_size(indent + "anonymous data member at offset", - offset1, *ctxt, out); + o_offset, *ctxt, out); out << " changed from:\n" - << indent << " " << tr1 << "\n" + << indent << " " << o_pretty_representation << "\n" << indent << "to:\n" - << indent << " " << tr2 << "\n"; + << indent << " " << n_pretty_representation << "\n"; begin_with_and = true; emitted = true; } - else if (get_type_name(t1) != get_type_name(t2) - && is_decl(t1) && is_decl(t2) - && is_decl(t1)->get_is_anonymous() - && is_decl(t2)->get_is_anonymous()) + else if (get_type_name(o_type) != get_type_name(n_type) + && is_decl(o_type) && is_decl(n_type) + && is_decl(o_type)->get_is_anonymous() + && is_decl(n_type)->get_is_anonymous()) { out << indent << "while looking at anonymous data member '" - << tr1 << "':\n" + << o_pretty_representation << "':\n" << indent << "the internal name of that anonymous data member" "changed from:\n" << indent << " " << get_type_name(o->get_type()) << "\n" @@ -472,36 +471,20 @@ represent(const var_diff_sptr &diff, } else if (filtering::has_anonymous_data_member_change(diff)) { + ABG_ASSERT(o_anon != n_anon); // So we are looking at a non-anonymous data member change from // or to anonymous data member. - if (is_anonymous_data_member(o)) - { - string repr = "anonymous data member " - + o->get_pretty_representation() - + " at offset"; - - show_offset_or_size(indent + repr, offset1, *ctxt, out); - out << " became data member '" - << n->get_pretty_representation() - << "'\n"; - } - else - { - ABG_ASSERT(is_anonymous_data_member(n)); - string repr = "data member " - + o->get_pretty_representation() - + " at offset"; - - show_offset_or_size(indent + repr, offset1, *ctxt, out); - out << " became anonymous data member '" - << n->get_pretty_representation() - << "'\n"; - } + const string n_pretty_representation = n->get_pretty_representation(); + out << indent << (o_anon ? "anonymous " : "") + << "data member " << o_pretty_representation; + show_offset_or_size(" at offset", o_offset, *ctxt, out); + out << " became " << (n_anon ? "anonymous " : "") + << "data member '" << n_pretty_representation << "'\n"; begin_with_and = true; emitted = true; } - else if (diff_sptr d = diff->type_diff()) + else if (const diff_sptr d = diff->type_diff()) { if (ctxt->get_reporter()->diff_to_be_reported(d.get())) { @@ -511,7 +494,7 @@ represent(const var_diff_sptr &diff, << "' changed"; else out << indent - << "type of '" << pretty_representation << "' changed"; + << "type of '" << o_pretty_representation << "' changed"; if (d->currently_reporting()) out << ", as being reported\n"; @@ -529,7 +512,7 @@ represent(const var_diff_sptr &diff, } } - if (!filtering::has_anonymous_data_member_change(diff) && name1 != name2) + if (!filtering::has_anonymous_data_member_change(diff) && o_name != n_name) { if (filtering::has_harmless_name_change(o, n) && !(ctxt->get_allowed_category() @@ -546,7 +529,7 @@ represent(const var_diff_sptr &diff, out << indent; else out << ", "; - out << "name of '" << name1 << "' changed to '" << name2 << "'"; + out << "name of '" << o_name << "' changed to '" << n_name << "'"; report_loc_info(n, *ctxt, out); emitted = true; } @@ -561,7 +544,7 @@ represent(const var_diff_sptr &diff, begin_with_and = false; } else if (!emitted) - out << indent << "'" << pretty_representation << "' "; + out << indent << "'" << o_pretty_representation << "' "; else out << ", "; if (get_data_member_is_laid_out(o)) @@ -572,7 +555,7 @@ represent(const var_diff_sptr &diff, } if (show_size_offset_changes) { - if (offset1 != offset2) + if (o_offset != n_offset) { if (begin_with_and) { @@ -584,17 +567,17 @@ represent(const var_diff_sptr &diff, out << indent; if (is_strict_anonymous_data_member_change) out << "anonymous data member "; - out << "'" << pretty_representation << "' "; + out << "'" << o_pretty_representation << "' "; } else out << ", "; - show_numerical_change("offset", offset1, offset2, *ctxt, out); + show_numerical_change("offset", o_offset, n_offset, *ctxt, out); maybe_show_relative_offset_change(diff, *ctxt, out); emitted = true; } - if (!size_reported && size1 != size2) + if (!size_reported && o_size != n_size) { if (begin_with_and) { @@ -606,12 +589,12 @@ represent(const var_diff_sptr &diff, out << indent; if (is_strict_anonymous_data_member_change) out << "anonymous data member "; - out << "'" << pretty_representation << "' "; + out << "'" << o_pretty_representation << "' "; } else out << ", "; - show_numerical_change("size", size1, size2, *ctxt, out); + show_numerical_change("size", o_size, n_size, *ctxt, out); maybe_show_relative_size_change(diff, *ctxt, out); emitted = true; } @@ -624,7 +607,7 @@ represent(const var_diff_sptr &diff, begin_with_and = false; } else if (!emitted) - out << indent << "'" << pretty_representation << "' "; + out << indent << "'" << o_pretty_representation << "' "; else out << ", "; out << "elf binding changed from " << o->get_binding() @@ -639,7 +622,7 @@ represent(const var_diff_sptr &diff, begin_with_and = false; } else if (!emitted) - out << indent << "'" << pretty_representation << "' "; + out << indent << "'" << o_pretty_representation << "' "; else out << ", "; out << "visibility changed from " << o->get_visibility() @@ -656,7 +639,7 @@ represent(const var_diff_sptr &diff, begin_with_and = false; } else if (!emitted) - out << indent << "'" << pretty_representation << "' "; + out << indent << "'" << o_pretty_representation << "' "; else out << ", "; @@ -675,7 +658,7 @@ represent(const var_diff_sptr &diff, begin_with_and = false; } else if (!emitted) - out << indent << "'" << pretty_representation << "' "; + out << indent << "'" << o_pretty_representation << "' "; else out << ", "; @@ -691,7 +674,7 @@ represent(const var_diff_sptr &diff, ; else if (!emitted) // We appear to have fallen off the edge of the map. - out << indent << "'" << pretty_representation + out << indent << "'" << o_pretty_representation << "' has *some* difference - please report as a bug"; else // do nothing From patchwork Wed Apr 8 12:20:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39084 From: gprocida@google.com (Giuliano Procida) Date: Wed, 8 Apr 2020 13:20:44 +0100 Subject: [PATCH 2/2] abidiff: Document and refresh tests. In-Reply-To: <20200408122044.192132-1-gprocida@google.com> References: <20200408122044.192132-1-gprocida@google.com> Message-ID: <20200408122044.192132-2-gprocida@google.com> Following on from giving some test file more descriptive names, this patch actually documents in brief the purpose of these recently added tests. It also improves the coverage of the test-leaf-cxx-members test to include deletion and insertion report text as well. * tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.cc: Comment test. Reorder members of ops to get better coverage. * tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc: Comment test. * tests/data/test-abidiff-exit/test-leaf-more-v1.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc: Comment test. Update comment on ops2. * tests/data/test-abidiff-exit/test-leaf-redundant-v1.c: Comment test. * tests/data/test-abidiff-exit/test-leaf-stats-v1.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt: Update locations. Update report to reflect deletion, insertion and changed members (was previously changed only).: * tests/data/test-abidiff-exit/test-leaf-peeling-report.txt: Update locations. * tests/data/test-abidiff-exit/test-leaf-redundant-report.txt: Ditto.: * tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.cc: Added one line comment referring to -v1 source file. * tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-more-v0.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-redundant-v0.c: Ditto. * tests/data/test-abidiff-exit/test-leaf-stats-v0.cc: Ditto. * tests/data/test-abidiff-exit/test-leaf-cxx-members-v0.o: Recompiled. * tests/data/test-abidiff-exit/test-leaf-cxx-members-v1.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-fun-type-v0.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-fun-type-v1.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-more-v0.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-more-v1.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-peeling-v0.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-peeling-v1.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-redundant-v0.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-redundant-v1.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-stats-v0.o: Ditto. * tests/data/test-abidiff-exit/test-leaf-stats-v1.o: Ditto. Signed-off-by: Giuliano Procida Reviewed-by: Matthias Maennich --- .../test-leaf-cxx-members-report.txt | 17 +++++++------- .../test-leaf-cxx-members-v0.cc | 6 ++--- .../test-leaf-cxx-members-v0.o | Bin 7328 -> 7328 bytes .../test-leaf-cxx-members-v1.cc | 13 +++++++---- .../test-leaf-cxx-members-v1.o | Bin 7360 -> 7368 bytes .../test-leaf-fun-type-v0.cc | 1 + .../test-abidiff-exit/test-leaf-fun-type-v0.o | Bin 2840 -> 2864 bytes .../test-leaf-fun-type-v1.cc | 4 +++- .../test-abidiff-exit/test-leaf-fun-type-v1.o | Bin 2952 -> 2976 bytes .../test-abidiff-exit/test-leaf-more-v0.cc | 1 + .../test-abidiff-exit/test-leaf-more-v0.o | Bin 3792 -> 3800 bytes .../test-abidiff-exit/test-leaf-more-v1.cc | 8 ++++--- .../test-abidiff-exit/test-leaf-more-v1.o | Bin 3808 -> 3832 bytes .../test-leaf-peeling-report.txt | 12 +++++----- .../test-abidiff-exit/test-leaf-peeling-v0.cc | 1 + .../test-abidiff-exit/test-leaf-peeling-v0.o | Bin 4528 -> 4528 bytes .../test-abidiff-exit/test-leaf-peeling-v1.cc | 22 ++++++++++-------- .../test-abidiff-exit/test-leaf-peeling-v1.o | Bin 4600 -> 4600 bytes .../test-leaf-redundant-report.txt | 10 ++++---- .../test-leaf-redundant-v0.c | 1 + .../test-leaf-redundant-v0.o | Bin 3320 -> 3352 bytes .../test-leaf-redundant-v1.c | 10 ++++---- .../test-leaf-redundant-v1.o | Bin 3384 -> 3416 bytes .../test-abidiff-exit/test-leaf-stats-v0.cc | 1 + .../test-abidiff-exit/test-leaf-stats-v0.o | Bin 2784 -> 2800 bytes .../test-abidiff-exit/test-leaf-stats-v1.cc | 6 +++-- .../test-abidiff-exit/test-leaf-stats-v1.o | Bin 2824 -> 2840 bytes 27 files changed, 65 insertions(+), 48 deletions(-) diff --git a/tests/data/test-abidiff-exit/test-leaf-stats-v1.o b/tests/data/test-abidiff-exit/test-leaf-stats-v1.o index 4a433b9572abb46799391619f21538b54fb3204c..4f2288c96881d79a5fc449679338861170061d08 100644 GIT binary patch delta 477 zcmZ8eJxjw-6n!^&sYy^lgjN?xF;c&h_7#_k5TQbbf)!Cv7kSoLg&M`CMM1$y#L038 zi(Byz2wes3=3j8LKfz6K@ugK!5AUAKxg5^>x{TJN*W<8Oo7fnUBUwU-CJX97R+X^R zkU*(5Zt*oj6Ec|&HGK5<2?hv7xB{;nSS63|Sml5RW#lkqM-@G%z`7&}XJME7MQ?kv z%8!V zl3#)lH=CU`#uvP;J??k&EtZ-1vr{V5%t;l17`EgXjN*$Nk9-~bLmmTyBXkm7zxjB9 zBqJk;141RK#U;8qsflR@x@CrX$;m)*1_o9U22Lh03rL8ta(S~dMlvx0^(AK{=B1~m z#HW?!F~HbmiA4|@6fw*^aA&WSp#N%uI$R<4r0}#YaM<$%LW~N{1?#Lah`*&`o0@HVTpiALv5t z1B;K1h99Z}UDSo((lVPOh~ma9m2S*ZTlt;{Lxnx?VS+ejWG6qMQOj`Mn<1gd>mW~N@0%qSY+|pGvqyd!rBkt+`QKAo6 zj2Gz<*5eiSetUP$4zmAuns-`AC{=SKpszx1E$H8b_+dO(4E8vnUqkLVJ}Cwk;&S3o z$aw)$i~Jo9Wp##@(N?RT{#1*!><(*9qMI-i20g^MHiS-M#e0&5vpRF{>j{B2;3U7% z6c$rY=_8miPv7BqS_0esmM)^}X$cOSrdImOV(-tla+R>c8z4{D>+0Z{P`GJW5 delta 651 zcmZ9I&1(};6vgMhIGIVC&LpYL~`9cOR4pZ$sT%+wm6$VERL;<;|0bz7XyNi@rkZ9@%Xx!>;>|H zfZj3F9S$8}F|2sYk^J0M{d_8AX7ubtdcxGxQ)bpQr_v}&IsN8syHdVYD%R{Jp?GcX zM0IibLT08W*rgJu3l$uaa{jy3N?E^CSrP767x7ZM96XimyQ}qAI_n_|*}+{*`-c&h z!mTU*456dQs1GIRE8Y&}qY?fMuB`t>a6d7?*Ly^jVpQy~Br+mrA*o}(?aIjX}LwWtG|yAEe`{2!|-iuV8j diff --git a/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc b/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc index b75dd84c..db1f7917 100644 --- a/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc +++ b/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.cc @@ -1,3 +1,4 @@ +// See comments in -v1.c file. struct ops { void (*munge)(int x); }; diff --git a/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.o b/tests/data/test-abidiff-exit/test-leaf-fun-type-v0.o index 211a33884f30755929210fee5d328e5b7e6c24e1..f03d386fc1156eac6e48a6d7b46f9b0153f4197e 100644 GIT binary patch delta 312 zcmZ9FF-yZx9K_%M<)!95a1cs^LbbYR#WYEmHVBQlw40l=Qc^ltX*8BPI@`f;OD91G zXG<0{xjMMH`w^u50%Ek{;Bdzc_q!Vx9t$^H)Q`)Di`-~2#`uDkq zSeU5mEovlJy3J{b$-*;r5gJW8Kx)+Bs62$+ksmZ?ZsExqjSxzo5==6G!c6*@Dg$*@ Urzt|^%RMn~yGT`yUNBReUwJ`L&Hw-a delta 357 zcmdlWHbZQJ24loT%`jd@4i5$f24)~;U}T!uqs7F^HZehD;+f0r&R}u%$;%k!7>y>M zWt319V`Xe+VrF1uboUEYaMso~G*PhBGtx6uFfuT-G&C?an9Rmxr&E$zT%wzknwVy! zTV|k_oXij(WoT5Cnx0u)l3Em>Ur-$6Z44wC^h6*0@9p7TsQe5i@W3msAw9RZ1ZG8R&mDk$)2qKjAoMqS;aSR zV3lBEOqhIQ$sd`- yCO_cRU|cbolgoZG2dBv77%m;g2a`Lw>^TisAX+phU*t09+`tOqEuMUlO&$QU?N00f diff --git a/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc b/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc index f308a343..ccf79dbb 100644 --- a/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc +++ b/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.cc @@ -1,5 +1,7 @@ +// The change to ops::munge is local to ops and should result in ops being +// reported as a changed type in --leaf-changes-only mode. struct ops { - char (*munge)(long x, bool gunk); + char (*munge)(long x, bool gunk); // everything but the name changed }; void register_ops(const ops&) { diff --git a/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.o b/tests/data/test-abidiff-exit/test-leaf-fun-type-v1.o index 9db3ed5e8f997d9c8455f8361449ce516edc840a..2a23514d593c02f79d432e6ee7c3d5a8aa0b1616 100644 GIT binary patch delta 448 zcmZ8c%Sr-a6#ma#axO$hhBHAjf>>gsjudEwA_ltBRc%`6DB}f8Z5)F(LDZr}i{!k3 z?OG;oS_Hm9yP#DmJwb2K)JO{te0*@e%i-L5hu-^bm<~e6%QTlKgwQq!FoU}c4TrT|B^ilFG$kI>lA0Dv;wF^}l3X^suWTP0 zm8RZy462q4Em+5|lnJnb8OFb|a0@Rf39pzaoZyJ@%6q@x*|Y8t5p3pd$T(w4_{4CS zXWg=Uu9^!j5zkn!T$pcf7E~WTuti9Xzu71SL-cbKc*hx+gCefdYk0s1a42}t;&*r# wH$_pQWXPohA_(Z>uhAHYo8p|Swk3s?@oC#^Z!8i%c=@J8wKwaGW0doRov;Y7A delta 418 zcmZ1=-XT6ggYm>f%`jd@4i5$f24)~;U}T!u}Q)Qxn@ z4E2(eL8=&7&{t#LU3Rm|L2co;o>^NsQUR*kE!MlbvW%etr%^NosM4 zZcb`q8q|czVoYil$r*`73`MEwnZ+fkMe+Fs#S9GY&dyc}8ZN0xnTdG{mU>2dhPsAk znh=(Pk%6J5A<)>(_n3+p8HFYXvM4edO|E9~m1KjuLl8=H0clPkPMrLZMVzsE@=um{ z$>~tJY&11RlM7kJC1aqXwP><)CNE?aXKa|flhvQmY%(LO_+|w*2`0vl$(9`Z84pbU z$>GlEKG~7eoaqDWgs)K(uI1cH}naRDk+r@nlDKc>vtxSepO< diff --git a/tests/data/test-abidiff-exit/test-leaf-more-v0.cc b/tests/data/test-abidiff-exit/test-leaf-more-v0.cc index bb6505c8..d67978b1 100644 --- a/tests/data/test-abidiff-exit/test-leaf-more-v0.cc +++ b/tests/data/test-abidiff-exit/test-leaf-more-v0.cc @@ -1,3 +1,4 @@ +// See comments in -v1.c file. struct changed { int foo = 0; }; diff --git a/tests/data/test-abidiff-exit/test-leaf-more-v0.o b/tests/data/test-abidiff-exit/test-leaf-more-v0.o index a8734481238bda41217440b305307ea7c5464782..b3a3084e0e6061e2ac4f7b3ffae6cf81cb519f55 100644 GIT binary patch delta 621 zcmZ8fzi-n(6u#$+?X#OyH7IdXXyYJMY@)<*1VrvYDg`MKMHGfgAS6miT^gz62aOPH z6)Y@BSWo=}s!ox*luk^jTL&bvATg2=w(o3dLP;JU3iD#&W%rebJt1AD3W(~m2#>|fc0{h*BD@zU0T_7OgTj{A+z9=J z*QH{sMQ~rp<1;CVPbD2M(wy4bY<6CF>!jVmEKTAby_v4xUo~p^ymP~Fi{+wYluM55 zI3*YF(c258UaKt{<{j^OyV;o-3XW@?vmX7Up8-;MDC(K3ymgH?9}5n}$636BW1e-n za)CgY31BK>cTtmcSVv3BMF(D%-r|X5!Wd6^?>)vc$;hkn7+l#XnrHBs>9{1DvmYbn zK@`uNKM1~)i?D=;vJI;^=D3R*)8POuW@p|+_V4G)lGtZ9Y~dbv+W3X7z+$k~k)bpM z7-4(rEBrz$UWYa8$1D6{ VLz)zP!2Wba>4l$xkbUf{+5Z9OcTxZV delta 586 zcmZ8eO>0v@6rDToW8Sk#+Sk&?7ioNTlf=*@6Ez`Fj3BgKSqc_)r6EllL0U_L80eyf zE~K0KJU>9tKVVuA+$iqcsT=9iozz|3by0D~zHD+A_ndp~xpRk^qsecRFS9ff<~B>@ z%rnM}mGyN-TxiaiX+{-3Fo!ah&oBhP!C)@En=NvpBa_r5a5MYG*l zTWu}ljMpyC-B}85=kxMdgn+N2N zs)e4qQ$Ngz1o&YbA g7x64H^x}02aH8^a$VA<}WuLFvMK@8UHhPK7Ke8ofP5=M^ diff --git a/tests/data/test-abidiff-exit/test-leaf-more-v1.cc b/tests/data/test-abidiff-exit/test-leaf-more-v1.cc index 5df5df9d..7f5b65d3 100644 --- a/tests/data/test-abidiff-exit/test-leaf-more-v1.cc +++ b/tests/data/test-abidiff-exit/test-leaf-more-v1.cc @@ -1,12 +1,14 @@ +// Ensure that local changes to functions and variables (including their removal +// or addition) are reported in --leaf-changes-only mode. struct changed { - long foo = 0; + long foo = 0; // was int }; -long directly_changed_var = 0; +long directly_changed_var = 0; // was int changed * indirectly_changed_var; long added_var = 0; -long directly_changed_fun() { +long directly_changed_fun() { // was int return 0; } void indirectly_changed_fun(changed * x) { diff --git a/tests/data/test-abidiff-exit/test-leaf-more-v1.o b/tests/data/test-abidiff-exit/test-leaf-more-v1.o index 324180ca92b91045edb4c9d3b9fef1fd314a09ba..4ac71798c2735b828957689acf622d267f60f67b 100644 GIT binary patch delta 685 zcmZ8fOK1~O6utLNX68+PG=+8&rEQ`Mlg3FhK}aW{0V8dos0~!G?IMiH#1?8IX%Z;9 z3Ej9%xGUFPxohpJ8>LJ4E_CN->q5HHjrb-REA%byIrp4%;oZmkGWTn4n8c+~YHwZQ z6#$T$?KYrq%mI8{78;BTs)`%XBv*0IMCE}Og8x?)Zd`cU=;sVhk%9>fQxX><;Tvw4 zjkZA*2pFKpc&=^ zyE)DqeKS+910AyK*BUz=r{3M&uhqBh)>EfZ>)RcuZCZAtA)02d)u*a5PZ23bKiE|w zsSsUx@F-qRr_Eb&E0fQd@qEs-OfzTEUFptESSgo_@#H<{$&THc1Ps$kU5dKf0G#}h z-XccnSk_~+qK}BR_}GC9H0Y~v3qqX+^gMuo$Ep-jbnH<|NqA4Os`MBDy;Bxr-@Q=8 zL%%@H<%FuvJ_21)mvKb4s>iZkWX;2W(IpzGS=^#CHOoE&ovRr-;+&Fviroh)@=WZt zH*t1p@`wgJi!bSz>o`Ln_(LpGLe)=lT7}^!+7G;Epiwcnj5Qhr3z(zRU`cx;?(QCo zFjT;AWQ9sh^HIV-OT$o7{EgF42`ltl)K_GMOWK+;891OpxS$Qk>j50nz`yVp@3?(T delta 640 zcmZ9J&1(}u7{=$F-R#aLo5i$EH@gx|NFWI%n@+6Ocrbo|U&W6U3wkP2T6!py+A4wv z@#ImL=j2I2FG5fD?#F*%ZuKBkPads^c+=TrRLH>0^YFaCdEbHgRop8+sZ%L#Y+fgE zfiY&RtgkcT1J9T#QYvGEgHl!kI7X5rYnWP@`^x`MEz$f}v*T}h@?cS!T-51s&aEXd zk5`$kl#zoQ^xa-i)?hXC_@PiX@5*RtDXFqlkvV+e)Dhw_5AlXq4s0!NZZ+4IZ>?w+ zdwdcnjDzrvO5yyKh0@unDLGT>MD0kH+S9Tl<#Zb_jgvTIT*6Q8;fs;a%{E4e9nXAC zG=cXiKNwR3bLve(Pyee8?5pY#m5wpeHO4a9T}IjRX#*XrOcIOM9qd|ldIYllaz!(F zt!br>+6CPvfOLFZv+Kb{P0WpuA!6I78N9Mv)Wb)+#fyZrh{9D3J{!4EBg~74KH;J8 z=?9*QR&ZM*`y(jBXK|H|?MP>l(>uhOxBRQXynBvrA~wgd?N+IPzT0(P=npxHAUjLD v=w-Y7w}I2?Njx`AY-g*)(9d@9!4)WY$LSt=Ue`Hg4JSSrw)3hg?|ZdBB6Vuj diff --git a/tests/data/test-abidiff-exit/test-leaf-peeling-report.txt b/tests/data/test-abidiff-exit/test-leaf-peeling-report.txt index 7ab4dd6e..48f5df8e 100644 --- a/tests/data/test-abidiff-exit/test-leaf-peeling-report.txt +++ b/tests/data/test-abidiff-exit/test-leaf-peeling-report.txt @@ -3,38 +3,38 @@ Changed leaf types summary: 6 leaf types 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 -'struct foo at test-leaf-peeling-v0.cc:1:1' changed: +'struct foo at test-leaf-peeling-v0.cc:2:1' changed: type size changed from 32 to 64 (in bits) there are data member changes: type 'int' of 'foo::z' changed: type name changed from 'int' to 'long int' type size changed from 32 to 64 (in bits) -'struct ops1 at test-leaf-peeling-v0.cc:5:1' changed: +'struct ops1 at test-leaf-peeling-v0.cc:6:1' changed: type size hasn't changed there are data member changes: type 'int*' of 'ops1::x' changed: pointer type changed from: 'int*' to: 'int**' -'struct ops2 at test-leaf-peeling-v0.cc:9:1' changed: +'struct ops2 at test-leaf-peeling-v0.cc:10:1' changed: type size changed from 320 to 640 (in bits) there are data member changes: 'foo ops2::y[10]' size changed from 320 to 640 (in bits) (by +320 bits) -'struct ops3 at test-leaf-peeling-v0.cc:13:1' changed: +'struct ops3 at test-leaf-peeling-v0.cc:14:1' changed: type size hasn't changed there are data member changes: type 'void (int&)*' of 'ops3::spong' changed: pointer type changed from: 'void (int&)*' to: 'void (int&&)*' -'struct ops4 at test-leaf-peeling-v0.cc:17:1' changed: +'struct ops4 at test-leaf-peeling-v0.cc:18:1' changed: type size hasn't changed there are data member changes: type 'int*' of 'ops4::x' changed: entity changed from 'int*' to 'int&' type size hasn't changed -'struct ops5 at test-leaf-peeling-v0.cc:21:1' changed: +'struct ops5 at test-leaf-peeling-v0.cc:22:1' changed: type size hasn't changed there are data member changes: type 'int*' of 'ops5::x' changed: diff --git a/tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc b/tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc index 745d44f5..2a25b877 100644 --- a/tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc +++ b/tests/data/test-abidiff-exit/test-leaf-peeling-v0.cc @@ -1,3 +1,4 @@ +// See comments in -v1.c file. struct foo { int z; }; diff --git a/tests/data/test-abidiff-exit/test-leaf-peeling-v0.o b/tests/data/test-abidiff-exit/test-leaf-peeling-v0.o index e6ed6218704e957cbac929f82d0a571fd181103f..cf5fc57b45f185b13b0d61ec9150f25e5c952b69 100644 GIT binary patch delta 559 zcmZ8dy-Pw-6u;-ar``7+7H0N*wrHkU)YB&oy#^tyglOpxh)A+M}aE|qtLc-saKZUOcRw6R$o$1*jstOOJ`*!ZTL;eld+gXc;%LGroWWF$FVER>elBaW4^>@nLJ z?sSn%+IDO^?X)gEQ?l)6+wt;up#4cz^c;dN{u=#i-rNyv*`@B|mTH&@!Ctu3L%d?@ zgkWD>>M_1D^+d3S*oz;X?^8k0Qm}%yW=J0d=QPXA3Tx42tz&~(Wqi~On8$Z575)*< WXP5Jd;Gk}?>o4dA+_Xx1-un+qU{qHC delta 566 zcmZ8d&r1SP5Pq}k%I?YrMz*dIteIh2>JuR>3}P#xAn4E`qM~4nJ!GX(*}ZEdL&u2z z1HqtU1VPlHh%VJX(6tVog6KWlF8g5kX1*UV^BS>6?D!%8@+2WdJRl&{uR=*lUgP6F z0l&gKLi{a*#M=ZY@*zX9MnJ9q#5GO6WTVP8Xu~YTdxP>jH?VxWn{Op$2+0KggifqM zOfw`tD%%2q zDqNbGGp$sL=FLJnm!@VeOAC}{b2uW6;*swpU$NJn>W*DmX3;z$CCeH%6XW)(vr_(x z4AP-~Pq=v|jfu3}+K-T+i~LrFRqHB-ArJq7L8WB4B-!w&H@L0nM#^PRJ?b5vGqvcl zj~?{_pP2gWvO4=b{{HuI5Y!ATAXRlC4mhQzjd|B%d#o>5XVz)FR&}uORn0_-uH)9@ U)Bt+|Y3Rn;fDT_xCs6YL0xSAeyZ`_I diff --git a/tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc b/tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc index 439f7c0b..ea0f835a 100644 --- a/tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc +++ b/tests/data/test-abidiff-exit/test-leaf-peeling-v1.cc @@ -1,33 +1,35 @@ +// Ensure that different pointer / reference types are considered genuinely +// different in --leaf-changes-only mode. struct foo { - long z; + long z; // was int }; struct ops1 { - int ** x; + int ** x; // was * }; struct ops2 { - // A change to foo's size is currently considered local here. Arguably this - // should be considered non-local as the change to foo is being reported - // independently. If this happens, the test case will need to be updated (to - // remove the reporting of an ops5 diff). + // A change to foo's size (impacting y's size) is currently considered local + // here. Arguably this should be considered non-local as the change to foo is + // also being reported independently. If this happens, the test case will + // need to be updated (to remove the reporting of the ops2 diff). foo y[10]; }; struct ops3 { - void (*spong)(int && wibble); + void (*spong)(int && wibble); // was & }; struct ops4 { - int & x; + int & x; // was * }; struct ops5 { - int *** x; + int *** x; // was * }; // TODO: This *should* be considered a local change, but currently is not. -int var6[5][2]; +int var6[5][2]; // was [2][5] void register_ops1(ops1*) { } void register_ops2(ops2*) { } diff --git a/tests/data/test-abidiff-exit/test-leaf-peeling-v1.o b/tests/data/test-abidiff-exit/test-leaf-peeling-v1.o index 81fcfe0a5a5abecf2d104e71859a04ab529d0b04..c59573e19ddfd8d7b170151a743445ca15be1574 100644 GIT binary patch delta 587 zcmZ9JF-QVY7{}jtp7ri7Ls2;&HJq7(3F?UiHxxwV5rkW7Em^o!XoLkdI5(&tG_*uS z&=5ozG}h46)>czNQ(HrW5Jd0kYq;c-k32V5hyUGi}j-F*Hx#dt^LHs9i^d`RQIrb~k8cv z;~s&Y#%n@XX;X~*1R|(IIvk~seAf6!pbw`ZJszjuVh2AkpbAAugx2_~2uXp_7woXB7i%Tv2B5TyBMHmCb5>r&3$v8w+@NrZYybWy&Z%Yg?z>9?O7KiI*p2UA1ZWJOIlc4U+W<`?Xa;-m z-Jbw`LQ6AX6&JO#WCAv|EL-*?9{OFpi-_LA7cIw1zIz#<6PVC*Y|3}v0(2g$oVu^a RZ;DD@ioct`+E;qH=ND_rP|*MY diff --git a/tests/data/test-abidiff-exit/test-leaf-redundant-report.txt b/tests/data/test-abidiff-exit/test-leaf-redundant-report.txt index 34b7a848..581fd28e 100644 --- a/tests/data/test-abidiff-exit/test-leaf-redundant-report.txt +++ b/tests/data/test-abidiff-exit/test-leaf-redundant-report.txt @@ -5,23 +5,23 @@ Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 4 functions with some sub-type change: - [C] 'function void fn1(sto1)' at test-leaf3-v1.c:10:1 has some sub-type changes: + [C] 'function void fn1(sto1)' at test-leaf-redundant-v1.c:12:1 has some sub-type changes: parameter 1 of type 'struct sto1' changed: type name changed from 'sto1' to 'stn1' type size hasn't changed - [C] 'function void fn2(sto2)' at test-leaf3-v1.c:13:1 has some sub-type changes: + [C] 'function void fn2(sto2)' at test-leaf-redundant-v1.c:15:1 has some sub-type changes: parameter 1 of type 'struct sto2' changed: type name changed from 'sto2' to 'stn2' type size changed from 64 to 128 (in bits) 1 data member insertion: - 'double stn2::y', at offset 64 (in bits) at test-leaf3-v1.c:7:1 + 'double stn2::y', at offset 64 (in bits) at test-leaf-redundant-v1.c:9:1 - [C] 'function void fn3(sto1*)' at test-leaf3-v1.c:16:1 has some sub-type changes: + [C] 'function void fn3(sto1*)' at test-leaf-redundant-v1.c:18:1 has some sub-type changes: parameter 1 of type 'sto1*' changed: pointer type changed from: 'sto1*' to: 'stn1*' - [C] 'function void fn4(sto2*)' at test-leaf3-v1.c:19:1 has some sub-type changes: + [C] 'function void fn4(sto2*)' at test-leaf-redundant-v1.c:21:1 has some sub-type changes: parameter 1 of type 'sto2*' changed: pointer type changed from: 'sto2*' to: 'stn2*' diff --git a/tests/data/test-abidiff-exit/test-leaf-redundant-v0.c b/tests/data/test-abidiff-exit/test-leaf-redundant-v0.c index 1d9c6266..c5dc8216 100644 --- a/tests/data/test-abidiff-exit/test-leaf-redundant-v0.c +++ b/tests/data/test-abidiff-exit/test-leaf-redundant-v0.c @@ -1,3 +1,4 @@ +// See comments in -v1.c file. struct sto1 { int x; }; diff --git a/tests/data/test-abidiff-exit/test-leaf-redundant-v0.o b/tests/data/test-abidiff-exit/test-leaf-redundant-v0.o index 1e74a51b929f63ba77041febe2b2aa064e41cc78..ef7df991deb2c7337b13d008a2977c0e5fdd37de 100644 GIT binary patch delta 594 zcmZ`$K~L0B5T0qb?Q3_JP&aH-G_VqbV6scQkgR*z)fh1zAV@;+1QOT+$x=`%di7wu zx|xG+xbPE9xSHtQi+l0zKY(yCF(k|^4F?jM&dm4qd*AfEdH?*c!=EScWoPo>k)~z= zKz|RYTY>;G8Dl$6KohLcR1sIvtv&)Ulp&HC#WR2fa=^8{&~El_Iia?Ld0 zAg{UY4SK(>wDP4^15(Ays;K1<%6KI&N}bc2fKe5A-aupsNE|*n_ntD32UW#rCJF~)gY{g zVNjexRtWznKDi|f>NYWR?PPSgIG4(KEK*&05j7uhDZsl$1XdYl)?%{4WZ Wp~YOoKI-2;zys>$YWR(Mx%(I1wQ!*T delta 575 zcmZ8eF;Cl25WaI_$9CKz1I0Kk!l)5VhJ-vP2o@#UE$VfT-1iHQ)Ys!E_ ztafZMi2@>gIee?e!;8iTV@h4&4_sO@Bt&DOyuq~ z+nvHjb1f(rx~1X=KIS%EFrpb`lA%*2Te&aWXoVj=IqOVka|@PUzw_#1&RZz@MdA4+ zu^>drr{79-8kXwy=U(n*^Zoi-7z+wwE`LwjYb7obZF-?P?jwG5m^(A&>%7vj1DCc{ z2PbG>of;c7D<=&?pRLSRIZBPvwfe-(4Jzz`mp2(~CfS;UPbshMVunt%W1JQ&G(T@h0iZ8OVctCyY*&W5DYb*c& diff --git a/tests/data/test-abidiff-exit/test-leaf-redundant-v1.c b/tests/data/test-abidiff-exit/test-leaf-redundant-v1.c index fe182cd8..1763a332 100644 --- a/tests/data/test-abidiff-exit/test-leaf-redundant-v1.c +++ b/tests/data/test-abidiff-exit/test-leaf-redundant-v1.c @@ -1,3 +1,5 @@ +// Ensure that --redundant is indeed implied by --leaf-changes-only mode and +// that all the changed functions get complete reports. struct stn1 { int x; }; @@ -7,14 +9,14 @@ struct stn2 { double y; }; -void fn1(struct stn1 s) { +void fn1(struct stn1 s) { // was sto1 } -void fn2(struct stn2 s) { +void fn2(struct stn2 s) { // was sto2 } -void fn3(struct stn1* s) { +void fn3(struct stn1* s) { // was sto1 } -void fn4(struct stn2* s) { +void fn4(struct stn2* s) { // was sto2 } diff --git a/tests/data/test-abidiff-exit/test-leaf-redundant-v1.o b/tests/data/test-abidiff-exit/test-leaf-redundant-v1.o index f7db3a0cd5c0d44e14a1d00e7503a07e50a7e1cd..443777797e4a5fc694cda2cfa46544ab639406c1 100644 GIT binary patch delta 617 zcmZuuL1+_E5S`i0Cc8;$n@IXiw#Zh3O@&SJBPj9EAQ9umLP1YnlDZoW#%;A*sdx~3 z@uJZ09IQtVo;>ysxoF$hA?B7Y83<~_C%Z;n0C9|BtHyNw0)#})+n1QtL9KLyZyf_pup9#OM<3 z(BBH(q2KGf_kC|W@OnW=ueB4Hq4(Otd}sB#)0XF*X0=h3PNOcHQr4Sf>nonOvAsU@ zVYm_8a-#8S;oZ&uskski^(JhE+!R9tpwn(&a4MJl^+7L~2)nYmJXM0*<8|;@A0d`# z%@Dk=`jN!Vtb077y?hzD`PSJ&kP@o1v)e;2!u&d9K^|m*hV52ACF|RQ{0WC zt5fV#QvCKt9DOv!UZYRRm$*U~Q{rGV)z$D9jjWG&g;ctO9xW!0(~oo+cPN)>S>MLL u5AbXpA7;vUhg7D8FKEQLPq}Oh_h^l=PAc27J{yy2XC^w?GXA98%+g;V0(=?( delta 613 zcmZ9IK~EDw6vyA&WwyKB*0ho`Yzt<45L=VB%r??sB0WIp2@_9hyil}NlDa@x48(&d zXA?H>z$f6u#SIs4eg(Y{4idsg;6Ml=CeF00hi+#7@BiNK&FtGb&417DmvB2Qf0;pZ z5didUKrNvhz{m(&^#jn9&mc25WK`VfJJ5Fk6X8VxN5ek_KFW_I*1~sSnoH6dUB3>P zp&Ax=hM)asl>zer)6~X7Ha(`gwQw1%t}g(S^cA_(Lp=HPToN6oq$1wlNlQgkiCRHt zGpO`B?QXsDK~!JMG5~YH>QAc@-9m<2%$Z|oK4Ezo_6Dly@}S}En}P2^Z_R(}s$YJy zwzbmh*iZ}JuY*Ja=v>R8M_1b16tw2&AG@W6&dO@rcW0|!Ra8WyJaDczEoOz7_Kpwq zU+84zAa~Wk@so^Wjy^N)I5JbT7+38$PEy2*Sf}4?g05K^Yg9BixrUj|#U1J#OTPE% znbC3{#?_}oG((ZWoqu~i4$*sbVI1HiYA5*deqvd}Q@XT%V2Pq+3t!PqvVkv1*iGvs szSBM0u^af3BD;yZblF#tYT`O=NFApr)wI5`!B>iOlWO2k66ptj0k7t5i2wiq diff --git a/tests/data/test-abidiff-exit/test-leaf-stats-v0.cc b/tests/data/test-abidiff-exit/test-leaf-stats-v0.cc index 27ba39c9..12a00e0a 100644 --- a/tests/data/test-abidiff-exit/test-leaf-stats-v0.cc +++ b/tests/data/test-abidiff-exit/test-leaf-stats-v0.cc @@ -1,3 +1,4 @@ +// See comments in -v1.c file. int changed_var = 0; int changed_fun() { diff --git a/tests/data/test-abidiff-exit/test-leaf-stats-v0.o b/tests/data/test-abidiff-exit/test-leaf-stats-v0.o index a79511cc3c6db039aaa1f5528db19b55f75c7a2d..2faf8314022d140d44519fdc997fa601fc171faf 100644 GIT binary patch delta 396 zcmY+8K}!N*5Qe|m{nqwdB=BH*h+2zityWzTmhGU0!3IInA*mp2wbhIg(M<>n^b(yy znVZn5Um#xcRM-B6-GVM%y|u6iH83+g!^`{5IQSFnDv;L(}jbwk}H-R;^;67g|<> z#GUIpaqOm}UfEXJ^HN)hSgAw`Cz>{umTzh;@&^bpv)N5q*|CdNtL88!AUI3ca7@KOfOsXji@9CF0~&%NR;dYj9MCvC;ir4K#|h2h zEA`_Y^$*X4Fb6W;&b)zwhG;?#JE9IpI1)4L0X)k-0@Inyd9;e#Oy^7vBQS?urob+a eSO)4iac3J1DZ{>aPnyDxq_aoCqZjP>7JmV|$zwAB delta 404 zcmew$`apDo2BX46%`isBi48K0%oFF%Vs~R;U|?oYpKQk{mtvq>W}ugx3>0BtU=?QI zWCF8*ga|8_H!EW#6B7d?V{%4fUV3Uud|GK91B_jkSj140T3n)=lbVwK0*3e~LqnJWK*P!=%QK0JSZJcCHn0TRzS)hb zh*44q$PxrP6$V(K47te{nH3ogCjVeoovgs3A*l%!7lhJWK$;VXB_=1bh%?qtu4Hj% z3(lNWGmFgi>=$!X7+FqxCfp0Q%GCzn0v X1E{0*Cr{)u=d56b7_)ftL^gQ