From patchwork Thu Oct 29 10:06:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 40916 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 176063857818; Thu, 29 Oct 2020 10:06:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 176063857818 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603966007; bh=2hJT4ytIbsHT9N1cfmsimiOvOur9VGSmQHlfLQPKEsw=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=aPbPnXRS76s+SI8GT7jOGc44ZY44Wmsnc+QPvn92wZuEWGdYHZNbts3D4Yw6Day6L HeElnvYE7q8FTbolRwskmnxzCemQJWiV3VG5ZScwNEecFGwA2ja7/KzOyhlgC3er91 yk9AtA03QMtUC0TxmY85rcEZ+uc3xPmxFFoqadyU= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by sourceware.org (Postfix) with ESMTPS id 307103857818 for ; Thu, 29 Oct 2020 10:06:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 307103857818 Received: by mail-qt1-x84a.google.com with SMTP id z12so1560819qto.4 for ; Thu, 29 Oct 2020 03:06:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=2hJT4ytIbsHT9N1cfmsimiOvOur9VGSmQHlfLQPKEsw=; b=WWE+0MxKRNFh42XFtgQSLy6O4C6RDrOe4S4aD/VcSpOcLas/ckaS9WNn/ucFAQEAbw jDY3ZxRassGtwSl494N8YhM9iVcz5t0H1aawnLUsAWgAB3u1zDOAlg5u2Qv06UoeSlEB 8toOLWUffE2px5TcsP7Qm8c4qcceA3EP3kCXo20SC4IkZw1IGKnFHG5OohsIMbMey6Mk rAgH5gNRhcAtZ1VMe52mlCkVDWF+nlvjjgIRxh3N4R0MExIr4CGgJhsqCxWDR2NLSA1i LvqIhZTK8V2C3ZBlEk0BVRM0UIRnxKc2eCKvJZObG2RZus+f1SP3tPBZEzaQbAJuh6nx 7MPQ== X-Gm-Message-State: AOAM531YXj55qiu/KsqYq8uuXep9ZnSYxQL8+esrPf3FfzmJXYXgBHZU POrMqoli1vkMCTc95moRpZIi1dCX3yuvY2wbCfSJF65rYQuVVWjrDfZ4+VXz450+qftBrnXrKLF SxPn0xOGnwtKij2HmE30gM/IgLnQrm8m6HNJB+VrFVGfSvMqL02FLBYUW6Wys0BwfZgXbSHA= X-Google-Smtp-Source: ABdhPJxT/axMU/ntO6k7//ekYUNuBABvOYqo7aXU6M6/Ouv4pEFg1CEQ4eHi+9oi3EO2vF/XeY+OHZ07lP0IRw== X-Received: from tef.lon.corp.google.com ([2a00:79e0:d:110:a6ae:11ff:fe11:4f04]) (user=gprocida job=sendgmr) by 2002:a0c:a105:: with SMTP id d5mr3340730qva.35.1603966002629; Thu, 29 Oct 2020 03:06:42 -0700 (PDT) Date: Thu, 29 Oct 2020 10:06:36 +0000 Message-Id: <20201029100636.4092855-1-gprocida@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [RFC PATCH] Add enum underlying type tests To: libabigail@sourceware.org X-Spam-Status: No, score=-21.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, LOTS_OF_MONEY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Giuliano Procida via Libabigail From: Giuliano Procida Reply-To: Giuliano Procida Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" These tests currently illustrate a few issues with libabigail's handling of enum types. - signedness and changes thereof (as seen in DWARF) are not modelled - size and alignment changes are reported twice - size changes are not considered ABI incompatibilities Also, *all* enum-underlying types are currently considered anonymous and have the same name, even when they differ in size, alignment or signedness. This causes non-deterministic ordering of such types in XML output. Signed-off-by: Giuliano Procida --- tests/data/Makefile.am | 12 +++++ .../test-fixed-enum-type-report0.txt | 12 +++++ .../test-fixed-enum-type-report1.txt | 12 +++++ .../test-fixed-enum-type-v0.cc | 11 +++++ .../test-fixed-enum-type-v0.o | Bin 0 -> 2824 bytes .../test-fixed-enum-type-v1.cc | 11 +++++ .../test-fixed-enum-type-v1.o | Bin 0 -> 2872 bytes .../test-unfixed-enum-type-report0.txt | 18 +++++++ .../test-unfixed-enum-type-report1.txt | 18 +++++++ .../test-unfixed-enum-type-v0.c | 11 +++++ .../test-unfixed-enum-type-v0.o | Bin 0 -> 2736 bytes .../test-unfixed-enum-type-v1.c | 11 +++++ .../test-unfixed-enum-type-v1.o | Bin 0 -> 2800 bytes tests/test-abidiff-exit.cc | 44 ++++++++++++++++++ 14 files changed, 160 insertions(+) create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-report0.txt create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-report1.txt create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-v0.cc create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-v0.o create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-v1.cc create mode 100644 tests/data/test-abidiff-exit/test-fixed-enum-type-v1.o create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-report0.txt create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-report1.txt create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-v0.c create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-v0.o create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.c create mode 100644 tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.o diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 40a575fa..3f58adb3 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -184,6 +184,18 @@ 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/test-unfixed-enum-type-v0.c \ +test-abidiff-exit/test-unfixed-enum-type-v0.o \ +test-abidiff-exit/test-unfixed-enum-type-v1.c \ +test-abidiff-exit/test-unfixed-enum-type-v1.o \ +test-abidiff-exit/test-unfixed-enum-type-report0.txt \ +test-abidiff-exit/test-unfixed-enum-type-report1.txt \ +test-abidiff-exit/test-fixed-enum-type-v0.cc \ +test-abidiff-exit/test-fixed-enum-type-v0.o \ +test-abidiff-exit/test-fixed-enum-type-v1.cc \ +test-abidiff-exit/test-fixed-enum-type-v1.o \ +test-abidiff-exit/test-fixed-enum-type-report0.txt \ +test-abidiff-exit/test-fixed-enum-type-report1.txt \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ diff --git a/tests/data/test-abidiff-exit/test-fixed-enum-type-report0.txt b/tests/data/test-abidiff-exit/test-fixed-enum-type-report0.txt new file mode 100644 index 00000000..0ecb35a9 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-fixed-enum-type-report0.txt @@ -0,0 +1,12 @@ +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 unsigned int fun(A, B)' has some indirect sub-type changes: + parameter 2 of type 'enum B' has sub-type changes: + type size changed from 8 to 64 (in bits) + type alignment changed from 8 to 64 + type size changed from 8 to 64 (in bits) + type alignment changed from 8 to 64 + diff --git a/tests/data/test-abidiff-exit/test-fixed-enum-type-report1.txt b/tests/data/test-abidiff-exit/test-fixed-enum-type-report1.txt new file mode 100644 index 00000000..0ecb35a9 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-fixed-enum-type-report1.txt @@ -0,0 +1,12 @@ +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 unsigned int fun(A, B)' has some indirect sub-type changes: + parameter 2 of type 'enum B' has sub-type changes: + type size changed from 8 to 64 (in bits) + type alignment changed from 8 to 64 + type size changed from 8 to 64 (in bits) + type alignment changed from 8 to 64 + diff --git a/tests/data/test-abidiff-exit/test-fixed-enum-type-v0.cc b/tests/data/test-abidiff-exit/test-fixed-enum-type-v0.cc new file mode 100644 index 00000000..a646b2db --- /dev/null +++ b/tests/data/test-abidiff-exit/test-fixed-enum-type-v0.cc @@ -0,0 +1,11 @@ +enum A : signed char { + Ae = 0, +}; + +enum B : signed char { + Be = 0, +}; + +unsigned int fun(A a, B b) { + return sizeof(a) + sizeof(b); +} diff --git a/tests/data/test-abidiff-exit/test-fixed-enum-type-v0.o b/tests/data/test-abidiff-exit/test-fixed-enum-type-v0.o new file mode 100644 index 0000000000000000000000000000000000000000..125f0660e3bd44e52786c6a9b50ac4180b9fef74 GIT binary patch literal 2824 zcmb_d-D_M$6hCwC?q=g{mLyxTF`=xWm{RXGOKWK>iJPqbh)P++JhUM3?(Xb|?#_mL z@76>giXf7J4;BPb6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*!t(xQSx|N34cH12v%e&Qdt5)EYx1$J3 z!m@E`zg!2=9TpSE2XepTQcogIA5pkb3;E&SQcFYGYiJO`i6iw|8eZ%tDUHOArp@kc z*#S2LHA!Ts#@2NPV4Eb60bvs#(ikv!2qVA%^9X$C2poGdfebiw>EL6u8;$KluLGjLTiE(I2VOKcmutO3K-zeREkAH7KPxBM z*sOU@D|}d0@$WHBpfBw$?UDTdFTak7omDHI6PZ`fMgD8}plXHiFe@UH$d=&Q%1 zbe#Wh5@Mv=(xXnlw^Gc8*vaUh2Tv7FeMJ!WEd3CO=J3;F68?e)q@SXxH|n;lsL?Sp zzM;VBo@d19w%;S1RR4dfe)gyO>Gjg9(7wOUgf{E+y|1<)`;V z&%ccr#pF7X4e4K%XqN#sbAFz0Bc9~Hp)T_$Z}I%e2s*K%G){#5?Dc~=4F z*-*{AeunQOleB-+3HwKX2lnTErF!(-6#KCPS5?6yh|!y^`_q}|cMqYcD4b4(LVwWL SPjQp{ud4bV^<6_w_kRsH`M$*f literal 0 HcmV?d00001 diff --git a/tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.c b/tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.c new file mode 100644 index 00000000..41d3a6a1 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.c @@ -0,0 +1,11 @@ +enum A { + Ae = 1ull << 48, +}; + +enum B { + Be = (1ull << 31) + 1, +}; + +unsigned int fun(enum A a, enum B b) { + return sizeof(a) + sizeof(b); +} diff --git a/tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.o b/tests/data/test-abidiff-exit/test-unfixed-enum-type-v1.o new file mode 100644 index 0000000000000000000000000000000000000000..8a29654cf7c49bd13cb64b6f168c8df55bc1a592 GIT binary patch literal 2800 zcmbVN-D@0G6hC)oztU-zBwMjDRi{*K3eGg?m;E5=CQ;i|E3pvJ2MM#gcRw_HciEY( ziBjx?h`|>Ng(8R)eDFbh?|c7={saC2f`x*V_MDk}HnTUA3Oz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-abidiff-exit.cc +++ b/tests/test-abidiff-exit.cc @@ -352,6 +352,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/test-unfixed-enum-type-v0.o", + "data/test-abidiff-exit/test-unfixed-enum-type-v1.o", + "", + "", + "", + "--no-default-suppression --no-show-locs", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-unfixed-enum-type-report0.txt", + "output/test-abidiff-exit/test-unfixed-enum-type-report0.txt", + }, + { + "data/test-abidiff-exit/test-unfixed-enum-type-v0.o", + "data/test-abidiff-exit/test-unfixed-enum-type-v1.o", + "", + "", + "", + "--no-default-suppression --no-show-locs --harmless", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-unfixed-enum-type-report1.txt", + "output/test-abidiff-exit/test-unfixed-enum-type-report1.txt", + }, + { + "data/test-abidiff-exit/test-fixed-enum-type-v0.o", + "data/test-abidiff-exit/test-fixed-enum-type-v1.o", + "", + "", + "", + "--no-default-suppression --no-show-locs", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-fixed-enum-type-report0.txt", + "output/test-abidiff-exit/test-fixed-enum-type-report0.txt", + }, + { + "data/test-abidiff-exit/test-fixed-enum-type-v0.o", + "data/test-abidiff-exit/test-fixed-enum-type-v1.o", + "", + "", + "", + "--no-default-suppression --no-show-locs --harmless", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-fixed-enum-type-report1.txt", + "output/test-abidiff-exit/test-fixed-enum-type-report1.txt", + }, {0, 0, 0 ,0, 0, 0, abigail::tools_utils::ABIDIFF_OK, 0, 0} };