From patchwork Mon May 18 11:47:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 39285 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 B2D66388A83A; Mon, 18 May 2020 11:47:37 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by sourceware.org (Postfix) with ESMTPS id 8FEFA388A826 for ; Mon, 18 May 2020 11:47:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8FEFA388A826 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dodji@seketeli.org X-Originating-IP: 91.166.131.130 Received: from localhost (91-166-131-130.subs.proxad.net [91.166.131.130]) (Authenticated sender: dodj@seketeli.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 4DDA940002 for ; Mon, 18 May 2020 11:47:33 +0000 (UTC) Received: by localhost (Postfix, from userid 1001) id 0C31E1A033D; Mon, 18 May 2020 13:47:33 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH 0/3] Handle data member replacement by anonymous data member Organization: Me, myself and I X-Operating-System: Red Hat Enterprise Linux Server 7.7 X-URL: http://www.seketeli.net/~dodji X-Patchwork-State: Committed Date: Mon, 18 May 2020 13:47:33 +0200 Message-ID: <86mu65a2i2.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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: , Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Hello, This patchset is to address the enhancement request at https://sourceware.org/bugzilla/show_bug.cgi?id=25661, which aims at recognizing replacements of data members by anonymous members. In the case where such a replacement does not lead to a harmful change to the bit layout of the class/struct, the patchset makes libabigail (through abidiff) avoid flagging the change as (potentially) problematic and just filters it out. However, calling abidiff with --harmless describes the change (hopefully) appropriately. To make a long story short, let's look at a screenshot of what the patch makes abidiff report on the kind of changes we are interested in: $ diff -u test-v0.c test-v1.c $ abidiff test-v0.o test-v1.o Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable $ abidiff -l test-v0.o test-v1.o Leaf changes summary: 0 artifact changed (1 filtered out) Changed leaf types summary: 0 (1 filtered out) 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 $ abidiff --harmless test-v0.o test-v1.o 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 foo(S*)' at test-v1.c:11:1 has some indirect sub-type changes: parameter 1 of type 'S*' has sub-type changes: in pointed to type 'struct S' at test-v1.c:1:1: type size hasn't changed data member 'S::a' was replaced by anonymous data member: 'union {int a; char added;}' $ abidiff --harmless -l test-v0.o test-v1.o Leaf changes summary: 1 artifact changed Changed leaf types summary: 1 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 'struct S at test-v0.c:1:1' changed: type size hasn't changed data member 'S::a' was replaced by anonymous data member: 'union {int a; char added;}' $ The last patch is where the real work about this task is happening. The first two patches are fixes that are required for the last one. The set has been applied to master. Thanks. --- test-v0.c 2020-05-18 11:45:49.640328955 +0200 +++ test-v1.c 2020-05-18 11:45:44.079261669 +0200 @@ -1,6 +1,10 @@ struct S { - int a; + union + { + int a; + char added; + }; }; void