From patchwork Fri Apr 14 13:38:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 67737 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 36FE53858C2C for ; Fri, 14 Apr 2023 13:38:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36FE53858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681479496; bh=csw8curbUZW7gDKpkm4OT4ZWjoCDZMpJuct+KvCenI8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=un/I7sNS8Tg/+rotoN8OjNqQTD5sRDelROerBh76P/1o7B7XhnJcYd/WwnfbLHLyD iG3Xd/n9Phv6CcxqDmhVBDUsWoVz6gsILCn41jZyr5g8LaQbNM5yhFBZ9GLu45vgXA EAIXMx1fmNLmGRkic1q/pF56SJ28Ew33Popso2KU= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D03A33858D20 for ; Fri, 14 Apr 2023 13:38:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D03A33858D20 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-vLMKscEkPjeu1Sdppi5NgA-1; Fri, 14 Apr 2023 09:38:08 -0400 X-MC-Unique: vLMKscEkPjeu1Sdppi5NgA-1 Received: by mail-qk1-f198.google.com with SMTP id v5-20020a379305000000b0074a37810157so17077606qkd.21 for ; Fri, 14 Apr 2023 06:38:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681479487; x=1684071487; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=csw8curbUZW7gDKpkm4OT4ZWjoCDZMpJuct+KvCenI8=; b=JwLfCmvEGDu7vn9yYq6y1Mi/BGa8Dx5nRcnMbBlNlU2ntXa7QnFn7/MtcVN3GtW2I5 zsuVtGUK2Lvs9cLM8Cu6Avfvw/eRotjzhpuyoWUWhrZ5UG+rsx258WHW4/WSCUGmak1M 0c0NlpE2gkY/NTvqgv7HNZ8/bJFgnZFfOcGhadUm0Oz6xT0SNDQLrqUHXqiRganfKBoH cO1ch2Y2ouL8HqrdSSucko4cuJ1NgPSSw7OTYbWLpVcFqN3zcAZG91nQWzE61LeVgnxq MJbBdKeakJ99hpQkRlBGg0iI/C8WRcnCAJb5MqbCdQejVmh/DWtSSOFOTnXtOvjdWOJ6 S+DA== X-Gm-Message-State: AAQBX9c3dVjEL6aS3DEjaZtAEZLpSg6ZiI9CSebO4Fts+zMKs+ZZ/6th ilE0XxcsWbXDGA+7eaZag5VzBzLw/9k79NJRwm2GQ2nn/wlpfh/C+JWCA490YoMU97ifQXXpuyN b062O0RbiL5hZd7j0+2lyWTRnPN5H2YRMtNzaNQYhzeU85j+VkYAeHqNExqphKHTCCEqV8wqnA3 H3 X-Received: by 2002:a05:6214:300c:b0:5ef:4577:3c48 with SMTP id ke12-20020a056214300c00b005ef45773c48mr3802918qvb.42.1681479487661; Fri, 14 Apr 2023 06:38:07 -0700 (PDT) X-Google-Smtp-Source: AKy350ZnD90Z0RC1Fla2B/GaApxMMBEZpE2bDpzVm2hwQggIky6S0W5JHL009/pS2ycZ7vYFD02TJg== X-Received: by 2002:a05:6214:300c:b0:5ef:4577:3c48 with SMTP id ke12-20020a056214300c00b005ef45773c48mr3802877qvb.42.1681479487253; Fri, 14 Apr 2023 06:38:07 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id t13-20020a0cf98d000000b005dd8b9345bdsm1124281qvn.85.2023.04.14.06.38.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 06:38:06 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 1F27EBF0EA; Fri, 14 Apr 2023 15:38:04 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] abidiff,reader: Fix compilation with --debug-self-comparison Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Fri, 14 Apr 2023 15:38:03 +0200 Message-ID: <87leiutwhw.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, While chasing self-comparison changes errors, I realized that compilation is failing when the package is configured with --debug-self-comparison. Fixed thus. * src/abg-reader.cc (reader::{maybe_check_abixml_canonical_type_stability, read_corpus}): get_environment() doesn't returns a pointer anymore. So adapt the code. (maybe_map_type_with_type_id): Adjust because the environment is const. (load_canonical_type_ids): The xml_reader namespace doesn't exist anymore. It's now abixml. * tools/abidiff.cc (options::options): Initialize the do_debug_self_comparison data member before the use_btf one, as it should be. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 28 +++++++++++++--------------- tools/abidiff.cc | 8 ++++---- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index e1d13296..fe3d466b 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -851,8 +851,8 @@ public: void maybe_check_abixml_canonical_type_stability(type_base_sptr& t) { - if (!get_environment()->self_comparison_debug_is_on() - || get_environment()->get_type_id_canonical_type_map().empty()) + if (!get_environment().self_comparison_debug_is_on() + || get_environment().get_type_id_canonical_type_map().empty()) return ; if (class_decl_sptr c = is_class_type(t)) @@ -864,15 +864,15 @@ public: // Let's get the type-id of this type as recorded in the // originating abixml file. string type_id = - get_environment()->get_type_id_from_pointer(reinterpret_cast(t.get())); + get_environment().get_type_id_from_pointer(reinterpret_cast(t.get())); if (!type_id.empty()) { // Now let's get the canonical type that initially led to the // serialization of a type with this type-id, when the abixml // was being serialized. - auto j = get_environment()->get_type_id_canonical_type_map().find(type_id); - if (j == get_environment()->get_type_id_canonical_type_map().end()) + auto j = get_environment().get_type_id_canonical_type_map().find(type_id); + if (j == get_environment().get_type_id_canonical_type_map().end()) { if (t->get_naked_canonical_type()) std::cerr << "error: no type with type-id: '" @@ -1107,9 +1107,8 @@ public: return nil; #ifdef WITH_DEBUG_SELF_COMPARISON - if (get_environment()->self_comparison_debug_is_on()) - get_environment()-> - set_self_comparison_debug_input(corpus()); + if (get_environment().self_comparison_debug_is_on()) + get_environment().set_self_comparison_debug_input(corpus()); #endif if (!corpus_group()) @@ -1168,9 +1167,8 @@ public: else { #ifdef WITH_DEBUG_SELF_COMPARISON - if (get_environment()->self_comparison_debug_is_on()) - get_environment()-> - set_self_comparison_debug_input(corpus()); + if (get_environment().self_comparison_debug_is_on()) + get_environment().set_self_comparison_debug_input(corpus()); #endif if (!corpus_group()) @@ -2929,8 +2927,8 @@ maybe_map_type_with_type_id(const type_base_sptr& t, || is_non_canonicalized_type(t.get())) return false; - env.get_pointer_type_id_map()[reinterpret_cast(t.get())] = - type_id; + const_cast(env). + get_pointer_type_id_map()[reinterpret_cast(t.get())] = type_id; return true; } @@ -6243,7 +6241,7 @@ read_corpus_from_abixml_file(const string& path, bool load_canonical_type_ids(fe_iface& iface, const string &file_path) { - xml_reader::reader& rdr = dynamic_cast(iface) + abixml::reader& rdr = dynamic_cast(iface); xmlDocPtr doc = xmlReadFile(file_path.c_str(), NULL, XML_PARSE_NOERROR); if (!doc) @@ -6302,7 +6300,7 @@ load_canonical_type_ids(fe_iface& iface, const string &file_path) // that are not canonicalized. Look into function // hash_as_canonical_type_or_constant for the details. && v != 0xdeadbabe) - rdr.get_environment()->get_type_id_canonical_type_map()[id] = v; + rdr.get_environment().get_type_id_canonical_type_map()[id] = v; } } return true; diff --git a/tools/abidiff.cc b/tools/abidiff.cc index 427c1f19..0e6538eb 100644 --- a/tools/abidiff.cc +++ b/tools/abidiff.cc @@ -175,6 +175,10 @@ struct options dump_diff_tree(), show_stats(), do_log() +#ifdef WITH_DEBUG_SELF_COMPARISON + , + do_debug_self_comparison() +#endif #ifdef WITH_DEBUG_TYPE_CANONICALIZATION , do_debug_type_canonicalization() @@ -186,10 +190,6 @@ struct options #ifdef WITH_BTF , use_btf() -#endif -#ifdef WITH_DEBUG_SELF_COMPARISON - , - do_debug_self_comparison() #endif {}