This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
a few more gas warning fixes
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Mon, 16 Dec 2002 20:25:06 +1030
- Subject: a few more gas warning fixes
This grew out of fixing a warning about numopcodes and endop being
unused. Fixes that particular warning and makes some thing const.
include/opcode/ChangeLog
* ns32k.h (struct ns32k_opcode): Constify "name", "operands" and
"default_args".
(struct not_wot): Constify "args".
(struct not): Constify "name".
(numopcodes): Delete.
(endop): Delete.
opcodes/ChangeLog
* ns32k-dis.c (print_insn_ns32k): Constify "d", remove register
keyword.
gas/ChangeLog
* config/tc-ns32k.c (encode_operand): Constify operandsP and suffixP.
(parse): Constify line and lineptr.
(md_begin): Calculate endop here.
Index: gas/config/tc-ns32k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ns32k.c,v
retrieving revision 1.16
diff -u -p -r1.16 tc-ns32k.c
--- gas/config/tc-ns32k.c 31 Jul 2002 16:23:29 -0000 1.16
+++ gas/config/tc-ns32k.c 13 Dec 2002 03:04:04 -0000
@@ -890,13 +890,15 @@ evaluate_expr (resultP, ptr)
opcode.
Be carefull not to put to objects in the same iif-slot. */
-static void encode_operand PARAMS ((int argc, char **argv, char *operandsP, char *, char, char));
+static void encode_operand
+ PARAMS ((int, char **, const char *, const char *, char, char));
+
static void
encode_operand (argc, argv, operandsP, suffixP, im_size, opcode_bit_ptr)
int argc;
char **argv;
- char *operandsP;
- char *suffixP;
+ const char *operandsP;
+ const char *suffixP;
char im_size ATTRIBUTE_UNUSED;
char opcode_bit_ptr;
{
@@ -1077,13 +1079,15 @@ encode_operand (argc, argv, operandsP, s
Return-value = recursive_level. */
/* Build iif of one assembly text line. */
-static int parse PARAMS ((char *, int));
+static int parse PARAMS ((const char *, int));
+
static int
parse (line, recursive_level)
- char *line;
+ const char *line;
int recursive_level;
{
- char *lineptr, c, suffix_separator;
+ const char *lineptr;
+ char c, suffix_separator;
int i;
unsigned int argc;
int arg_type;
@@ -1097,12 +1101,12 @@ parse (line, recursive_level)
continue;
c = *lineptr;
- *lineptr = '\0';
+ *(char *) lineptr = '\0';
if (!(desc = (struct ns32k_opcode *) hash_find (inst_hash_handle, line)))
as_fatal (_("No such opcode"));
- *lineptr = c;
+ *(char *) lineptr = c;
}
else
{
@@ -1637,7 +1641,9 @@ md_begin ()
const struct ns32k_opcode *ptr;
const char *stat;
inst_hash_handle = hash_new ();
+ const struct ns32k_opcode *endop;
+ endop = ns32k_opcodes + sizeof (ns32k_opcodes) / sizeof (ns32k_opcodes[0]);
for (ptr = ns32k_opcodes; ptr < endop; ptr++)
{
if ((stat = hash_insert (inst_hash_handle, ptr->name, (char *) ptr)))
Index: include/opcode/ns32k.h
===================================================================
RCS file: /cvs/src/src/include/opcode/ns32k.h,v
retrieving revision 1.2
diff -u -p -r1.2 ns32k.h
--- include/opcode/ns32k.h 14 Mar 2001 02:27:44 -0000 1.2
+++ include/opcode/ns32k.h 13 Dec 2002 03:04:11 -0000
@@ -80,13 +80,13 @@ column 1 instructions
6 size in bytes of immediate
*/
struct ns32k_opcode {
- char *name;
+ const char *name;
unsigned char opcode_id_size; /* not used by the assembler */
unsigned char opcode_size;
unsigned long opcode_seed;
- char *operands;
+ const char *operands;
unsigned char im_size; /* not used by dissassembler */
- char *default_args; /* default to those args when none given */
+ const char *default_args; /* default to those args when none given */
char default_modec; /* default to this addr-mode when ambigous
ie when the argument of a general addr-mode
is a plain constant */
@@ -103,16 +103,16 @@ struct ns32k_opcode {
struct not_wot /* ns32k opcode table: wot to do with this */
/* particular opcode */
{
- int obits; /* number of opcode bits */
- int ibits; /* number of instruction bits */
- ns32k_opcodeT code; /* op-code (may be > 8 bits!) */
- char *args; /* how to compile said opcode */
+ int obits; /* number of opcode bits */
+ int ibits; /* number of instruction bits */
+ ns32k_opcodeT code; /* op-code (may be > 8 bits!) */
+ const char *args; /* how to compile said opcode */
};
struct not /* ns32k opcode text */
{
- char * name; /* opcode name: lowercase string [key] */
- struct not_wot detail; /* rest of opcode table [datum] */
+ const char *name; /* opcode name: lowercase string [key] */
+ struct not_wot detail; /* rest of opcode table [datum] */
};
/* Instructions look like this:
@@ -481,10 +481,6 @@ static const struct ns32k_opcode ns32k_o
{ "scalbf", 14,24, 0x11fe, "1F2Z", 4, "", DEF_MODEC,DEF_MODEL },
{ "scalbl", 14,24, 0x10fe, "1L2Z", 8, "", DEF_MODEC,DEF_MODEL },
};
-
-static const int numopcodes=sizeof(ns32k_opcodes)/sizeof(ns32k_opcodes[0]);
-
-static const struct ns32k_opcode *const endop = ns32k_opcodes+sizeof(ns32k_opcodes)/sizeof(ns32k_opcodes[0]);
#define MAX_ARGS 4
#define ARG_LEN 50
Index: opcodes/ns32k-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/ns32k-dis.c,v
retrieving revision 1.5
diff -u -p -r1.5 ns32k-dis.c
--- opcodes/ns32k-dis.c 2 Dec 2002 13:13:37 -0000 1.5
+++ opcodes/ns32k-dis.c 13 Dec 2002 03:04:15 -0000
@@ -405,8 +405,8 @@ print_insn_ns32k (memaddr, info)
bfd_vma memaddr;
disassemble_info *info;
{
- register unsigned int i;
- register char *d;
+ unsigned int i;
+ const char *d;
unsigned short first_word;
int ioffset; /* bits into instruction */
int aoffset; /* bits into arguments */
--
Alan Modra
IBM OzLabs - Linux Technology Centre