Re: Fix minor NDS32 renaming snafu

Some extern declarations differ in constnes 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.
This commit is contained in:
Alan Modra
2021-07-02 17:27:31 +09:30
parent af82b082c2
commit 62194b631d
5 changed files with 27 additions and 14 deletions

View File

@@ -1,3 +1,8 @@
2021-07-02 Alan Modra <amodra@gmail.com>
* config/tc-nds32.c (nds32_keyword_gpr): Don't declare.
(md_begin): Constify k.
2021-07-02 Nick Clifton <nickc@redhat.com>
* config/tc-nds32.c: Change all references of keyword_gpr to

View File

@@ -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;

View File

@@ -1,3 +1,12 @@
2021-07-02 Alan Modra <amodra@gmail.com>
* 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.
2021-07-01 Mike Frysinger <vapier@gentoo.org>
* Makefile.am (GUILE): New variable.

View File

@@ -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);

View File

@@ -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)
{