From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 5B6253855024 for ; Fri, 2 Jul 2021 11:21:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5B6253855024 Received: by mail-pj1-x1030.google.com with SMTP id 22-20020a17090a0c16b0290164a5354ad0so8898688pjs.2 for ; Fri, 02 Jul 2021 04:21:25 -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:from:to:subject:message-id:mime-version :content-disposition; bh=8PiRzHZBK3POeCegb66bplHbZ9ZUxk1aO3Q9nQSV55c=; b=WZ96RGL/mvyrwoIUbkWO6SktagcSDDP5gUfebvSiLE4ljBiQNPgR0nFtdreRU57JFY duXBSZEE6xkL0xgAoG7G9b9vJU9fyzg9Pulopy2NGJgz8HUAlX/WUDJOZW1oQ9/XYCRQ Gsgla1yMgmQ28QhH0mMeKw2KQXXRomolyGa5LK/U2Hkqg8rohBIhYsa0WZGNqhas6R5B wXYqc7K4DlFNdfyxNggOKwy9rjeoq3ScIqdhsToUzWd7JBlC9/AmYSAO53AIx8sVIOGO XLZ6Jt+YbEZr1rJx4WMvWxcSFCh+mO8To/T8HR+Eqrfgvp+dzaG2agexNEPNuuMqze0G Y7vQ== X-Gm-Message-State: AOAM530Hwd4NnWZlzcY4MVxvg7wHaD+0dSrXZo273RyuUk9VDU9sqvCg 5JfhGD5x1XMhpOIH8MKxbx6S1C5syea8dg== X-Google-Smtp-Source: ABdhPJy1z3t9i2PGEB5dEMvye/HGFObjpZPRk3qUDgK+yZ667Vde4e45h7ri7OMfh0L4xx6PsQh34w== X-Received: by 2002:a17:90a:f0c3:: with SMTP id fa3mr4653471pjb.90.1625224884106; Fri, 02 Jul 2021 04:21:24 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:579c:e63:ca0a:6d8d]) by smtp.gmail.com with ESMTPSA id 75sm3226019pfx.71.2021.07.02.04.21.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 04:21:23 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 5AE051140057; Fri, 2 Jul 2021 20:51:20 +0930 (ACST) Date: Fri, 2 Jul 2021 20:51:20 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Re: Fix minor NDS32 renaming snafu Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3038.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2021 11:21:26 -0000 Some extern declarations differ in constness to their definitions too. Let's make sure this sort of thing doesn't happen again, but putting the externs in a header where they belong. gas/ * config/tc-nds32.c (nds32_keyword_gpr): Don't declare. (md_begin): Constify k. opcodes/ * nds32-dis.c (nds32_find_reg_keyword): Constify arg and return. (nds32_parse_audio_ext, nds32_parse_opcode): Constify psys_reg. (nds32_field_table, nds32_opcode_table, nds32_keyword_table), (nds32_opcodes, nds32_operand_fields, nds32_keywords), (nds32_keyword_gpr): Move declarations to.. * nds32-asm.h: ..here, constifying to match definitions. diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index 04ae6895ec1..4ff667caf61 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -97,7 +97,6 @@ static int optimize_for_space = 0; static int label_exist = 0; /* Flag to save state in omit_fp region. */ static int in_omit_fp = 0; -extern struct nds32_keyword nds32_keyword_gpr[]; /* Tag there is relax relocation having to link. */ static bool relaxing = false; /* ICT model. */ @@ -4601,7 +4600,7 @@ nds32_asm_parse_operand (struct nds32_asm_desc *pdesc ATTRIBUTE_UNUSED, void md_begin (void) { - struct nds32_keyword *k; + const struct nds32_keyword *k; relax_info_t *relax_info; int flags = 0; diff --git a/opcodes/nds32-asm.h b/opcodes/nds32-asm.h index 11ae48f28d7..e0ec98df26e 100644 --- a/opcodes/nds32-asm.h +++ b/opcodes/nds32-asm.h @@ -268,6 +268,14 @@ typedef struct nds32_field char **, int64_t *); } field_t; +extern const field_t *nds32_field_table[NDS32_CORE_COUNT]; +extern opcode_t *nds32_opcode_table[NDS32_CORE_COUNT]; +extern const keyword_t **nds32_keyword_table[NDS32_CORE_COUNT]; +extern struct nds32_opcode nds32_opcodes[]; +extern const field_t nds32_operand_fields[]; +extern const keyword_t *nds32_keywords[]; +extern const keyword_t nds32_keyword_gpr[]; + extern void nds32_assemble (nds32_asm_desc_t *, nds32_asm_insn_t *, char *); extern void nds32_asm_init (nds32_asm_desc_t *, int); diff --git a/opcodes/nds32-dis.c b/opcodes/nds32-dis.c index c888487efa9..c8cb506165f 100644 --- a/opcodes/nds32-dis.c +++ b/opcodes/nds32-dis.c @@ -65,14 +65,6 @@ struct nds32_private_data #define NDS32_PARSE_INSN16 0x01 #define NDS32_PARSE_INSN32 0x02 -extern const field_t *nds32_field_table[NDS32_CORE_COUNT]; -extern opcode_t *nds32_opcode_table[NDS32_CORE_COUNT]; -extern keyword_t **nds32_keyword_table[NDS32_CORE_COUNT]; -extern struct nds32_opcode nds32_opcodes[]; -extern const field_t nds32_operand_fields[]; -extern keyword_t *nds32_keywords[]; -extern const keyword_t nds32_keyword_gpr[]; - static uint32_t nds32_mask_opcode (uint32_t); static void nds32_special_opcode (uint32_t, struct nds32_opcode **); static int get_mapping_symbol_type (struct disassemble_info *, int, @@ -86,8 +78,8 @@ static htab_t opcode_htab; /* Find the value map register name. */ -static keyword_t * -nds32_find_reg_keyword (keyword_t *reg, int value) +static const keyword_t * +nds32_find_reg_keyword (const keyword_t *reg, int value) { if (!reg) return NULL; @@ -107,7 +99,7 @@ nds32_parse_audio_ext (const field_t *pfd, { fprintf_ftype func = info->fprintf_func; void *stream = info->stream; - keyword_t *psys_reg; + const keyword_t *psys_reg; int int_value, new_value; if (pfd->hw_res == HW_INT || pfd->hw_res == HW_UINT) @@ -224,7 +216,7 @@ nds32_parse_opcode (struct nds32_opcode *opc, bfd_vma pc ATTRIBUTE_UNUSED, unsigned int push25gpr = 0, lsmwRb, lsmwRe, lsmwEnb4, checkbit, i; int int_value, ifthe1st = 1; const field_t *pfd; - keyword_t *psys_reg; + const keyword_t *psys_reg; if (opc == NULL) { -- Alan Modra Australia Development Lab, IBM