[PATCH 12/13] make more variables in gas const
tbsaunde+binutils@tbsaunde.org
tbsaunde+binutils@tbsaunde.org
Mon Feb 22 12:28:00 GMT 2016
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
gas/ChangeLog:
2016-02-21 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-ia64.c (slot::src_file): Change type to const char *.
(rsrc::file): Likewise.
* config/tc-xtensa.c (xtensa_sanity_check): Change type of variable to
const char *.
(xtensa_relax_frag): Likewise.
(md_convert_frag): Likewise.
(tinsn_to_slotbuf): Likewise.
* expr.c (expr_symbol_line): Likewise.
* macro.c (define_macro): Likewise.
* macro.h (macro_struct): Likewise.
* messages.c (as_show_where): Likewise.
* read.c (s_macro): Likewise.
* stabs.c (stabs_generate_asm_file): Likewise.
(generate_asm_file): Likewise.
(stabs_generate_asm_lineno): Likewise.
* write.h (struct reloc_list): Likewise.
---
gas/config/tc-ia64.c | 4 ++--
gas/config/tc-xtensa.c | 8 ++++----
gas/expr.c | 2 +-
gas/macro.c | 2 +-
gas/macro.h | 4 ++--
gas/messages.c | 2 +-
gas/read.c | 3 ++-
gas/stabs.c | 12 ++++++------
gas/write.h | 2 +-
9 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index f88c3c2..8169bce 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -302,7 +302,7 @@ static struct
struct label_fix *tag_fixups;
struct unw_rec_list *unwind_record; /* Unwind directive. */
expressionS opnd[6];
- char *src_file;
+ const char *src_file;
unsigned int src_line;
struct dwarf2_line_info debug_line;
}
@@ -672,7 +672,7 @@ static struct rsrc {
int insn_srlz; /* current insn serialization state */
int data_srlz; /* current data serialization state */
int qp_regno; /* qualifying predicate for this usage */
- char *file; /* what file marked this dependency */
+ const char *file; /* what file marked this dependency */
unsigned int line; /* what line marked this dependency */
struct mem_offset mem_offset; /* optional memory offset hint */
enum { CMP_NONE, CMP_OR, CMP_AND } cmp_type; /* OR or AND compare? */
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index aa6f8dc..d995131 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -8485,7 +8485,7 @@ static bfd_boolean is_local_forward_loop (const TInsn *, fragS *);
static void
xtensa_sanity_check (void)
{
- char *file_name;
+ const char *file_name;
unsigned line;
frchainS *frchP;
asection *s;
@@ -9174,7 +9174,7 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p)
xtensa_isa isa = xtensa_default_isa;
int unreported = fragP->tc_frag_data.unreported_expansion;
long new_stretch = 0;
- char *file_name;
+ const char *file_name;
unsigned line;
int lit_size;
static xtensa_insnbuf vbuf = NULL;
@@ -10287,7 +10287,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec, fragS *fragp)
int slot;
int num_slots;
xtensa_format fmt;
- char *file_name;
+ const char *file_name;
unsigned line;
file_name = as_where (&line);
@@ -12565,7 +12565,7 @@ tinsn_to_slotbuf (xtensa_format fmt,
expressionS *exp = &tinsn->tok[i];
int rc;
unsigned line;
- char *file_name;
+ const char *file_name;
uint32 opnd_value;
switch (exp->X_op)
diff --git a/gas/expr.c b/gas/expr.c
index 8b7ad45..777504f 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -54,7 +54,7 @@ extern const char EXP_CHARS[], FLT_CHARS[];
struct expr_symbol_line {
struct expr_symbol_line *next;
symbolS *sym;
- char *file;
+ const char *file;
unsigned int line;
};
diff --git a/gas/macro.c b/gas/macro.c
index d83fb82..b083382 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -648,7 +648,7 @@ free_macro (macro_entry *macro)
const char *
define_macro (size_t idx, sb *in, sb *label,
size_t (*get_line) (sb *),
- char *file, unsigned int line,
+ const char *file, unsigned int line,
const char **namep)
{
macro_entry *macro;
diff --git a/gas/macro.h b/gas/macro.h
index cbd32c9..7000197 100644
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -65,7 +65,7 @@ typedef struct macro_struct
formal_entry *formals; /* Pointer to list of formal_structs. */
struct hash_control *formal_hash; /* Hash table of formals. */
const char *name; /* Macro name. */
- char *file; /* File the macro was defined in. */
+ const char *file; /* File the macro was defined in. */
unsigned int line; /* Line number of definition. */
} macro_entry;
@@ -88,7 +88,7 @@ extern void macro_init (int, int, int,
extern void macro_set_alternate (int);
extern void macro_mri_mode (int);
extern const char *define_macro (size_t, sb *, sb *, size_t (*) (sb *),
- char *, unsigned int, const char **);
+ const char *, unsigned int, const char **);
extern int check_macro (const char *, sb *, const char **, macro_entry **);
extern void delete_macro (const char *);
extern const char *expand_irp (int, size_t, sb *, sb *, size_t (*) (sb *));
diff --git a/gas/messages.c b/gas/messages.c
index e3c5462..dc016bf 100644
--- a/gas/messages.c
+++ b/gas/messages.c
@@ -105,7 +105,7 @@ had_errors (void)
static void
as_show_where (void)
{
- char *file;
+ const char *file;
unsigned int line;
file = as_where (&line);
diff --git a/gas/read.c b/gas/read.c
index e5f7a6b..e992534 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2684,7 +2684,8 @@ get_macro_line_sb (sb *line)
void
s_macro (int ignore ATTRIBUTE_UNUSED)
{
- char *file, *eol;
+ char *eol;
+ const char * file;
unsigned int line;
sb s;
const char *err;
diff --git a/gas/stabs.c b/gas/stabs.c
index b9ab2fa..b734f35 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -35,7 +35,7 @@
int outputting_stabs_line_debug = 0;
static void s_stab_generic (int, const char *, const char *);
-static void generate_asm_file (int, char *);
+static void generate_asm_file (int, const char *);
/* Allow backends to override the names used for the stab sections. */
#ifndef STAB_SECTION_NAME
@@ -490,7 +490,7 @@ s_desc (ignore)
void
stabs_generate_asm_file (void)
{
- char *file;
+ const char *file;
unsigned int lineno;
file = as_where (&lineno);
@@ -512,15 +512,15 @@ stabs_generate_asm_file (void)
TYPE is one of N_SO, N_SOL. */
static void
-generate_asm_file (int type, char *file)
+generate_asm_file (int type, const char *file)
{
static char *last_file;
static int label_count;
char *hold;
char sym[30];
char *buf;
- char *tmp = file;
- char *file_endp = file + strlen (file);
+ const char *tmp = file;
+ const char *file_endp = file + strlen (file);
char *bufp;
if (last_file != NULL
@@ -583,7 +583,7 @@ stabs_generate_asm_lineno (void)
{
static int label_count;
char *hold;
- char *file;
+ const char *file;
unsigned int lineno;
char *buf;
char sym[30];
diff --git a/gas/write.h b/gas/write.h
index 95c7dec..ce81a92 100644
--- a/gas/write.h
+++ b/gas/write.h
@@ -156,7 +156,7 @@ struct reloc_list
arelent r;
} b;
} u;
- char *file;
+ const char *file;
unsigned int line;
};
--
2.7.0
More information about the Binutils
mailing list