From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WPEdEdUYRmJQHAAAWB0awg (envelope-from ) for ; Thu, 31 Mar 2022 17:10:45 -0400 Received: by simark.ca (Postfix, from userid 112) id 435821F163; Thu, 31 Mar 2022 17:10:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 71AB71E150 for ; Thu, 31 Mar 2022 17:10:44 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B828388E826 for ; Thu, 31 Mar 2022 21:10:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B828388E826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648761044; bh=P6wLA6o3NhMDJtBY+9knaMhfKbwfs8FT9YahvMljnK0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MWmRRr2EJF75LUQpCHn8m3Qr6Gel9Fc+gyUUt6+9HyMYeSuIEurUt4oRX0oT/pjIt xncQAoI9VNe6sJCqPUVZjrUpWR80T+ip2dwDV6N6Op3wxgkiM7MdCQhiQKtDIyUz2S ePYyvhvTnhXWB1s7tP0eIIl/xSznX1acDmhAXGnU= 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 F0DC63838019 for ; Thu, 31 Mar 2022 21:04:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F0DC63838019 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-282-jBlXntm3P12V-5Kf7o9eLg-1; Thu, 31 Mar 2022 17:04:50 -0400 X-MC-Unique: jBlXntm3P12V-5Kf7o9eLg-1 Received: by mail-wm1-f71.google.com with SMTP id n186-20020a1ca4c3000000b0038cdec2d700so328567wme.5 for ; Thu, 31 Mar 2022 14:04:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P6wLA6o3NhMDJtBY+9knaMhfKbwfs8FT9YahvMljnK0=; b=BOizxmDnxvDJG19mUL3jJLCJhSk/RXUOB/1dZve79KiF4Ry5E0jI95U7VpGqS/TQXk SGq0J4HUVZR1lyo2Ltwg+in7Ivw/aSaZzj5B68Mw1naLFYlpdyZ2sZrs7Rqpg6wxhi0/ GdzbK/PlwYQ0gjuTQPUplp0zyDcJsNUdfAG3kszRm7ctz5ERDURTlPyzeWdAXL4yirRB EIuq++kTV/Qr8RjoBENY6vEo2NoJqzJDoBeW9GSwje2n3HBVZf6QBuaC3i5eVyMk4DwM qKM9dVaX2bq0i+HnCUIgj6MUllR3TMOFHyrsZbH7czjBHja3JHd1nQgvrCCrJKBlpo7s +NtQ== X-Gm-Message-State: AOAM5316Dt5uGj+sQEsvZukCqWgMsUh7N8lAwyQKktEV9MQzc2dBSnlz TRVz5wGN86olhocqvWSG3Gdt9QMMTr54OaId9Mu/tfnttYx4RZiir5CQ6+V0nduLdh2c8JjWZ0q Qm4Mxu8QkEtf5QQINrC1xkxZFueLkIVbe6kYziiDR7dYs2J91bEoGQfDejN+H9YIMD5d+K5PGuQ == X-Received: by 2002:a05:600c:35d4:b0:38c:9933:41c0 with SMTP id r20-20020a05600c35d400b0038c993341c0mr6203324wmq.149.1648760688508; Thu, 31 Mar 2022 14:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8WB00CctMRZEfl2qKuCymLmh9heWjxHZYVWjddQbz2sWkZNxNwExP1CJXyAGuliwtjqp08w== X-Received: by 2002:a05:600c:35d4:b0:38c:9933:41c0 with SMTP id r20-20020a05600c35d400b0038c993341c0mr6203305wmq.149.1648760688126; Thu, 31 Mar 2022 14:04:48 -0700 (PDT) Received: from localhost (host86-169-131-113.range86-169.btcentralplus.com. [86.169.131.113]) by smtp.gmail.com with ESMTPSA id b10-20020a05600018aa00b002042a98168csm503458wri.15.2022.03.31.14.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 14:04:47 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 12/16] gdb: more 'const' in gdb/reggroups.{c,h} Date: Thu, 31 Mar 2022 22:04:18 +0100 Message-Id: <4b01539542862737b960b78af6decfc174bbc0d9.1648760270.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Convert the reggroup_new and reggroup_gdbarch_new functions to return a 'const regggroup *', and fix up all the fallout. There should be no user visible changes after this commit. --- gdb/csky-tdep.c | 10 +++++----- gdb/i386-tdep.c | 4 ++-- gdb/m32c-tdep.c | 2 +- gdb/m68hc11-tdep.c | 4 ++-- gdb/mep-tdep.c | 6 +++--- gdb/nds32-tdep.c | 20 ++++++++++---------- gdb/reggroups.c | 8 ++++---- gdb/reggroups.h | 13 +++++++------ gdb/riscv-tdep.c | 2 +- gdb/xtensa-tdep.c | 8 ++++---- 10 files changed, 39 insertions(+), 38 deletions(-) diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index feb416a2406..3712409dbe8 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -61,11 +61,11 @@ /* Control debugging information emitted in this file. */ static bool csky_debug = false; -static struct reggroup *cr_reggroup; -static struct reggroup *fr_reggroup; -static struct reggroup *vr_reggroup; -static struct reggroup *mmu_reggroup; -static struct reggroup *prof_reggroup; +static const reggroup *cr_reggroup; +static const reggroup *fr_reggroup; +static const reggroup *vr_reggroup; +static const reggroup *mmu_reggroup; +static const reggroup *prof_reggroup; /* Convenience function to print debug messages in prologue analysis. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 0f9e3fde6ce..154d484c342 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -4531,8 +4531,8 @@ i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* i386 register groups. In addition to the normal groups, add "mmx" and "sse". */ -static struct reggroup *i386_sse_reggroup; -static struct reggroup *i386_mmx_reggroup; +static const reggroup *i386_sse_reggroup; +static const reggroup *i386_mmx_reggroup; static void i386_init_reggroups (void) diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 5a767c9ed52..55ef5a551f8 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -35,7 +35,7 @@ /* The m32c tdep structure. */ -static struct reggroup *m32c_dma_reggroup; +static const reggroup *m32c_dma_reggroup; /* The type of a function that moves the value of REG between CACHE or BUF --- in either direction. */ diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 9d978d88018..5c1f20415c8 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1346,8 +1346,8 @@ m68hc11_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) /* 68HC11/68HC12 register groups. Identify real hard registers and soft registers used by gcc. */ -static struct reggroup *m68hc11_soft_reggroup; -static struct reggroup *m68hc11_hard_reggroup; +static const reggroup *m68hc11_soft_reggroup; +static const reggroup *m68hc11_hard_reggroup; static void m68hc11_init_reggroups (void) diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index e449c66c9b5..27a1c5dd1ca 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1022,9 +1022,9 @@ mep_register_name (struct gdbarch *gdbarch, int regnr) /* Custom register groups for the MeP. */ -static struct reggroup *mep_csr_reggroup; /* control/special */ -static struct reggroup *mep_cr_reggroup; /* coprocessor general-purpose */ -static struct reggroup *mep_ccr_reggroup; /* coprocessor control */ +static const reggroup *mep_csr_reggroup; /* control/special */ +static const reggroup *mep_cr_reggroup; /* coprocessor general-purpose */ +static const reggroup *mep_ccr_reggroup; /* coprocessor control */ static int diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index a94a03ab2ab..06b129bdd31 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -314,16 +314,16 @@ nds32_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num) } /* NDS32 register groups. */ -static struct reggroup *nds32_cr_reggroup; -static struct reggroup *nds32_ir_reggroup; -static struct reggroup *nds32_mr_reggroup; -static struct reggroup *nds32_dr_reggroup; -static struct reggroup *nds32_pfr_reggroup; -static struct reggroup *nds32_hspr_reggroup; -static struct reggroup *nds32_dmar_reggroup; -static struct reggroup *nds32_racr_reggroup; -static struct reggroup *nds32_idr_reggroup; -static struct reggroup *nds32_secur_reggroup; +static const reggroup *nds32_cr_reggroup; +static const reggroup *nds32_ir_reggroup; +static const reggroup *nds32_mr_reggroup; +static const reggroup *nds32_dr_reggroup; +static const reggroup *nds32_pfr_reggroup; +static const reggroup *nds32_hspr_reggroup; +static const reggroup *nds32_dmar_reggroup; +static const reggroup *nds32_racr_reggroup; +static const reggroup *nds32_idr_reggroup; +static const reggroup *nds32_secur_reggroup; static void nds32_init_reggroups (void) diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 4607c4b674c..419e091c3c0 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -36,7 +36,7 @@ struct reggroup enum reggroup_type type; }; -struct reggroup * +const reggroup * reggroup_new (const char *name, enum reggroup_type type) { struct reggroup *group = XNEW (struct reggroup); @@ -48,7 +48,7 @@ reggroup_new (const char *name, enum reggroup_type type) /* See reggroups.h. */ -struct reggroup * +const reggroup * reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name, enum reggroup_type type) { @@ -81,7 +81,7 @@ struct reggroups { /* Add GROUP to the list of register groups. */ - void add (struct reggroup *group) + void add (const reggroup *group) { gdb_assert (group != nullptr); gdb_assert (std::find (m_groups.begin(), m_groups.end(), group) @@ -116,7 +116,7 @@ static struct gdbarch_data *reggroups_data; /* Add GROUP to the list of register groups for GDBARCH. */ void -reggroup_add (struct gdbarch *gdbarch, struct reggroup *group) +reggroup_add (struct gdbarch *gdbarch, const reggroup *group) { struct reggroups *groups = (struct reggroups *) gdbarch_data (gdbarch, reggroups_data); diff --git a/gdb/reggroups.h b/gdb/reggroups.h index 959191c4180..28bd00ff176 100644 --- a/gdb/reggroups.h +++ b/gdb/reggroups.h @@ -39,15 +39,16 @@ extern struct reggroup *const save_reggroup; extern struct reggroup *const restore_reggroup; /* Create a new local register group. */ -extern struct reggroup *reggroup_new (const char *name, - enum reggroup_type type); +extern const reggroup *reggroup_new (const char *name, + enum reggroup_type type); + /* Create a new register group allocated onto the gdbarch obstack. */ -extern struct reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch, - const char *name, - enum reggroup_type type); +extern const reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch, + const char *name, + enum reggroup_type type); /* Add a register group (with attribute values) to the pre-defined list. */ -extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group); +extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group); /* Register group attributes. */ extern const char *reggroup_name (const struct reggroup *reggroup); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index ce62cfeb65c..f48260fbd93 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -129,7 +129,7 @@ struct riscv_unwind_cache /* RISC-V specific register group for CSRs. */ -static reggroup *csr_reggroup = NULL; +static const reggroup *csr_reggroup = nullptr; /* Callback function for user_reg_add. */ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 6e478ee893d..89bdd7ffd28 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -712,10 +712,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, _("invalid register number %d"), regnum); } -static struct reggroup *xtensa_ar_reggroup; -static struct reggroup *xtensa_user_reggroup; -static struct reggroup *xtensa_vectra_reggroup; -static struct reggroup *xtensa_cp[XTENSA_MAX_COPROCESSOR]; +static const reggroup *xtensa_ar_reggroup; +static const reggroup *xtensa_user_reggroup; +static const reggroup *xtensa_vectra_reggroup; +static const reggroup *xtensa_cp[XTENSA_MAX_COPROCESSOR]; static void xtensa_init_reggroups (void) -- 2.25.4