From patchwork Fri Sep 10 11:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 44923 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 9282F385782D for ; Fri, 10 Sep 2021 11:23:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9282F385782D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631273026; bh=z6id3APP/iqrHuzUzcjZXOHnYweJygyPP3UyQiTJmJQ=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=BLTKR7h6t1LlYokrswO3dMWllT5AZb/l6QSlkheKao2+AKIsbk0js9Mou47i1o2lS cMUJC7fMYxdG7EKEdYxHHZJclm1fbOTj3LBuePUoeeg0sDgI6SgZIBGM8uD4aDoFWU tbuh2/x2v+szHCCqh2muGMSgLVuesHSTuQDsOEHA= 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 08B8F3858404 for ; Fri, 10 Sep 2021 11:23:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 08B8F3858404 Received: by mail-qk1-x74a.google.com with SMTP id h7-20020a37b707000000b003fa4d25d9d0so4371215qkf.17 for ; Fri, 10 Sep 2021 04:23:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=z6id3APP/iqrHuzUzcjZXOHnYweJygyPP3UyQiTJmJQ=; b=DPmrefPPkMbuCMBDIjCb4KYLhsbNnfE0j8w1HcjsvJjwDXCWXUohDxta5hwctvcAXb KAjZD3ix2/xBz7krIW4KFKsN82CblikkT4G0Z4ZRwFkmd22BtQCOhFqo59P16Iwoz4mB w6n48v5fCDuTOOjXqMj3O/RmOKNuEaymCSVQvwaL+NmEuCxssGZENKavtKVQjsYzt8C/ WRrnO2OnBlh9SPqy9FOBk2PjCGFPLF2iF1mNUtFrPnAbmdVpRVeQ4wu3HmMzQb6TJUTb wDdw/niTxmVYP0nbSz9gs7Y0gSwnXNp90bgz5OqOn3yJGR2G7eGoH178Qitxa77x/jbl Yj/w== X-Gm-Message-State: AOAM531xR9rF0pLRVINJmsWa5eoCtgQVRymPGld2qSNCJKPizufGkPpd ISlWiWOFaYGspGoOLCWU4zNggs6SBAkBJxo7xsUxaExtcUh67jVUsm4HomburM/2khgMaZRDxub s/BpNA/t1Pybp/dKO9XK7pgmx0op3SoUL+sKmywWcevMxfrUZ1xrXDTCmcFlpOxPXPPJcGwg= X-Google-Smtp-Source: ABdhPJyS+nJo6MDJHIkIsipstQqZIMO165eaKCS7ApGPDapfZLevBxoGeLILC9gMxytrKODJBbCOdbtf53Oo4g== X-Received: from tef.lon.corp.google.com ([2a00:79e0:d:210:fe2b:14b7:895d:9020]) (user=gprocida job=sendgmr) by 2002:ad4:4623:: with SMTP id x3mr6058969qvv.17.1631273017650; Fri, 10 Sep 2021 04:23:37 -0700 (PDT) Date: Fri, 10 Sep 2021 12:23:25 +0100 In-Reply-To: <20210910112325.806676-1-gprocida@google.com> Message-Id: <20210910112325.806676-5-gprocida@google.com> Mime-Version: 1.0 References: <20210910112325.806676-1-gprocida@google.com> X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH 4/4] RFC: abg-writer: add a missing check for emitted declarations To: libabigail@sourceware.org X-Spam-Status: No, score=-22.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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Giuliano Procida via Libabigail From: Giuliano Procida Reply-To: Giuliano Procida Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Before writing out extra referenced types, the function write_translation_unit does not check if this was an already emitted declaration-only type. This may actually be intentional, given the following comment. // We allow several *declarations* of the same class in the corpus, // but only one definition. * src/abg-writer.cc (write_translation_unit): Also check if an an extra referenced type is declaration-only and already emitted. Signed-off-by: Giuliano Procida --- src/abg-writer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-writer.cc b/src/abg-writer.cc index cf664720..abd5a45a 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -2484,7 +2484,7 @@ write_translation_unit(write_context& ctxt, // We handle types which have declarations *and* function // types here. type_base_sptr t(*i, noop_deleter()); - if (!ctxt.type_is_emitted(t)) + if (!ctxt.type_is_emitted(t) && !ctxt.decl_only_type_is_emitted(t)) { if (decl_base* d = get_type_declaration(*i)) {