From patchwork Wed Jun 10 11:59:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39547 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 B5F8E3851C11; Wed, 10 Jun 2020 11:59:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5F8E3851C11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790387; bh=7DQXFrsLXKeQTbQUtov+T7gopuSDPCmr+SAZG7XoQf4=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OR2e7F5Z+vlWqlerVupblrJlsXn4OgFVrJ2Bc0TVjyv2BC2EJ8qF1uXQr2u0vHt5k gyN7qgzdd5zprJnEDdzwqx0sCpBAAraJPjzyv0jHGac+TTztqzg71CSYpPgA4LV1UY f5VghugEaugaJSJYHRx2x+9b3W/YH/n8iWQMswiA= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by sourceware.org (Postfix) with ESMTPS id DC2443851C11 for ; Wed, 10 Jun 2020 11:59:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DC2443851C11 Received: by mail-qt1-x849.google.com with SMTP id n37so1596925qtf.18 for ; Wed, 10 Jun 2020 04:59:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=7DQXFrsLXKeQTbQUtov+T7gopuSDPCmr+SAZG7XoQf4=; b=PN3cFCNK1dH8NF0CoPfioE7LgiLf42p2fp8xw+4srJUME4c7WR4OiLn4wbKL1xwBYp xDYWIX5HYsSqytXu82WRNCgqfjH+yVoEqxL5+wNa+rjZt39t2jaV5MN4++RYQTPV0ulq VmJJVlMzztuNbr1VBBYMzgfAWHBdCwfb2pR4wPW3drC3qt1qYFgzkNRO77HCepM3rKif OTiLLMKkuMvg/wQuaVKtxaX+PgLE/bWZkIbjfiSLTYN7cn0OJdKLtoKfRXzw/Zfiu4+Q nqxykyDShtifreWDhyq9tlwvdm+fWIENrPbzFd8I6ar+0ttuVdQFKpfjlRKM2dKaZbH4 HBjA== X-Gm-Message-State: AOAM533r7tYYytfQIaSzB1E5Gy+it7zqklvRR+pHp3tsYJv2/m3pcINH mp4OF18i/Cg7rbfHJeBhqUCVvBKSPEvpRgMqjynAw+gcfQp39E/qXGlnRCI17LsVrx2cmUGsQ1t 8lWSXpaA9PoDtobz0QmaEPbZYRpSdjUx+rpp6q5l/c3FKXOyqHMGJD3FM1xBtnQAzOigZq/s= X-Google-Smtp-Source: ABdhPJyuyGF3LmDPu1R43RXkl1Mo2mXdBnrOuY1CacgwWVzoV2t2i4remUoNHhyw9Rhb2sV+0wwq98Rb6gGWPg== X-Received: by 2002:a0c:f78a:: with SMTP id s10mr2787704qvn.32.1591790385442; Wed, 10 Jun 2020 04:59:45 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:30 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-2-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 01/11] Missing initialisation of source local variable. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.3 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" This will be fixed by maennich, one way or another. Signed-off-by: Giuliano Procida --- src/abg-dwarf-reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 77af0441..1218f8c7 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -3190,7 +3190,7 @@ public: size_t where, bool die_as_type) const { - die_source source; + die_source source = NO_DEBUG_INFO_DIE_SOURCE; ABG_ASSERT(get_die_source(die, source)); offset_offset_map_type &canonical_dies = From patchwork Wed Jun 10 11:59:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39548 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 0B6F4386EC42; Wed, 10 Jun 2020 11:59:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B6F4386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790391; bh=Nc/ivmDPmQ8ca/XA6rcwgvk8cbp8a1/vzaUhuJJ7sYY=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=i8E0iaDun6cg65LWWiAUCou1sv41kbnw6GHevLe5DzcK+rN9iYH3FmQCa0f8V1Cw5 9u4F/GiY9wtyE5nLWbxE+LB6CU00/+RPv7fkH+RrkTqZX3/61rvsSkhQnFFnMPWN+2 wJ19nZjS1NpxknD2fC9PpOKjWCS7gANcsBRP3838= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by sourceware.org (Postfix) with ESMTPS id 19FF9386EC42 for ; Wed, 10 Jun 2020 11:59:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19FF9386EC42 Received: by mail-qk1-x74a.google.com with SMTP id 140so1751817qko.23 for ; Wed, 10 Jun 2020 04:59:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Nc/ivmDPmQ8ca/XA6rcwgvk8cbp8a1/vzaUhuJJ7sYY=; b=Ma/0946jNy72Hz37M3rMG3hlSZsVdaYF4KXTFF8fc+LhGUtudmcMK+7NmLMLtbCUGy tS8/GgIMUC8qI616M9AK5HsAI4Zj2qa/LtZjZtTT49FVjK1yATuBoHbtKybLrL2FlQ7B XgtkoQI4ayG1IVcSNMe5b6cOyEnYHIjc3hS1soHxQV/XZ4zEKrG1E9IVX8dHOVUI20PR pYUSQLRDElsqP43EWXvhVp6NKi6GAZrOi9WfEbqrVm0VbMPei6UqRb/+8/t0KiFA/jI1 Xyn1xf+FP9vARq/RUS0+KS9qs/2G9nHe+NFdnH1OXouwLrKmjaaCIOAFXpyFxoXF5aI4 m2eQ== X-Gm-Message-State: AOAM533sQ5qXfuhPVWFcxmX6cb3foeC100elqLaeiCk/dld1yGnM3F4t YLfs4CzahPG2+Z7w7aauhv7dEKbnhw+DjoxJ14cH/l74jIaLyvZ77cYqyUtgikBicjSdD+LZVMZ bu9wtN+Qsrv/bB6mHU/T97/g4+UZXpx7/1Dd6F1uVQB5L2aR3DUL18ejGXkHSFh1ToE+t8zQ= X-Google-Smtp-Source: ABdhPJxsol7eAfy0h21a99eaooCT/foa8MDMCC6T7GTFD/YR1G2xrJw9hbAmRlChcMtJjIg+I2OrBjAdOiBZFQ== X-Received: by 2002:ad4:48c8:: with SMTP id v8mr2764957qvx.15.1591790387565; Wed, 10 Jun 2020 04:59:47 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:31 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-3-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 02/11] Improve code comments and whitespace. To: libabigail@sourceware.org X-Spam-Status: No, score=-25.0 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" These are zero impact changes. * include/abg-fwd.h: Correct doc-comment reference to enum_type_decl. * src/abg-comp-filter.cc: Fix doc-comment syntax. * src/abg-comparison.cc (operator<<): In the diff_category overload, fix code indentation. * src/abg-default-reporter.cc (report): In the class_or_union_diff overload, adjust comment to reflect that the code is reporting changes between declaration-only and defined types, in either direction. Signed-off-by: Giuliano Procida --- include/abg-fwd.h | 2 +- src/abg-comp-filter.cc | 4 ++-- src/abg-comparison.cc | 8 ++++---- src/abg-default-reporter.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/abg-fwd.h b/include/abg-fwd.h index f6e0c5b2..999b071b 100644 --- a/include/abg-fwd.h +++ b/include/abg-fwd.h @@ -152,7 +152,7 @@ typedef weak_ptr typedef_decl_wptr; class enum_type_decl; -/// Convenience typedef for shared pointer on enum_type_decl. +/// Convenience typedef for shared pointer to a @ref enum_type_decl. typedef shared_ptr enum_type_decl_sptr; class class_or_union; diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc index 67c2a180..36fca73d 100644 --- a/src/abg-comp-filter.cc +++ b/src/abg-comp-filter.cc @@ -961,8 +961,8 @@ has_class_decl_only_def_change(const class_or_union_sptr& first, /// other one is defined. /// /// @param diff the diff node to consider. -//// -//// @return true if the class_or_union_diff carries a change in which +/// +/// @return true if the class_or_union_diff carries a change in which /// the two classes are different by the fact that one is a decl-only /// and the other one is defined. bool diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 7305a71a..857ffa8a 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -3132,7 +3132,7 @@ operator<<(ostream& o, diff_category c) emitted_a_category |= true; } - if (c & FN_RETURN_TYPE_CV_CHANGE_CATEGORY) + if (c & FN_RETURN_TYPE_CV_CHANGE_CATEGORY) { if (emitted_a_category) o << "|"; @@ -3140,7 +3140,7 @@ operator<<(ostream& o, diff_category c) emitted_a_category |= true; } - if (c & VAR_TYPE_CV_CHANGE_CATEGORY) + if (c & VAR_TYPE_CV_CHANGE_CATEGORY) { if (emitted_a_category) o << "|"; @@ -3148,7 +3148,7 @@ operator<<(ostream& o, diff_category c) emitted_a_category |= true; } - if (c & VOID_PTR_TO_PTR_CHANGE_CATEGORY) + if (c & VOID_PTR_TO_PTR_CHANGE_CATEGORY) { if (emitted_a_category) o << "|"; @@ -3156,7 +3156,7 @@ operator<<(ostream& o, diff_category c) emitted_a_category |= true; } - if (c & BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY) + if (c & BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY) { if (emitted_a_category) o << "|"; diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc index 80cb6638..7c98d8d7 100644 --- a/src/abg-default-reporter.cc +++ b/src/abg-default-reporter.cc @@ -844,7 +844,7 @@ default_reporter::report(const class_or_union_diff& d, const diff_context_sptr& ctxt = d.context(); - // Report class decl-only -> definition change. + // Report class decl-only <-> definition change. if (ctxt->get_allowed_category() & CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY) if (filtering::has_class_decl_only_def_change(first, second)) { From patchwork Wed Jun 10 11:59:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39549 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 511B0386EC42; Wed, 10 Jun 2020 11:59:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 511B0386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790392; bh=3KwIh7u9jSd1yMuNMGrcyP9h+r1hayyIxisx2GV7Puw=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qVir5dYrnza7ykjiaIkkkf+csgw5hW8aOVsBh++5xJVpt/kbV0cTtkvYmWOoPc/TE uSwgi79F2iVJrjsuUFMOdT+xHqvlaogLYBDo+JXXKB6PQel6A6MRA0hJqgBmeE3ARd 22EdFQrct4Njo0NixaHInY1pYprc+lq+RnWBlS3I= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by sourceware.org (Postfix) with ESMTPS id 352D03851C11 for ; Wed, 10 Jun 2020 11:59:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 352D03851C11 Received: by mail-qt1-x849.google.com with SMTP id u48so1601664qth.17 for ; Wed, 10 Jun 2020 04:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=3KwIh7u9jSd1yMuNMGrcyP9h+r1hayyIxisx2GV7Puw=; b=Yut2mRlhnvATGh9Dg5DuwBwq9vLdo1Surv5yF00sQuYNfBhoidIKwlK/heuJISVSfq 6sPJt5ArVwqPnpz2PwOfhRvv4ECYbniPLabugF51VO6Xtcz9N5hl5N/giB4iVdCvR0Rq 5epCPj++RmZH8eyyfCTe0nRF0aYoFpe0POBKHXwlwUf2JJsnoFD5l3pLxD/z61VKgs+7 Rz/8iof2PRapWSURMjQhGC1EOwST0FYdomeUfkfvPiX2MiujCkVx+ZD3BAsUoBQrKtJP eLlPoH3Qo6o4OMdQpOBVluKWb/e/w8WZ2IAFBYMYaSDqJsmx6Ext/Q8aRGkmqL6YAXsC 6NHw== X-Gm-Message-State: AOAM530xmamhA4oX2QPBvuXjSP1aaQBw9736Sv9J/gPAfXVJ5T5MDIAJ l3hR3/CjLZqiV03MSeSrAJ3T4HH2OWKKz2ybdQR7pEmxBTSJBBgURT/nnYRd+s/jvtbjG5J51pI 8WCJHG57yBhX8rf+XvASLRSAVM2WxvXB5sBRliarwCVcPK/G4ohHGrbtwrDdhWO2qV2OpvkQ= X-Google-Smtp-Source: ABdhPJzfs/agMLO09UhecatT7CJfU7/Oxoi5FdBDidozs8G3L1MwK8mbG9u5fvZFjV251Kn/cM1qy5KxBXc5xg== X-Received: by 2002:ad4:5511:: with SMTP id az17mr2735069qvb.146.1591790389741; Wed, 10 Jun 2020 04:59:49 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:32 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-4-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 03/11] Refactor d.context() as ctxt in report(enum_diff). To: libabigail@sourceware.org X-Spam-Status: No, score=-23.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" * src/abg-default-reporter.cc (report): In the enum_diff overload, introduce the name ctxt to replace four occurrences of d.context(). Signed-off-by: Giuliano Procida --- src/abg-default-reporter.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc index 7c98d8d7..42851346 100644 --- a/src/abg-default-reporter.cc +++ b/src/abg-default-reporter.cc @@ -98,9 +98,10 @@ default_reporter::report(const enum_diff& d, ostream& out, enum_type_decl_sptr first = d.first_enum(), second = d.second_enum(); - report_name_size_and_alignment_changes(first, second, d.context(), + const diff_context_sptr& ctxt = d.context(); + report_name_size_and_alignment_changes(first, second, ctxt, out, indent); - maybe_report_diff_for_member(first, second, d.context(), out, indent); + maybe_report_diff_for_member(first, second, ctxt, out, indent); //underlying type d.underlying_type_diff()->report(out, indent); @@ -165,12 +166,12 @@ default_reporter::report(const enum_diff& d, ostream& out, << "' from value '" << i->first.get_value() << "' to '" << i->second.get_value() << "'"; - report_loc_info(second, *d.context(), out); + report_loc_info(second, *ctxt, out); out << "\n"; } } - if (d.context()->show_leaf_changes_only()) + if (ctxt->show_leaf_changes_only()) maybe_report_interfaces_impacted_by_diff(&d, out, indent); d.reported_once(true); From patchwork Wed Jun 10 11:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39550 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 95B8D386EC42; Wed, 10 Jun 2020 11:59:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95B8D386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790395; bh=lXwUFGPaXpBQBeI2pUx9W9tUgbV96C8jJPG5xtHdLZY=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wv8p38H9PXhjy3f1kZhFpXx/0R5rw575PnTBPZN+irjx4jIQZh7VTgqOgdKDLluGv jhrAsObZ0k3JkUvr8cRRFthjsH4pxukg39EFJpoA23zOwymSrlkj9uzSIYNysI6v/m 13nzJFdhIPoAD4udFfU+CCAneDaxDaMR3DnNo4aM= 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 4CF383851C11 for ; Wed, 10 Jun 2020 11:59:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4CF383851C11 Received: by mail-qt1-x84a.google.com with SMTP id l19so1610584qtp.12 for ; Wed, 10 Jun 2020 04:59:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lXwUFGPaXpBQBeI2pUx9W9tUgbV96C8jJPG5xtHdLZY=; b=jvu8bQbjdmogeOd/clZpksW3u445wdGdj7YAVtz94Ifqs+eymGgBCIFxvwgrZBFQ4N +dbEB+fN3SfmcZuc2icyiz4orTfkWrb1/zOhJl+SbQpj4K7PynjYPDiE7MZIFpebuDm0 DNxd72N5m6BdHMwkCaZKxX4p80sJVfibEY23RXc2FDvs6zs1f9rcgTQTskL0LcmhGqNx ewgM+H/9LxDgrhiIV6bYqyF4SQ5a56kdo0SIVtnRCmGzUUSUzl82otAEcx5Y5rzQ10J/ joZRynzoXsUQjJMBzmzW4d6pmjgp+aSmSM/M7Y009KooZIpXP9NsXFin5QGj/9NUsj/T RWvQ== X-Gm-Message-State: AOAM533MFarTkfVPWwZOD4UH2PUY1FXmmknyd65EpU0InsqENnJMj7P+ mHmPDEs+RqKmp9obglXJX6y62lIVigQCvVVWI7h1C1tkTVH/lOuDX/vMNGEx1Na8cf7ocNAPCZO BXD84+539kz4pH6cqrkrJ/DoUpgXapDw/aO5C126tfgtoXOwglQ1wDIg6lJGIxQPMrngp3KI= X-Google-Smtp-Source: ABdhPJxyQYbJ5qIUjTZIenwpp4JKitxLLCSy6Hgvo318/AESw2QB+0vNQ95GVOz9K86uuzwqk1ieNkKyH054NQ== X-Received: by 2002:ad4:4d8f:: with SMTP id cv15mr2754407qvb.195.1591790391788; Wed, 10 Jun 2020 04:59:51 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:33 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-5-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 04/11] Tidy build_enum_type state variables. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" This patch brings the enum code closer to the class/union code, in the hope that this will ease future code maintenance. There are no behavioural changes. * src/abg-dwarf-reader.cc (build_enum_type): Rename local variable enum_is_anonymous to is_anonymous. Move initilisation of local variable is_artificial to location corresponding to that in add_or_update_class_type and add_or_update_union_type functions. Signed-off-by: Giuliano Procida --- src/abg-dwarf-reader.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 1218f8c7..9b3e6371 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -13284,14 +13284,14 @@ build_enum_type(read_context& ctxt, location loc; die_loc_and_name(ctxt, die, loc, name, linkage_name); - bool enum_is_anonymous = false; + bool is_anonymous = false; // If the enum is anonymous, let's give it a name. if (name.empty()) { name = get_internal_anonymous_die_prefix_name(die); ABG_ASSERT(!name.empty()); // But we remember that the type is anonymous. - enum_is_anonymous = true; + is_anonymous = true; if (size_t s = scope->get_num_anonymous_member_enums()) name = build_internal_anonymous_die_name(name, s); @@ -13303,7 +13303,7 @@ build_enum_type(read_context& ctxt, // representation (name) and location can be later detected as being // for the same type. - if (!enum_is_anonymous) + if (!is_anonymous) { if (use_odr) { @@ -13336,6 +13336,7 @@ build_enum_type(read_context& ctxt, uint64_t size = 0; if (die_unsigned_constant_attribute(die, DW_AT_byte_size, size)) size *= 8; + bool is_artificial = die_is_artificial(die); // for now we consider that underlying types of enums are all anonymous bool enum_underlying_type_is_anonymous= true; @@ -13368,8 +13369,6 @@ build_enum_type(read_context& ctxt, while (dwarf_siblingof(&child, &child) == 0); } - bool is_artificial = die_is_artificial(die); - // DWARF up to version 4 (at least) doesn't seem to carry the // underlying type, so let's create an artificial one here, which // sole purpose is to be passed to the constructor of the @@ -13385,7 +13384,7 @@ build_enum_type(read_context& ctxt, t = dynamic_pointer_cast(d); ABG_ASSERT(t); result.reset(new enum_type_decl(name, loc, t, enms, linkage_name)); - result->set_is_anonymous(enum_is_anonymous); + result->set_is_anonymous(is_anonymous); result->set_is_artificial(is_artificial); ctxt.associate_die_to_type(die, result, where_offset); return result; From patchwork Wed Jun 10 11:59:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39551 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 E0800386EC42; Wed, 10 Jun 2020 11:59:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0800386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790398; bh=6L++CGzYQRk5yL3cZAHm/SWpBdIme3Cpjw9D4vffxgU=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=oLc62FShbJKMyM/3+CNzX2Aq+ccR9xMUDvdGnho6ZkzsO7WlYullGDFV9xf1uXe54 2BVjPau7x6TN2wf+7xp/f1z3yiQY3tqd4lOJXr09xlZBHqvEtcqn6LEGoGG74UHP2g N/tjSRH5FRfhYfw66ZQhvcB/Qcho2DLWfETLxJ1c= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by sourceware.org (Postfix) with ESMTPS id 86F0C3851C11 for ; Wed, 10 Jun 2020 11:59:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 86F0C3851C11 Received: by mail-yb1-xb4a.google.com with SMTP id r17so1894675ybj.22 for ; Wed, 10 Jun 2020 04:59:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=6L++CGzYQRk5yL3cZAHm/SWpBdIme3Cpjw9D4vffxgU=; b=LdjE1fD2QvruNzpza157kysLHkq7ln7uY3oIeTqYHmOar3snOVVqSe3QN79AnpYzQJ nM1DAHNRUULONWDUsfBrjBE1S46PQhj1e0jzpyBrkZV67nnXTI8JdvYMmbq8+F2z7EW6 evuSl6y1SKnwQKly5dtF4WsGyxfsDSUHEbGWgDsEYBY7U+KkOHkMx0wa0Dkz8vfoGb+a gUAToekOhsp+ZSAUUllga+ZbtlwVqM58EzAyNr9RArEI4UDTj98ldbuUpuSEODesZp5A /TCrd9B2HZou5mtzQKNbnm8fZ7u5471R0DfnFm6R7EtuDNc7m0WdeE5DN11YS+6LIXPI tTKQ== X-Gm-Message-State: AOAM532m9qYF5I164JUf8o44VmIqADCPkKeQDR+zstpN30QfFCE6wuVC LqZrUsUhoePtOfKNfVeeImxF9mwPxduQ2mYhtn0UaJJHjHjr9ckYMg1exBFZcoPk6BwMMJ52vcV /0r/JjOHES6F1T4SpqXmRsJV4nIuELOzKXwJa4ZnQgbNKDsXk37MEw/8nJm7MPrLcTh/zfPI= X-Google-Smtp-Source: ABdhPJy1tXaf6/DvtcaG3KsKfVRpq/DJ+zuZF8OOppj8U7KS7fXcJcmHB3MdGG8QShWf/8KLjXUJrFMvYT5/gg== X-Received: by 2002:a25:d992:: with SMTP id q140mr5024020ybg.213.1591790393995; Wed, 10 Jun 2020 04:59:53 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:34 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-6-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 05/11] Rename declaration-definition change category. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" This patch renames CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY to TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY. Signed-off-by: Giuliano Procida --- include/abg-comparison.h | 10 +++++----- src/abg-comp-filter.cc | 2 +- src/abg-comparison.cc | 6 +++--- src/abg-default-reporter.cc | 2 +- src/abg-leaf-reporter.cc | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/abg-comparison.h b/include/abg-comparison.h index bb510a18..a46c7184 100644 --- a/include/abg-comparison.h +++ b/include/abg-comparison.h @@ -418,10 +418,9 @@ enum diff_category /// present as a child of a other nodes in the diff tree. REDUNDANT_CATEGORY = 1 << 13, - /// This means that a diff node in the sub-tree carries a class type - /// that was declaration-only and that is now defined, or vice - /// versa. - CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY = 1 << 14, + /// This means that a diff node in the sub-tree carries a type that + /// was declaration-only and that is now defined, or vice versa. + TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY = 1 << 14, /// A diff node in this category is a function parameter type which /// top cv-qualifiers change. @@ -447,6 +446,7 @@ enum diff_category /// array type of a global variable, but the ELF size of the /// variable didn't change. BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY = 1 << 20, + /// A special enumerator that is the logical 'or' all the /// enumerators above. /// @@ -467,7 +467,7 @@ enum diff_category | SIZE_OR_OFFSET_CHANGE_CATEGORY | VIRTUAL_MEMBER_CHANGE_CATEGORY | REDUNDANT_CATEGORY - | CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY + | TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY | FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY | FN_PARM_TYPE_CV_CHANGE_CATEGORY | FN_RETURN_TYPE_CV_CHANGE_CATEGORY diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc index 36fca73d..81548427 100644 --- a/src/abg-comp-filter.cc +++ b/src/abg-comp-filter.cc @@ -1518,7 +1518,7 @@ categorize_harmless_diff_node(diff *d, bool pre) s = is_decl(d->second_subject()); if (has_class_decl_only_def_change(d)) - category |= CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY; + category |= TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY; if (access_changed(f, s)) category |= ACCESS_CHANGE_CATEGORY; diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 857ffa8a..f77799f2 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -2957,7 +2957,7 @@ get_default_harmless_categories_bitmap() | abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY | abigail::comparison::HARMLESS_UNION_CHANGE_CATEGORY | abigail::comparison::HARMLESS_DATA_MEMBER_CHANGE_CATEGORY - | abigail::comparison::CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY + | abigail::comparison::TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY | abigail::comparison::FN_PARM_TYPE_TOP_CV_CHANGE_CATEGORY | abigail::comparison::FN_PARM_TYPE_CV_CHANGE_CATEGORY | abigail::comparison::FN_RETURN_TYPE_CV_CHANGE_CATEGORY @@ -3108,11 +3108,11 @@ operator<<(ostream& o, diff_category c) emitted_a_category |= true; } - if (c & CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY) + if (c & TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY) { if (emitted_a_category) o << "|"; - o << "CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY"; + o << "TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY"; emitted_a_category |= true; } diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc index 42851346..2acb6954 100644 --- a/src/abg-default-reporter.cc +++ b/src/abg-default-reporter.cc @@ -846,7 +846,7 @@ default_reporter::report(const class_or_union_diff& d, const diff_context_sptr& ctxt = d.context(); // Report class decl-only <-> definition change. - if (ctxt->get_allowed_category() & CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY) + if (ctxt->get_allowed_category() & TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY) if (filtering::has_class_decl_only_def_change(first, second)) { string was = diff --git a/src/abg-leaf-reporter.cc b/src/abg-leaf-reporter.cc index f9d905ab..37d0fde3 100644 --- a/src/abg-leaf-reporter.cc +++ b/src/abg-leaf-reporter.cc @@ -461,7 +461,7 @@ leaf_reporter::report(const class_or_union_diff& d, const diff_context_sptr& ctxt = d.context(); // Report class decl-only -> definition change. - if (ctxt->get_allowed_category() & CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY) + if (ctxt->get_allowed_category() & TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY) if (filtering::has_class_decl_only_def_change(first, second)) { string was = From patchwork Wed Jun 10 11:59:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39552 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 515F3388C019; Wed, 10 Jun 2020 11:59:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 515F3388C019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790399; bh=bIUGi5q0CDSaZMZltJ81lv3s0hPE0lH1E8XZymIPlXM=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HiOVz+id/QLIZLZy6JPcoe/mapUi8hiOBVPCczXSITKE1LnkuqXbndCr7X5M79LTN yP7aZW/S/kvm2Lo772xFdLtnVwFim7hNzhai2D1JgLK+VQXy001DyRiJS4i5COlpH6 k5np2pX0FevgSVqkRIKNDHbE5p54t5JsAHj2glNE= 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 CE34D388C00E for ; Wed, 10 Jun 2020 11:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CE34D388C00E Received: by mail-qt1-x84a.google.com with SMTP id u26so1591452qtj.21 for ; Wed, 10 Jun 2020 04:59:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=bIUGi5q0CDSaZMZltJ81lv3s0hPE0lH1E8XZymIPlXM=; b=KStc+B9CqbF7W97anhL22MrwB6saXembKeVf7CLK9m6UGVEfwZaH2BoXc9xVYOAR/0 erbU1T24sC6KGyht2cyf8XoO1f0hez31b5MSwyvpDlahNUTcMDbLfw/AFPBJ/Lbx9jB2 bMg6inikzZwPh8zlwebnYbUhpGUFAqi1pe6GvRf6EuA8rsUcdx6FKmFnx3scRpcmeH4a umCBRukQ15QomJhpIPYZw1CAJqdD7rl87Cajiai6lH5Ok8N1YMZ804MEBZq4WeGk+ptQ cZO1GhHJLD3r7aWY7pWd3b8y3rM4upj8hHmB6NJQA36yBaj/7hnI7gefH59hkE3T7zNP iJww== X-Gm-Message-State: AOAM531NPI2RB77UdlXCzaSHfxnc+GdWzi+hxbmw6SVo+SfyPn/pqVPG S8MWie6Ws3lR4dXak3L0npMTRHmAFv5FRE8mGzffiyz09/v3RP25/OwIdIezbGsUR9roOrRzVl2 1cHFGiGCi6SoJEGI59Qu+QX77v3JzTq1BOOu5R1pJLO3G6qkHgREsnrVPAjBsAX00uoefz+Q= X-Google-Smtp-Source: ABdhPJzoT1j3MeAnhUxqqj3x1plAE0TtRPkqigIv5sqMbF7ycBQDsOxVMoQAxHM8DRTLcfp0p+R+4CV0X9Z7+A== X-Received: by 2002:a05:6214:10e1:: with SMTP id q1mr2594585qvt.78.1591790396226; Wed, 10 Jun 2020 04:59:56 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:35 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-7-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 06/11] Support incomplete enums in core and diff code. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.5 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" This is an almost blind attempt at addition of support for incomplete, also known as forward-declared, enum types. I've not made any attempt to refactor or share logic with the struct/union code and I've probably got other things wrong. This patch: - adds enums_type and enum_type_decl_wptr typedefs - adds declaration-only machinery to enum_type_decl - adds is_compatible_with_enum_type, look_through_decl_only_class, there_is_a_decl_only_enum and lookup_enum_type helpers - adds has_enum_decl_only_def_change functions - inserts has_enum_decl_only_def_change wherever has_class_decl_only_def_change is present - adds reporting of enum declaration/definition diffs - doesn't address the DWARF reader, XML writer or XML reader Signed-off-by: Giuliano Procida Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli --- include/abg-comp-filter.h | 7 ++ include/abg-fwd.h | 24 +++++ include/abg-ir.h | 15 +++ src/abg-comp-filter.cc | 74 +++++++++++++- src/abg-comparison.cc | 4 +- src/abg-default-reporter.cc | 19 ++++ src/abg-ir.cc | 196 +++++++++++++++++++++++++++++++++++- 7 files changed, 333 insertions(+), 6 deletions(-) diff --git a/include/abg-comp-filter.h b/include/abg-comp-filter.h index 81130033..3b845088 100644 --- a/include/abg-comp-filter.h +++ b/include/abg-comp-filter.h @@ -68,9 +68,16 @@ bool has_class_decl_only_def_change(const class_or_union_sptr& first, const class_or_union_sptr& second); +bool +has_enum_decl_only_def_change(const enum_type_decl_sptr& first, + const enum_type_decl_sptr& second); + bool has_class_decl_only_def_change(const diff *diff); +bool +has_enum_decl_only_def_change(const diff *diff); + bool has_basic_type_name_change(const diff *); diff --git a/include/abg-fwd.h b/include/abg-fwd.h index 999b071b..73d809ab 100644 --- a/include/abg-fwd.h +++ b/include/abg-fwd.h @@ -155,6 +155,12 @@ class enum_type_decl; /// Convenience typedef for shared pointer to a @ref enum_type_decl. typedef shared_ptr enum_type_decl_sptr; +/// Convenience typedef for a vector of @ref enum_type_decl_sptr +typedef vector enums_type; + +/// Convenience typedef for a weak pointer to a @ref enum_type_decl. +typedef weak_ptr enum_type_decl_wptr; + class class_or_union; typedef shared_ptr class_or_union_sptr; @@ -423,6 +429,12 @@ is_typedef(const type_base*); typedef_decl* is_typedef(type_base*); +enum_type_decl_sptr +is_compatible_with_enum_type(const type_base_sptr&); + +enum_type_decl_sptr +is_compatible_with_enum_type(const decl_base_sptr&); + enum_type_decl_sptr is_enum_type(const type_or_decl_base_sptr&); @@ -513,6 +525,12 @@ look_through_decl_only_class(const class_or_union&); class_or_union_sptr look_through_decl_only_class(class_or_union_sptr); +enum_type_decl_sptr +look_through_decl_only_enum(const enum_type_decl&); + +enum_type_decl_sptr +look_through_decl_only_enum(enum_type_decl_sptr); + var_decl* is_var_decl(const type_or_decl_base*); @@ -1085,6 +1103,12 @@ lookup_enum_type(const string&, const corpus&); enum_type_decl_sptr lookup_enum_type(const interned_string&, const corpus&); +const type_base_wptrs_type* +lookup_enum_types(const interned_string&, const corpus&); + +const type_base_wptrs_type* +lookup_enum_types(const string&, const corpus&); + enum_type_decl_sptr lookup_enum_type_per_location(const interned_string&, const corpus&); diff --git a/include/abg-ir.h b/include/abg-ir.h index ebcc4b81..2114e27b 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -2497,6 +2497,21 @@ public: enumerators& get_enumerators(); + bool + get_is_declaration_only() const; + + void + set_is_declaration_only(bool f); + + void + set_definition_of_declaration(enum_type_decl_sptr); + + const enum_type_decl_sptr + get_definition_of_declaration() const; + + const enum_type_decl* + get_naked_definition_of_declaration() const; + virtual string get_pretty_representation(bool internal = false, bool qualified_name = true) const; diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc index 81548427..70858f27 100644 --- a/src/abg-comp-filter.cc +++ b/src/abg-comp-filter.cc @@ -118,6 +118,25 @@ there_is_a_decl_only_class(const class_decl_sptr& class1, return false; } +/// Test if there is a enum that is declaration-only among the two +/// enums in parameter. +/// +/// @param enum1 the first enum to consider. +/// +/// @param enum2 the second enum to consider. +/// +/// @return true if either enums are declaration-only, false +/// otherwise. +static bool +there_is_a_decl_only_enum(const enum_type_decl_sptr& enum1, + const enum_type_decl_sptr& enum2) +{ + if ((enum1 && enum1->get_is_declaration_only()) + || (enum2 && enum2->get_is_declaration_only())) + return true; + return false; +} + /// Test if the diff involves a declaration-only class. /// /// @param diff the class diff to consider. @@ -146,7 +165,9 @@ type_size_changed(const type_base_sptr f, const type_base_sptr s) || f->get_size_in_bits() == 0 || s->get_size_in_bits() == 0 || there_is_a_decl_only_class(is_compatible_with_class_type(f), - is_compatible_with_class_type(s))) + is_compatible_with_class_type(s)) + || there_is_a_decl_only_enum(is_compatible_with_enum_type(f), + is_compatible_with_enum_type(s))) return false; return f->get_size_in_bits() != s->get_size_in_bits(); @@ -956,6 +977,31 @@ has_class_decl_only_def_change(const class_or_union_sptr& first, return (f->get_is_declaration_only() != s->get_is_declaration_only()); } +/// Test if two @ref enum_sptr are different just by the +/// fact that one is decl-only and the other one is defined. +/// +/// @param first the first enum to consider. +/// +/// @param second the second enum to consider. +/// +/// @return true iff the two arguments are different just by the fact +/// that one is decl-only and the other one is defined. +bool +has_enum_decl_only_def_change(const enum_type_decl_sptr& first, + const enum_type_decl_sptr& second) +{ + if (!first || !second) + return false; + + enum_type_decl_sptr f = look_through_decl_only_enum(first); + enum_type_decl_sptr s = look_through_decl_only_enum(second); + + if (f->get_qualified_name() != s->get_qualified_name()) + return false; + + return (f->get_is_declaration_only() != s->get_is_declaration_only()); +} + /// Test if a class_or_union_diff carries a change in which the two /// classes are different by the fact that one is a decl-only and the /// other one is defined. @@ -980,6 +1026,28 @@ has_class_decl_only_def_change(const diff *diff) return has_class_decl_only_def_change(f, s); } +/// Test if a enum_diff carries a change in which the two enums are +/// different by the fact that one is a decl-only and the other one is +/// defined. +/// +/// @param diff the diff node to consider. +/// +/// @return true if the enum_diff carries a change in which the two +/// enums are different by the fact that one is a decl-only and the +/// other one is defined. +bool +has_enum_decl_only_def_change(const diff *diff) +{ + const enum_diff *d = dynamic_cast(diff); + if (!d) + return false; + + enum_type_decl_sptr f = look_through_decl_only_enum(d->first_enum()); + enum_type_decl_sptr s = look_through_decl_only_enum(d->second_enum()); + + return has_enum_decl_only_def_change(f, s); +} + /// Test if a diff node carries a basic type name change. /// /// @param d the diff node to consider. @@ -1517,7 +1585,8 @@ categorize_harmless_diff_node(diff *d, bool pre) decl_base_sptr f = is_decl(d->first_subject()), s = is_decl(d->second_subject()); - if (has_class_decl_only_def_change(d)) + if (has_class_decl_only_def_change(d) + || has_enum_decl_only_def_change(d)) category |= TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY; if (access_changed(f, s)) @@ -1608,6 +1677,7 @@ categorize_harmful_diff_node(diff *d, bool pre) // // TODO: be more specific -- not all size changes are harmful. if (!has_class_decl_only_def_change(d) + && !has_enum_decl_only_def_change(d) && (type_size_changed(f, s) || data_member_offset_changed(f, s) || non_static_data_member_type_size_changed(f, s) diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index f77799f2..21cab0e7 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -10962,7 +10962,9 @@ struct leaf_diff_node_marker_visitor : public diff_node_visitor // with the is_declaration flag set) that carries a non-zero // size! And of course at some point that non-zero size // changes. We need to be able to detect that. - && !filtering::is_decl_only_class_with_size_change(d)) + && !filtering::is_decl_only_class_with_size_change(d) + // Don't show decl-only-ness changes of enums. + && !filtering::has_enum_decl_only_def_change(d)) { diff_context_sptr ctxt = d->context(); const corpus_diff *corpus_diff_node = ctxt->get_corpus_diff().get(); diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc index 2acb6954..cbf8c2bc 100644 --- a/src/abg-default-reporter.cc +++ b/src/abg-default-reporter.cc @@ -99,6 +99,25 @@ default_reporter::report(const enum_diff& d, ostream& out, enum_type_decl_sptr first = d.first_enum(), second = d.second_enum(); const diff_context_sptr& ctxt = d.context(); + + // Report enum decl-only <-> definition changes. + if (ctxt->get_allowed_category() & TYPE_DECL_ONLY_DEF_CHANGE_CATEGORY) + if (filtering::has_enum_decl_only_def_change(first, second)) + { + string was = + first->get_is_declaration_only() + ? " was a declaration-only enum type" + : " was a defined enum type"; + + string is_now = + second->get_is_declaration_only() + ? " and is now a declaration-only enum type" + : " and is now a defined enum type"; + + out << indent << "enum type " << name << was << is_now << "\n"; + return; + } + report_name_size_and_alignment_changes(first, second, ctxt, out, indent); maybe_report_diff_for_member(first, second, ctxt, out, indent); diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 5cc39f59..9f4890e8 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -7924,6 +7924,38 @@ typedef_decl* is_typedef(type_base* t) {return dynamic_cast(t);} +/// Test if a type is a enum. This function looks through typedefs. +/// +/// @parm t the type to consider. +/// +/// @return the enum_decl if @p t is a enum_decl or null otherwise. +enum_type_decl_sptr +is_compatible_with_enum_type(const type_base_sptr& t) +{ + if (!t) + return enum_type_decl_sptr(); + + // Normally we should strip typedefs entirely, but this is + // potentially costly, especially on binaries with huge changesets + // like the Linux Kernel. So we just get the leaf types for now. + // + // Maybe there should be an option by which users accepts to pay the + // CPU usage toll in exchange for finer filtering? + + // type_base_sptr ty = strip_typedef(t); + type_base_sptr ty = peel_typedef_type(t);; + return is_enum_type(ty); +} + +/// Test if a type is a enum. This function looks through typedefs. +/// +/// @parm t the type to consider. +/// +/// @return the enum_decl if @p t is a enum_decl or null otherwise. +enum_type_decl_sptr +is_compatible_with_enum_type(const decl_base_sptr& t) +{return is_compatible_with_enum_type(is_type(t));} + /// Test if a decl is an enum_type_decl /// /// @param d the decl to test for. @@ -8307,6 +8339,50 @@ look_through_decl_only_class(class_or_union_sptr klass) return result; } +/// If a enum is a decl-only enum, get its definition. +/// Otherwise, just return the initial enum. +/// +/// @param the_enum the enum to consider. +/// +/// @return either the definition of the enum, or the enum itself. +enum_type_decl_sptr +look_through_decl_only_enum(const enum_type_decl& the_enum) +{ + enum_type_decl_sptr enom; + if (the_enum.get_is_declaration_only()) + enom = the_enum.get_definition_of_declaration(); + + if (!enom) + return enom; + + while (enom + && enom->get_is_declaration_only() + && enom->get_definition_of_declaration()) + enom = enom->get_definition_of_declaration(); + + ABG_ASSERT(enom); + return enom; +} + +/// If a enum is a decl-only enum, get its definition. +/// Otherwise, just return the initial enum. +/// +/// @param enom the enum to consider. +/// +/// @return either the definition of the enum, or the enum itself. +enum_type_decl_sptr +look_through_decl_only_enum(enum_type_decl_sptr enom) +{ + if (!enom) + return enom; + + enum_type_decl_sptr result = look_through_decl_only_enum(*enom); + if (!result) + result = enom; + + return result; +} + /// Tests if a declaration is a variable declaration. /// /// @param decl the decl to test. @@ -10165,6 +10241,37 @@ lookup_enum_type(const interned_string& qualified_name, const corpus& corp) return result; } +/// Look into a given corpus to find the enum type*s* that have a +/// given qualified name. +/// +/// @param qualified_name the qualified name of the type to look for. +/// +/// @param corp the corpus to look into. +/// +/// @return the vector of enum types that which name is @p qualified_name. +const type_base_wptrs_type * +lookup_enum_types(const interned_string& qualified_name, const corpus& corp) +{ + const istring_type_base_wptrs_map_type& m = corp.get_types().enum_types(); + + return lookup_types_in_map(qualified_name, m); +} + +/// Look into a given corpus to find the enum type*s* that have a +/// given qualified name. +/// +/// @param qualified_name the qualified name of the type to look for. +/// +/// @param corp the corpus to look into. +/// +/// @return the vector of enum types that which name is @p qualified_name. +const type_base_wptrs_type* +lookup_enum_types(const string& qualified_name, const corpus& corp) +{ + interned_string s = corp.get_environment()->intern(qualified_name); + return lookup_enum_types(s, corp); +} + /// Look up an @ref enum_type_decl from a given corpus, by its location. /// /// @param loc the location to consider. @@ -14974,17 +15081,26 @@ class enum_type_decl::priv { type_base_sptr underlying_type_; enumerators enumerators_; + decl_base_sptr declaration_; + enum_type_decl_wptr definition_of_declaration_; + enum_type_decl* naked_definition_of_declaration_; + bool is_declaration_only_; friend class enum_type_decl; - priv(); - public: + priv() + : naked_definition_of_declaration_(), + is_declaration_only_(true) + {} + priv(type_base_sptr underlying_type, enumerators& enumerators) : underlying_type_(underlying_type), - enumerators_(enumerators) + enumerators_(enumerators), + naked_definition_of_declaration_(), + is_declaration_only_(false) {} }; // end class enum_type_decl::priv @@ -15040,6 +15156,80 @@ enum_type_decl::enumerators& enum_type_decl::get_enumerators() {return priv_->enumerators_;} +/// Set the definition of this declaration-only @ref enum_type_decl. +/// +/// @param d the new definition to set. +void +enum_type_decl::set_definition_of_declaration(enum_type_decl_sptr d) +{ + ABG_ASSERT(get_is_declaration_only()); + priv_->definition_of_declaration_ = d; + if (d->get_canonical_type()) + type_base::priv_->canonical_type = d->get_canonical_type(); + + priv_->naked_definition_of_declaration_ = d.get(); +} + +/// If this @ref enum_type_decl_sptr is declaration-only, get its +/// definition, if any. +/// +/// @return the definition of this decl-only enum. +const enum_type_decl_sptr +enum_type_decl::get_definition_of_declaration() const +{ + if (priv_->definition_of_declaration_.expired()) + return enum_type_decl_sptr(); + return enum_type_decl_sptr(priv_->definition_of_declaration_); +} + +/// If this @ref enum_type_decl is declaration-only, get its +/// definition, if any. +/// +/// Note that this function doesn't return a smart pointer, but rather +/// the underlying pointer managed by the smart pointer. So it's as +/// fast as possible. This getter is to be used in code paths that are +/// proven to be performance hot spots; especially, when comparing +/// sensitive types like enums. Those are compared extremely frequently +/// and thus, their access to the definition of declaration must be +/// fast. +/// +/// @return the definition of the enum. +const enum_type_decl* +enum_type_decl::get_naked_definition_of_declaration() const +{return priv_->naked_definition_of_declaration_;} + +/// Test if a @ref enum_type_decl is a declaration-only @ref +/// enum_type_decl. +/// +/// @return true iff the current @ref enum_type_decl is a +/// declaration-only @ref enum_type_decl. +bool +enum_type_decl::get_is_declaration_only() const +{return priv_->is_declaration_only_;} + +/// Set a flag saying if the @ref enum_type_decl is a declaration-only +/// @ref enum_type_decl. +/// +/// @param f true if the @ref enum_type_decl is a decalaration-only +/// @ref enum_type_decl. +void +enum_type_decl::set_is_declaration_only(bool f) +{ + bool update_types_lookup_map = !f && priv_->is_declaration_only_; + + priv_->is_declaration_only_ = f; + + if (update_types_lookup_map) + if (scope_decl* s = get_scope()) + { + scope_decl::declarations::iterator i; + if (s->find_iterator_for_member(this, i)) + maybe_update_types_lookup_map(*i); + else + ABG_ASSERT_NOT_REACHED; + } +} + /// Get the pretty representation of the current instance of @ref /// enum_type_decl. /// From patchwork Wed Jun 10 11:59: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: 39553 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 964D9386EC42; Wed, 10 Jun 2020 12:00:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 964D9386EC42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790400; bh=a5B2FZST6GceWyyKZsyuGMfVNEkH58yGGW9hjY+TkEY=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=aqi8PXF4m0MtgPj2oukxmOT4L9uekU5BRM02XppUPvArj4xeOImBx3kEEvih1CN/F aK7WrkNvWBuiWABkcAU2RKrHGkd2A4rjXOT5i4ektt/kuVxVt5Q9p5mx7Gs3TeZqIM dTu61haUalyXZHbKxY/FZeu44+vbH3ZDoBkkdleE= 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 BB6DF3851C11 for ; Wed, 10 Jun 2020 11:59:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BB6DF3851C11 Received: by mail-qt1-x84a.google.com with SMTP id o11so1628577qtm.7 for ; Wed, 10 Jun 2020 04:59:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=a5B2FZST6GceWyyKZsyuGMfVNEkH58yGGW9hjY+TkEY=; b=WEhDmckTLMS0NDmx0c+uAOJzilNxUgBSN+4nTeLefSYjAYPN17Rl0iK0fJL4ooSxir JFeqoLoTVkysE7UGuJwk1IAwLUhliksUwzBU6YOqgloGH61jeSq7NoDF8DZXnS9EigRD 1jq1ze/d84LbSG68QmrlJLHhUCiFKYS5Uhy8ICLnxanxyshiWz3J0RMMdg6xein14H4r 1EZJg6LcvbQk3NV5k8jeWVVcfZG1xJeOWiLrV8tR6bcdMqE2wzsud/cW6vT7eRROpuZh dL2fQpv33/XwWruMJJ1MjlwUTeUX3/0/O2V71JO+Ittdf4ztY9wWr+8NUl6UNz1FjfGu mw0A== X-Gm-Message-State: AOAM531SrPVQLPY4qbNXXBRP87OPokyoCc94CpkAObgPQeiNvU4gdd6U YsY4d2bMGqfBXR66C4YFdFtV5yyuHupgvZl4e7ukd/J0nLemTcC8LZk/cim3Vx+l1ahwNXFlGux p6bKRlw/an1pILvunvOMHDi0M60Lv7JaOYnYts/8uqi8byMUbgeOywKt6AyJ5dpmzaLKbRzk= X-Google-Smtp-Source: ABdhPJxBeD3t4fX7l8XRIftuttz+KzbToFaToBmsqNAgfBV0GAHAUmVKLttICbZb8RjlBpoHxJt5t+H8D7q4yg== X-Received: by 2002:a0c:e385:: with SMTP id a5mr2794560qvl.218.1591790398250; Wed, 10 Jun 2020 04:59:58 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:36 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-8-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 07/11] Add invariant to enum_type_decl::set_is_declaration_only To: libabigail@sourceware.org X-Spam-Status: No, score=-23.5 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, Dodji Seketeli , gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" From: Dodji Seketeli A declaration-only enum can't have enumerators, so let's enact that invariant. * src/abg-ir.cc (enum_type_decl::set_is_declaration_only): assert that a declaration-only enum can't have enumerator. Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida --- src/abg-ir.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 9f4890e8..4aaf3cca 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -15228,6 +15228,10 @@ enum_type_decl::set_is_declaration_only(bool f) else ABG_ASSERT_NOT_REACHED; } + + // A decl-only enum can't have enumerators. + if (priv_->is_declaration_only_ && !get_enumerators().empty()) + ABG_ASSERT_NOT_REACHED; } /// Get the pretty representation of the current instance of @ref From patchwork Wed Jun 10 11:59:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39554 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 1730C388C00E; Wed, 10 Jun 2020 12:00:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1730C388C00E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790404; bh=M0ULW6O7pAnMRtQyYYRTN0IUW4983/NPDDUqyUMBizI=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=k3199VQQkYKIiHOj55927DKXj8cm2K8f6G4Wx9la7rmSVbgE8U4NItVk/X6dKZueG DuDnPknzQK2Te2DRM0V7rfAS9AV92ZS5ubmEXcttGgR5bkiEMAlQ6rFeDN7UDYBjdc fNT88FRP/JrJ5/t2HShdsxqV4MZeMwWeRxf5mv7M= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by sourceware.org (Postfix) with ESMTPS id CE78B388C038 for ; Wed, 10 Jun 2020 12:00:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CE78B388C038 Received: by mail-qv1-xf49.google.com with SMTP id r15so1583393qvv.5 for ; Wed, 10 Jun 2020 05:00:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=M0ULW6O7pAnMRtQyYYRTN0IUW4983/NPDDUqyUMBizI=; b=DMiSO34ecHiO2r4PskQSx9h7Y52hqnnrLoSH5BCqCbOJkREBwvHPFEHpKVLGHsWNOn huSTADVNBQSMmTlNvdDPabzhd0yf0goVAOhhup2eIsl/4/i04T1jUb4Q5oqZArbAjfbs FLtu7gP0b1iIn1l+1yCLiKsWs9q2EGpiUn0cyy1556Gy9sbndeboV+nzho44hIVJVe57 q9ZmZ9d9R94U5hcPk8nJW448b5bvt7mguFJeb8dK9yjKm9EZoEruN6WZs8ZoIraMH35K TSCn839Epi3tgbX3lUB1xSJdVqtAZhwMTIhAaTDAtXGHhkLSzXNStQpmCQfHNmwqIE9E Oa/A== X-Gm-Message-State: AOAM530NSTe/EBWZP4Q6wVucNdrh+7/8NWUQUsm5IXGLBxmE57WZvXy4 pin1wvOgpDsI62RvDqgFLG3w1aI61vTbQmfjnPiXDYzbty7H1ZZleMGwxypvLC6D+B62lXKAeEl CDNWK/RmKYbyjTbazHj69GL9HW2OIdc2Nm/ApF9PpEgu5cGiE8Hhkghrgn4vK8HiaEosxyYI= X-Google-Smtp-Source: ABdhPJxySYnXGSJCDdoy9Bv0Ld5o0aELl0Qc67V5RDHZ9Z0UfuItF6V8Dk6WYCOCV8OpRpfuUCeQ/tbWsfnu0A== X-Received: by 2002:ad4:4841:: with SMTP id t1mr2766838qvy.187.1591790400249; Wed, 10 Jun 2020 05:00:00 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:37 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-9-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 08/11] Support declaration-only enums in DWARF reader. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.9 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_FILL_THIS_FORM_SHORT, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" This patch adds declaration-only handling enums to the DWARF reader, except for support in get_opaque_version_of_type. Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida --- src/abg-dwarf-reader.cc | 238 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 237 insertions(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 9b3e6371..fddfb149 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -198,6 +198,10 @@ typedef unordered_map offset_offset_map_type; /// value is a vector of smart pointer to a class. typedef unordered_map string_classes_map; +/// Convenience typedef for a map which key is a string and which +/// value is a vector of smart pointer to a enum. +typedef unordered_map string_enums_map; + /// The abstraction of the place where a partial unit has been /// imported. This is what the DW_TAG_imported_unit DIE expresses. /// @@ -2282,6 +2286,7 @@ public: vector type_unit_types_to_canonicalize_; vector extra_types_to_canonicalize_; string_classes_map decl_only_classes_map_; + string_enums_map decl_only_enums_map_; die_tu_map_type die_tu_map_; corpus_group_sptr cur_corpus_group_; corpus_sptr cur_corpus_; @@ -4621,6 +4626,203 @@ public: } } + /// Getter for the map of declaration-only enums that are to be + /// resolved to their definition enums by the end of the corpus + /// loading. + /// + /// @return a map of string -> vector of enums where the key is + /// the fully qualified name of the enum and the value is the + /// vector of declaration-only enum. + const string_enums_map& + declaration_only_enums() const + {return decl_only_enums_map_;} + + /// Getter for the map of declaration-only enums that are to be + /// resolved to their definition enums by the end of the corpus + /// loading. + /// + /// @return a map of string -> vector of enums where the key is + /// the fully qualified name of the enum and the value is the + /// vector of declaration-only enum. + string_enums_map& + declaration_only_enums() + {return decl_only_enums_map_;} + + /// If a given enum is a declaration-only enum then stash it on + /// the side so that at the end of the corpus reading we can resolve + /// it to its definition. + /// + /// @param enom the enum to consider. + void + maybe_schedule_declaration_only_enum_for_resolution(enum_type_decl_sptr& enom) + { + if (enom->get_is_declaration_only() + && enom->get_definition_of_declaration() == 0) + { + string qn = enom->get_qualified_name(); + string_enums_map::iterator record = + declaration_only_enums().find(qn); + if (record == declaration_only_enums().end()) + declaration_only_enums()[qn].push_back(enom); + else + record->second.push_back(enom); + } + } + + /// Test if a given declaration-only enum has been scheduled for + /// resolution to a defined enum. + /// + /// @param enom the enum to consider for the test. + /// + /// @return true iff @p enom is a declaration-only enum and if + /// it's been scheduled for resolution to a defined enum. + bool + is_decl_only_enum_scheduled_for_resolution(enum_type_decl_sptr& enom) + { + if (enom->get_is_declaration_only()) + return (declaration_only_enums().find(enom->get_qualified_name()) + != declaration_only_enums().end()); + + return false; + } + + /// Walk the declaration-only enums that have been found during + /// the building of the corpus and resolve them to their definitions. + void + resolve_declaration_only_enums() + { + vector resolved_enums; + + for (string_enums_map::iterator i = + declaration_only_enums().begin(); + i != declaration_only_enums().end(); + ++i) + { + bool to_resolve = false; + for (enums_type::iterator j = i->second.begin(); + j != i->second.end(); + ++j) + if ((*j)->get_is_declaration_only() + && ((*j)->get_definition_of_declaration() == 0)) + to_resolve = true; + + if (!to_resolve) + { + resolved_enums.push_back(i->first); + continue; + } + + // Now, for each decl-only enum that have the current name + // 'i->first', let's try to poke at the fully defined enum + // that is defined in the same translation unit as the + // declaration. + // + // If we find one enum (defined in the TU of the declaration) + // that defines the declaration, then the declaration can be + // resolved to that enum. + // + // If no defining enum is found in the TU of the declaration, + // then there are possibly three cases to consider: + // + // 1/ There is exactly one enum that defines the + // declaration and that enum is defined in another TU. In + // this case, the declaration is resolved to that + // definition. + // + // 2/ There are more than one enum that define that + // declaration and none of them is defined in the TU of the + // declaration. In this case, the declaration is left + // unresolved. + // + // 3/ No enum defines the declaration. In this case, the + // declaration is left unresoved. + + // So get the enums that might define the current + // declarations which name is i->first. + const type_base_wptrs_type *enums = + lookup_enum_types(i->first, *current_corpus()); + if (!enums) + continue; + + unordered_map per_tu_enum_map; + for (type_base_wptrs_type::const_iterator c = enums->begin(); + c != enums->end(); + ++c) + { + enum_type_decl_sptr enom = is_enum_type(type_base_sptr(*c)); + ABG_ASSERT(enom); + + enom = is_enum_type(look_through_decl_only_enum(enom)); + if (enom->get_is_declaration_only()) + continue; + + string tu_path = enom->get_translation_unit()->get_absolute_path(); + if (tu_path.empty()) + continue; + + // Build a map that associates the translation unit path + // to the enum (that potentially defines the declarations + // that we consider) that are defined in that translation unit. + per_tu_enum_map[tu_path] = enom; + } + + if (!per_tu_enum_map.empty()) + { + // Walk the declarations to resolve and resolve them + // either to the definitions that are in the same TU as + // the declaration, or to the definition found elsewhere, + // if there is only one such definition. + for (enums_type::iterator j = i->second.begin(); + j != i->second.end(); + ++j) + { + if ((*j)->get_is_declaration_only() + && ((*j)->get_definition_of_declaration() == 0)) + { + string tu_path = + (*j)->get_translation_unit()->get_absolute_path(); + unordered_map::const_iterator e = + per_tu_enum_map.find(tu_path); + if (e != per_tu_enum_map.end()) + (*j)->set_definition_of_declaration(e->second); + else if (per_tu_enum_map.size() == 1) + (*j)->set_definition_of_declaration + (per_tu_enum_map.begin()->second); + } + } + resolved_enums.push_back(i->first); + } + } + + size_t num_decl_only_enums = declaration_only_enums().size(), + num_resolved = resolved_enums.size(); + if (show_stats()) + cerr << "resolved " << num_resolved + << " enum declarations out of " + << num_decl_only_enums + << "\n"; + + for (vector::const_iterator i = resolved_enums.begin(); + i != resolved_enums.end(); + ++i) + declaration_only_enums().erase(*i); + + for (string_enums_map::iterator i = declaration_only_enums().begin(); + i != declaration_only_enums().end(); + ++i) + { + if (show_stats()) + { + if (i == declaration_only_enums().begin()) + cerr << "Here are the " + << num_decl_only_enums - num_resolved + << " unresolved enum declarations:\n"; + else + cerr << " " << i->first << "\n"; + } + } + } + /// Some functions described by DWARF may have their linkage name /// set, but no link to their actual underlying elf symbol. When /// these are virtual member functions, comparing the enclosing type @@ -13283,6 +13485,7 @@ build_enum_type(read_context& ctxt, string name, linkage_name; location loc; die_loc_and_name(ctxt, die, loc, name, linkage_name); + bool is_declaration_only = die_is_declaration_only(die); bool is_anonymous = false; // If the enum is anonymous, let's give it a name. @@ -13385,8 +13588,12 @@ build_enum_type(read_context& ctxt, ABG_ASSERT(t); result.reset(new enum_type_decl(name, loc, t, enms, linkage_name)); result->set_is_anonymous(is_anonymous); + result->set_is_declaration_only(is_declaration_only); result->set_is_artificial(is_artificial); ctxt.associate_die_to_type(die, result, where_offset); + + ctxt.maybe_schedule_declaration_only_enum_for_resolution(result); + return result; } @@ -16125,6 +16332,24 @@ read_debug_info_into_corpus(read_context& ctxt) } } + { + tools_utils::timer t; + if (ctxt.do_log()) + { + cerr << "resolving declaration only enums ..."; + t.start(); + } + ctxt.resolve_declaration_only_enums(); + if (ctxt.do_log()) + { + t.stop(); + cerr << " DONE@" << ctxt.current_corpus()->get_path() + << ":" + << t + <<"\n"; + } + } + { tools_utils::timer t; if (ctxt.do_log()) @@ -16559,7 +16784,18 @@ build_ir_node_from_die(read_context& ctxt, case DW_TAG_enumeration_type: { - if (!type_is_suppressed(ctxt, scope, die)) + bool type_is_private = false; + bool type_suppressed = + type_is_suppressed(ctxt, scope, die, type_is_private); + if (type_suppressed && type_is_private) + // The type is suppressed because it's private. If other + // non-suppressed and declaration-only instances of this + // type exist in the current corpus, then it means those + // non-suppressed instances are opaque versions of the + // suppressed private type. Lets return one of these opaque + // types then. + result = get_opaque_version_of_type(ctxt, scope, die, where_offset); + else if (!type_suppressed) { enum_type_decl_sptr e = build_enum_type(ctxt, die, scope, where_offset); From patchwork Wed Jun 10 11:59:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39555 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 3AF0C388F055; Wed, 10 Jun 2020 12:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AF0C388F055 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790413; bh=hahTzwAafzfbQD/mR9BtU6O2NLDp2d4QwGk46dDlPXA=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ivvrC/jqF8GR4P/JuqmTnSAjrJVypKvVF9moUi1ze+eSgsYKRovomZWQ1hl3insF4 hOvB5s47cPP/iKOoV+edg6XH8NqnJASKC4yGq1uFTogMoc39qMdhQd7S+R/HEeA2ss VSaNVOmdeZNbPRBUMHAni5YDf6uHSLV+dddgfzRs= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by sourceware.org (Postfix) with ESMTPS id D93EC3851C11 for ; Wed, 10 Jun 2020 12:00:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D93EC3851C11 Received: by mail-yb1-xb49.google.com with SMTP id e20so1897122ybc.23 for ; Wed, 10 Jun 2020 05:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hahTzwAafzfbQD/mR9BtU6O2NLDp2d4QwGk46dDlPXA=; b=pQNZ5YADCPvw88TdGRa3SXIyOW1uOhRQW9DKD05/5hkTfm4hbQUIJCxqF6hKDWLOmO PQd3hLtExXUyDkdWvJMAybcc6iMCIxq1qd8KBMlOwYILslmoH7sna1IersrQU5/4SFVJ Ry6pYz4I44w9QSBgo5I+ewRDwBX2BMoMyTK7L81zze1SZrAjzsK8uxx2+GV9U07BJ0db cmTW7dpL7/MgDVeFQvVPIWEvOMOgha4HSMnKtBp/mXtVi1r6f84uU1KSXAeN2ujkDoXk XhrV3BpvglYAiZ5R+N2dD3OD8/pbczFG46c/pZ4QH9v4vyfsffDno5tTLWZlJylNyzea H19Q== X-Gm-Message-State: AOAM532Edbv+quFbspZrGSNqXr9M33hZWnAl8s0PNCVg2tElPA2iZKTi qm2z+YIfISQ++SiTeRPA0Sn9j1ze/cW+bpmKLnqJ/hRhY9xwWWu2tWQKxlM6kevFn2eovc6986U onbZcLSg9/6jQkSYOdpCZKoVBdPgMuWeufiy8Aj87mDVEHCAQGStZkLNbPrbPtwMevqMBOj4= X-Google-Smtp-Source: ABdhPJwFoapdMU/q84M8qH0qUWWunydhlv609fItu+eH6a5fvXuwRkqASic7MssqqePC21oZ5PtSeIaZcFieXA== X-Received: by 2002:a5b:346:: with SMTP id q6mr5231575ybp.472.1591790402328; Wed, 10 Jun 2020 05:00:02 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:38 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-10-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 09/11] Support constructing opaque types for enums To: libabigail@sourceware.org X-Spam-Status: No, score=-24.5 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, Dodji Seketeli , gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" From: Dodji Seketeli Now that we are to support opaque types for enums, we ought to support building opaque types for enums as well, to mimic the opaque type design pattern used in C, when private types are specified with type suppression specifications. The core of this change is to make get_opaque_version_of_type work for enums as well, just like what it does for classes. Note that that function doesn't support opaque unions yet either. That should be added at a later point in time, I guess. * src/abg-dwarf-reader.cc (build_internal_underlying_enum_type_name) (build_enum_underlying_type): Factorize these functions out of ... (build_enum_type): ... here. (get_opaque_version_of_type): Make this handle enums as well. So make its return type be type_or_decl_base_sptr, rather than just class_or_union_sptr as it used to be. Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida --- src/abg-dwarf-reader.cc | 139 +++++++++++++++++++++++++++++++--------- 1 file changed, 109 insertions(+), 30 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index fddfb149..6b71c1ab 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -438,11 +438,14 @@ static string build_internal_anonymous_die_name(const string &base_name, size_t anonymous_type_index); - static string get_internal_anonymous_die_name(Dwarf_Die *die, size_t anonymous_type_index); +static string +build_internal_underlying_enum_type_name(const string &base_name, + bool is_anonymous); + static string die_qualified_type_name(const read_context& ctxt, const Dwarf_Die* die, @@ -10943,6 +10946,29 @@ build_internal_anonymous_die_name(const string &base_name, return name; } +/// Build the internal name of the underlying type of an enum. +/// +/// @param base_name the (unqualified) name of the enum the underlying +/// type is destined to. +/// +/// @param is_anonymous true if the underlying type of the enum is to +/// be anonymous. +static string +build_internal_underlying_enum_type_name(const string &base_name, + bool is_anonymous = true) +{ + std::ostringstream o; + + if (is_anonymous) + o << "unnamed-enum"; + else + o << "enum-" << base_name; + + o << "-underlying-type"; + + return o.str(); +} + /// Build a full internal anonymous type name. /// /// @param die the DIE representing the anonymous type to consider. @@ -13457,6 +13483,39 @@ build_type_decl(read_context& ctxt, Dwarf_Die* die, size_t where_offset) return result; } +/// Construct the type that is to be used as the underlying type of an +/// enum. +/// +/// @param ctxt the read context to use. +/// +/// @param enum_name the name of the enum that this type is going to +/// be the underlying type of. +/// +/// @param enum_size the size of the enum. +/// +/// @param is_anonymous whether the underlying type is anonymous or +/// not. By default, this should be set to true as before c++11 (and +/// in C), it's almost the case. +static type_decl_sptr +build_enum_underlying_type(read_context& ctxt, + string enum_name, + uint64_t enum_size, + bool is_anonymous = true) +{ + string underlying_type_name = + build_internal_underlying_enum_type_name(enum_name, is_anonymous); + + type_decl_sptr result(new type_decl(ctxt.env(), underlying_type_name, + enum_size, enum_size, location())); + result->set_is_anonymous(is_anonymous); + translation_unit_sptr tu = ctxt.cur_transl_unit(); + decl_base_sptr d = add_decl_to_scope(result, tu->get_global_scope().get()); + result = dynamic_pointer_cast(d); + ABG_ASSERT(result); + canonicalize(result); + return result; +} + /// Build an enum_type_decl from a DW_TAG_enumeration_type DIE. /// /// @param ctxt the read context to use. @@ -13543,15 +13602,6 @@ build_enum_type(read_context& ctxt, // for now we consider that underlying types of enums are all anonymous bool enum_underlying_type_is_anonymous= true; - string underlying_type_name; - if (enum_underlying_type_is_anonymous) - { - underlying_type_name = "unnamed-enum"; - enum_underlying_type_is_anonymous = true; - } - else - underlying_type_name = string("enum-") + name; - underlying_type_name += "-underlying-type"; enum_type_decl::enumerators enms; Dwarf_Die child; @@ -13576,16 +13626,10 @@ build_enum_type(read_context& ctxt, // underlying type, so let's create an artificial one here, which // sole purpose is to be passed to the constructor of the // enum_type_decl type. - type_decl_sptr t(new type_decl(ctxt.env(), underlying_type_name, - size, size, location())); - t->set_is_anonymous(enum_underlying_type_is_anonymous); - translation_unit_sptr tu = ctxt.cur_transl_unit(); - decl_base_sptr d = - add_decl_to_scope(t, tu->get_global_scope().get()); - canonicalize(t); + type_decl_sptr t = + build_enum_underlying_type(ctxt, name, size, + enum_underlying_type_is_anonymous); - t = dynamic_pointer_cast(d); - ABG_ASSERT(t); result.reset(new enum_type_decl(name, loc, t, enms, linkage_name)); result->set_is_anonymous(is_anonymous); result->set_is_declaration_only(is_declaration_only); @@ -15858,7 +15902,8 @@ type_is_suppressed(const read_context& ctxt, /// a private type. /// /// The opaque version version of the type is just a declared-only -/// version of the type (class or union type) denoted by @p type_die. +/// version of the type (class, union or enum type) denoted by @p +/// type_die. /// /// @param ctxt the read context in use. /// @@ -15873,13 +15918,13 @@ type_is_suppressed(const read_context& ctxt, /// /// @return the opaque version of the type denoted by @p type_die or /// nil if no opaque version was found. -static class_or_union_sptr +static type_or_decl_base_sptr get_opaque_version_of_type(read_context &ctxt, scope_decl *scope, Dwarf_Die *type_die, size_t where_offset) { - class_or_union_sptr result; + type_or_decl_base_sptr result; if (type_die == 0) return result; @@ -15887,7 +15932,14 @@ get_opaque_version_of_type(read_context &ctxt, unsigned tag = dwarf_tag(type_die); if (tag != DW_TAG_class_type && tag != DW_TAG_structure_type - && tag != DW_TAG_union_type) + && tag != DW_TAG_union_type + && 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; @@ -15898,17 +15950,19 @@ get_opaque_version_of_type(read_context &ctxt, string qualified_name = build_qualified_name(scope, type_name); + // // 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. - string_classes_map::const_iterator i = - ctxt.declaration_only_classes().find(qualified_name); - if (i != ctxt.declaration_only_classes().end()) - result = i->second.back(); - - if (!result) + // + if (tag == DW_TAG_structure_type || tag == DW_TAG_class_type) { - if (tag == DW_TAG_class_type || tag == DW_TAG_structure_type) + string_classes_map::const_iterator i = + ctxt.declaration_only_classes().find(qualified_name); + if (i != ctxt.declaration_only_classes().end()) + result = i->second.back(); + + if (!result) { // So we didn't find any pre-existing forward-declared-only // class for the class definition that we could return as an @@ -15928,6 +15982,31 @@ get_opaque_version_of_type(read_context &ctxt, } } + if (tag == DW_TAG_enumeration_type) + { + string_enums_map::const_iterator i = + ctxt.declaration_only_enums().find(qualified_name); + if (i != ctxt.declaration_only_enums().end()) + result = i->second.back(); + + if (!result) + { + uint64_t size = 0; + if (die_unsigned_constant_attribute(type_die, DW_AT_byte_size, size)) + size *= 8; + type_decl_sptr underlying_type = + build_enum_underlying_type(ctxt, type_name, size, + /*anonymous=*/true); + enum_type_decl::enumerators enumeratorz; + enum_type_decl_sptr enum_type (new enum_type_decl(type_name, + type_location, + underlying_type, + enumeratorz, + linkage_name)); + result = enum_type; + } + } + return result; } From patchwork Wed Jun 10 11:59:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39556 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 7F0EC3898509; Wed, 10 Jun 2020 12:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F0EC3898509 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790413; bh=23iEIPcotkpB4ELsvqaVuHbbf6lf2uZyjiDlVALpqWA=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Rf6KwO1yFgCPNW/Tqpd6W0zDJip/3/D66CIftj0G67T6wfkxXzjZGtUtW4nesymOs n1hc8lZRuJQe/4smu/GROAJVB8IA8E7OqOYRuriTmItGtw0tl1BhzQkgHQ1Q/Erufn MHHp3FcK2j6PKFbYs/WbrS8VUYKLFu5VhliUlCdE= 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 EC476388E803 for ; Wed, 10 Jun 2020 12:00:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC476388E803 Received: by mail-qt1-x84a.google.com with SMTP id o11so1628980qtm.7 for ; Wed, 10 Jun 2020 05:00:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=23iEIPcotkpB4ELsvqaVuHbbf6lf2uZyjiDlVALpqWA=; b=Bv8sAGhD7LkpjKLs6VeQ2MksVG5nTrURA1BipMh4YHTPKeFfgyNnmyUVpIT+EHdPv9 5J4zo63K2rJcMmswYbDxp+OWXjKQ2G4RFGBSV8jcvPvJYbeC2B4FUzfs2+fZOzG4m4HY BdzrXssCDAdhJl6rmjoYu/sUCEStVCW932noFb1rToq2t2SzNn9/nJlUwhw1Plvr6Mk3 iES0Xax91Ftrhx00bxinMphpi3k28+Ga6Ps3sSXXJbyepUDn+6ybQgwDnqRQ3qqkcefW 5cssrH/hsMU3qah4OwVL6O4bGEzoXZZNSKl7POrWzAanh4AtoNhAADe60HMejeYyax+C Y8ag== X-Gm-Message-State: AOAM531Na427i9aQOm2B/8tbNpocy0tmYL6UhZx+tr+iCsZ0GIu5KncU 2rJdZ2DF+bsHOMX4f6X3+rMJv9BlRwtJMR/I2p43Yn6BY4FK1Okqc7fhJTtCjjQK6KN9uVUTJBn 2uKmpBCws3IWSX7kIZD2ku3V+gbOxP3juszqvX6IQHdGL4g18VAVjN5wK/aFKQITHuxezcsA= X-Google-Smtp-Source: ABdhPJzIQtdGG3iSODilgzmEldnf/LUJDWOjvZXXVwzdafx2Y2uhXINQjeFwuhHUyJr1ExpF5M5+AQNQW48s4g== X-Received: by 2002:a05:6214:1447:: with SMTP id b7mr2799747qvy.83.1591790404375; Wed, 10 Jun 2020 05:00:04 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:39 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-11-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 10/11] Add declaration-only enums to XML reader/writer. To: libabigail@sourceware.org X-Spam-Status: No, score=-23.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Serialisation seems OK. Deserialisation quite likely needs declaration/definition resolution as there is logic for this for class types. Signed-off-by: Giuliano Procida Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 4 ++++ src/abg-writer.cc | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index eb74659f..62eda332 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -4161,6 +4161,9 @@ build_enum_type_decl(read_context& ctxt, location loc; read_location(ctxt, node, loc); + bool is_decl_only = false; + read_is_declaration_only(node, is_decl_only); + bool is_anonymous = false; read_is_anonymous(node, is_anonymous); @@ -4221,6 +4224,7 @@ build_enum_type_decl(read_context& ctxt, enums, linkage_name)); t->set_is_anonymous(is_anonymous); t->set_is_artificial(is_artificial); + t->set_is_declaration_only(is_decl_only); // TODO: more to do here! if (ctxt.push_and_key_type_decl(t, id, add_to_current_scope)) { ctxt.map_xml_node_to_decl(node, t); diff --git a/src/abg-writer.cc b/src/abg-writer.cc index bafa3024..38320867 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -840,6 +840,8 @@ static bool write_elf_symbol_reference(const elf_symbol&, ostream&); static bool write_elf_symbol_reference(const elf_symbol_sptr, ostream&); static void write_class_or_union_is_declaration_only(const class_or_union_sptr&, ostream&); +static void write_enum_is_declaration_only(const enum_type_decl_sptr&, + ostream&); static void write_is_struct(const class_decl_sptr&, ostream&); static void write_is_anonymous(const decl_base_sptr&, ostream&); static void write_naming_typedef(const class_decl_sptr&, write_context&); @@ -1754,6 +1756,20 @@ write_class_or_union_is_declaration_only(const class_or_union_sptr& t, o << " is-declaration-only='yes'"; } +/// Serialize the attribute "is-declaration-only", if the enum has its +/// is_declaration_only property set. +/// +/// @param t the pointer to instance of @ref enum_type_decl to +/// consider. +/// +/// @param o the output stream to serialize to. +static void +write_enum_is_declaration_only(const enum_type_decl_sptr& t, ostream& o) +{ + if (t->get_is_declaration_only()) + o << " is-declaration-only='yes'"; +} + /// Serialize the attribute "is-struct", if the current instance of /// class_decl is a struct. /// @@ -2889,6 +2905,7 @@ write_enum_type_decl(const enum_type_decl_sptr& decl, o << " linkage-name='" << decl->get_linkage_name() << "'"; write_location(decl, ctxt); + write_enum_is_declaration_only(decl, o); string i = id; if (i.empty()) From patchwork Wed Jun 10 11:59:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39557 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 C3FEB3898512; Wed, 10 Jun 2020 12:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3FEB3898512 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591790413; bh=4ORob4PpWtKUu1p5jWRtkM0IY1hcT0ZqZfb+TCROns8=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=oeTV3qRelrVSb7h/fgW76m4aT5TFKJYCEkTpQjz4b+TjmCwOPiG5QN170QvkiN/dr SytgZ7fIX3qzn6M4UggVEarX33BnXW85WL6WnJgvfGUH8OWRPNORaKTfQwif52QAM5 h3vwKPzGLvJZq5pn9T1q0U88hfk5j9jtDcp+6JUo= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by sourceware.org (Postfix) with ESMTPS id 07BA9388F06E for ; Wed, 10 Jun 2020 12:00:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 07BA9388F06E Received: by mail-qv1-xf4a.google.com with SMTP id j4so1551018qvt.20 for ; Wed, 10 Jun 2020 05:00:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=4ORob4PpWtKUu1p5jWRtkM0IY1hcT0ZqZfb+TCROns8=; b=YK9IBAyZ/ZFzil227CI77UualEFB7boOdNoMBg55sz8TRqq4R6LF3uLJ5vMcXZiyFW BIh1iD5MB46RFUHDVbheWtxY2pIGcyvf+txTr/AMkCojLx9PdWT+0JoWvwTHnjAhBRDf b1/KmnE1khOEFlLIJaOcN7+aSX2d57T15Hjcwdim6OI2m4ayb1C8w/KdL54ki3Z8C2C5 wKwzgEOXS3u4j8PXg3CLqhF0Lp7u4tWlcFZt/N+EnDXGgU51Mt1jSV/ExmT3nlLJihMT lCtiNND7CrgtJXGGYpzO3Rr6hDbFsg+4fvJMwEWZzahxmKx4S2WzEjxdTC9b13SXyC81 oWlQ== X-Gm-Message-State: AOAM532+VJPAHJms7TFMgw29BanIzISEHmRIWl4YK61c9sTjEOMdLeKI e9qr5bVIHhCrYBVD5YJrpkLdxacaHU/14CoO7jn6LmxgLHVd9vXflf7ei9IgXSmLuvAhwie+p4l /4DdRjl3Qm5XsAcrEMs35nwPEkRyndtB+LSj1sSc+qW2Ft4v/3ai3PWJOKsj4rBjhzF0N1+s= X-Google-Smtp-Source: ABdhPJwZ2MbqracmQ8GNymUqslMymRjQzMaphwwLk0e7bHb6nMua54LeuSbKHhBOWxKHGJPFL4riHmcyEVzZcw== X-Received: by 2002:a0c:c1c3:: with SMTP id v3mr2754787qvh.222.1591790406521; Wed, 10 Jun 2020 05:00:06 -0700 (PDT) Date: Wed, 10 Jun 2020 12:59:40 +0100 In-Reply-To: <20200610115940.26035-1-gprocida@google.com> Message-Id: <20200610115940.26035-12-gprocida@google.com> Mime-Version: 1.0 References: <20200610115940.26035-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.278.ge193c7cf3a9-goog Subject: [PATCH 11/11] Add tests for declaration-only enums. To: libabigail@sourceware.org X-Spam-Status: No, score=-24.1 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Signed-off-by: Giuliano Procida Signed-off-by: Giuliano Procida Signed-off-by: Dodji Seketeli --- tests/data/Makefile.am | 5 +++++ .../test-decl-enum-report.txt | 17 +++++++++++++++++ .../data/test-abidiff-exit/test-decl-enum-v0.c | 5 +++++ .../data/test-abidiff-exit/test-decl-enum-v0.o | Bin 0 -> 3048 bytes .../data/test-abidiff-exit/test-decl-enum-v1.c | 5 +++++ .../data/test-abidiff-exit/test-decl-enum-v1.o | Bin 0 -> 3048 bytes tests/test-abidiff-exit.cc | 9 +++++++++ 7 files changed, 41 insertions(+) create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-report.txt create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v0.c create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v0.o create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v1.c create mode 100644 tests/data/test-abidiff-exit/test-decl-enum-v1.o diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 6592ba32..7b239682 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -158,6 +158,11 @@ test-abidiff-exit/test-fun-param-v0.o \ test-abidiff-exit/test-fun-param-v1.abi \ test-abidiff-exit/test-fun-param-v1.c \ test-abidiff-exit/test-fun-param-v1.o \ +test-abidiff-exit/test-decl-enum-v0.c \ +test-abidiff-exit/test-decl-enum-v0.o \ +test-abidiff-exit/test-decl-enum-v1.c \ +test-abidiff-exit/test-decl-enum-v1.o \ +test-abidiff-exit/test-decl-enum-report.txt \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ diff --git a/tests/data/test-abidiff-exit/test-decl-enum-report.txt b/tests/data/test-abidiff-exit/test-decl-enum-report.txt new file mode 100644 index 00000000..e46ebfa6 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-decl-enum-report.txt @@ -0,0 +1,17 @@ +Functions changes summary: 0 Removed, 2 Changed, 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +2 functions with some indirect sub-type change: + + [C] 'function void reg1(const embodied_enum*)' at test-decl-enum-v1.c:4:1 has some indirect sub-type changes: + parameter 1 of type 'const embodied_enum*' has sub-type changes: + in pointed to type 'const embodied_enum': + in unqualified underlying type 'enum embodied_enum' at test-decl-enum-v1.c:1:1: + enum type enum embodied_enum was a declaration-only enum type and is now a defined enum type + + [C] 'function void reg2(const disembodied_enum*)' at test-decl-enum-v1.c:5:1 has some indirect sub-type changes: + parameter 1 of type 'const disembodied_enum*' has sub-type changes: + in pointed to type 'const disembodied_enum': + in unqualified underlying type 'enum disembodied_enum': + enum type enum disembodied_enum was a defined enum type and is now a declaration-only enum type + diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v0.c b/tests/data/test-abidiff-exit/test-decl-enum-v0.c new file mode 100644 index 00000000..d5672618 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-decl-enum-v0.c @@ -0,0 +1,5 @@ +enum embodied_enum; +enum disembodied_enum { X }; + +void reg1(const enum embodied_enum * foo) { (void)foo; } +void reg2(const enum disembodied_enum * foo) { (void)foo; } diff --git a/tests/data/test-abidiff-exit/test-decl-enum-v0.o b/tests/data/test-abidiff-exit/test-decl-enum-v0.o new file mode 100644 index 0000000000000000000000000000000000000000..b4c0b06a089ec6adbfa81b1a619ae30087e54f9d GIT binary patch literal 3048 zcmbtWUuzsy6hE^wo1Hk#Hp$xBG=+{(+eDplH%QIaCa$Ko2^OhB#TN;)J2$(7+1WBP zTT?|XqC&xk3W5lt4}JmB7hejZzU!Cp!8d&qe9&`d?%CYjOcC_J+KSmHb@am$eB+q~vtHPqTc9wV6Q4e}KyI}vx)qwOM&$&iJ&Jx5 zVA=x8a&ZBRcpRVne88rfCZwL<1VrX4J|;Yht6}_ApTRZ1Tf77VGLdFpD0;h|h{r?k zX4CKGuGPn2y2ydzvFh>ns{R_T6%)P3aT@hw5xP;Fff#m2VI;zB@`o@=4+2+SyzXwa zo^sp%ir;cqnyq%L)oi=oFdN5WtuJDcL_HLPq&HaGTRrccf712(uD27Ux8mL)8O5V< z>W$+!qB!)jpt~#5(wY;|ZvieV@I*Ge0dQqwi6; zm%-SZH5QN5?7Mh8rx2%yDF3>it_4 z0FI&EymAiQ*(W8=GVlNLMNHoK0ra1=KJuKIaC%E>ETXw$1IBMlnd%~9{EI>aYDyxy zxk=L?zf2$!*{iMU=jeW%MJZFG5^?-O0(eO>jDIF&nutW4m(Sya0-nVAM9Lq@o$aLv z-)i=JgM3z$x5~!2&q`j8)4mVxN}SF{J)e$-bN%3_w}#m4xMxYR517luUIu;`WC8fy zGzC8qyMZ5y?zq1l#XBR^<$TcXCgSD+b&v#cALobavKz&MT`&dsz0q(eaIX3BC=))8 zFE7o4-s{py47PWYU?^na|8t{zr!(Yp=5QU!=mVW>ReBf&!t@F7ifW|ry8k)U(RcY@ z{afg($E0+e|0fa@(ru~V=pR8xu_5*s0+Cjw1AT7M==iQi9wExp9f@ zwGxbMzm)z>5){&Ny@0y1`fYik>`(R6bk*w*5z}KL1V2lV>QhO#-9}|u{#BWu&x!KW zeADyaK#XEG@loltY|^h(5P8ne`&$yz{eO`D^nIzse!RbrO6FC&-_#+YD0EwzgM{hk zze|AUBZuJkXPM?=+4)^7xj*{#Vt+o@vfLDVQ#RB<7EHe2X1gf;sEc>&e)U5_5x4ZH}C!4-}$@u-n@Rb z#26@Ium)pIp#Te&vD^}33+gZnH#hcv+t~Z;ul)~y(!?Lo!xmmuk?e?&HFjK+OC(q9 zP2`MCT*1Nm0GaI}E8C*(1d71QVj$5WhQyxSMPAt+4A8o`hjQu59#qLxvB@-9eSka< zw+q6*Cr=S>pCg&VC#%#0uo?Dzt?pR0`PvMdtxP|MR-0M1HOFx_>zABYou$BJ9tXl4SevZ<#PCR;Jj>0Ns49hK>_0kD|stuI<@*H-3 z6jM+xxIjHoH~FN5L`+}55s1Qd{496@Ib(mV)H7Df-_H0s7YbfY*cOb|vX@3#kG#KSF03)kMh>8>|kahv|K z-*A_g8qG#ysp)$CY#8&^E{}N2_6|?sV14&BDsfnxTfEd{>lM$)No?8xcI{r5N`OjesZIrkihfJ2- za?@a8L=jo?u9-F~Klmn$S+vWnSuL2 z>!5D-Nr@|6jfIDBd?H3Oeg@-5_Z?+bnQ)rrGJZre`2Y%6GorqT6#jLt0^UwRv~#0N zgYsey3xDzcNZr?Ps{2stbWw>^{#*liM+ypmEcN&0sOqZqxM%pEk@~)YeB(^5A5n@_=AiPPHX>(erD)j#;@ojzW39J3@JdrHdqZU%lBWC8f?GzCB5 zJAoha_OQDZ#oGh42{~xD6Mp-EIY@%Ii!X;BvJ=HzgV2eGA~pY91EBY>X#H*!>>vHTRJ>Z(qS};uLtdz!Y?%Hh^baxPX-~|%hY);6 YO(C7mhY>gDPkD>t@5}z5wtp(&zdst)dH?_b literal 0 HcmV?d00001 diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc index 4d9c1943..4fc1eec7 100644 --- a/tests/test-abidiff-exit.cc +++ b/tests/test-abidiff-exit.cc @@ -212,6 +212,15 @@ InOutSpec in_out_specs[] = "data/test-abidiff-exit/test-fun-param-report.txt", "output/test-abidiff-exit/test-fun-param-report.txt" }, + { + "data/test-abidiff-exit/test-decl-enum-v0.o", + "data/test-abidiff-exit/test-decl-enum-v1.o", + "", + "--harmless", + abigail::tools_utils::ABIDIFF_ABI_CHANGE, + "data/test-abidiff-exit/test-decl-enum-report.txt", + "output/test-abidiff-exit/test-decl-enum-report.txt" + }, {0, 0, 0 ,0, abigail::tools_utils::ABIDIFF_OK, 0, 0} };