aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-02-19 12:03:08 +0000
committerNick Clifton <nickc@redhat.com>2016-02-19 12:03:08 +0000
commitcd0bbe6ef9ca3d3db38a3a0f1ca993bbdc952053 (patch)
treec008de58dba89ed07c357a54f7e2d9182482d564 /gas
parentf4583255d5a16b76c249e3c28ab9c8dd9e7a110e (diff)
downloadgdb-cd0bbe6ef9ca3d3db38a3a0f1ca993bbdc952053.zip
gdb-cd0bbe6ef9ca3d3db38a3a0f1ca993bbdc952053.tar.gz
gdb-cd0bbe6ef9ca3d3db38a3a0f1ca993bbdc952053.tar.bz2
Add const to various variables in the gas sources.
* symbols.c (decode_local_label_name): Make type a const char *. * listing.c (print_source): Make type of p const char *. (print_line): Make type of string const char *. (buffer_line): Return const char *. (title): Make type const char *. (subtitle): Likewise. (listing_listing): Make type of p const char *. * messages.c (as_internal_value_out_of_range): Make type of prefix const char *. * stabs.c (s_stab_generic): make type of stab_secname, stabstr_secname and string const char *. * read.c (_bfd_rel): Make type of name const char *. * app.c (out_string): Change type to const char *. (struct app_save::out_string): Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog17
-rw-r--r--gas/app.c4
-rw-r--r--gas/listing.c22
-rw-r--r--gas/messages.c14
-rw-r--r--gas/read.c7
-rw-r--r--gas/stabs.c6
-rw-r--r--gas/symbols.c2
7 files changed, 46 insertions, 26 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 7236c3e..54a2893 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,20 @@
+016-02-19 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
+ * symbols.c (decode_local_label_name): Make type a const char *.
+ * listing.c (print_source): Make type of p const char *.
+ (print_line): Make type of string const char *.
+ (buffer_line): Return const char *.
+ (title): Make type const char *.
+ (subtitle): Likewise.
+ (listing_listing): Make type of p const char *.
+ * messages.c (as_internal_value_out_of_range): Make type of prefix
+ const char *.
+ * stabs.c (s_stab_generic): make type of stab_secname, stabstr_secname
+ and string const char *.
+ * read.c (_bfd_rel): Make type of name const char *.
+ * app.c (out_string): Change type to const char *.
+ (struct app_save::out_string): Likewise.
+
2016-02-18 Dan Gisselquist <dgisselq@verizon.net>
Nick Clifton <nickc@redhat.com>
diff --git a/gas/app.c b/gas/app.c
index 3f93f0e..074c447 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -211,7 +211,7 @@ do_scrub_begin (int m68k_mri ATTRIBUTE_UNUSED)
/* Saved state of the scrubber. */
static int state;
static int old_state;
-static char *out_string;
+static const char *out_string;
static char out_buf[20];
static int add_newlines;
static char *saved_input;
@@ -229,7 +229,7 @@ struct app_save
{
int state;
int old_state;
- char * out_string;
+ const char * out_string;
char out_buf[sizeof (out_buf)];
int add_newlines;
char * saved_input;
diff --git a/gas/listing.c b/gas/listing.c
index eeb349a..ee878b9 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -223,7 +223,8 @@ static file_info_type *file_info (const char *);
static void new_frag (void);
static void listing_page (list_info_type *);
static unsigned int calc_hex (list_info_type *);
-static void print_lines (list_info_type *, unsigned int, char *, unsigned int);
+static void print_lines (list_info_type *, unsigned int, const char *,
+ unsigned int);
static void list_symbol_table (void);
static int debugging_pseudo (list_info_type *, const char *);
static void listing_listing (char *);
@@ -472,7 +473,7 @@ listing_prev_line (void)
truncated to size. It appends a fake line to the end of each input
file to make using the returned buffer simpler. */
-static char *
+static const char *
buffer_line (file_info_type *file, char *line, unsigned int size)
{
unsigned int count = 0;
@@ -695,12 +696,11 @@ rebuffer_line (file_info_type * file,
}
static const char *fn;
-
-static unsigned int eject; /* Eject pending */
-static unsigned int page; /* Current page number */
-static char *title; /* Current title */
-static char *subtitle; /* Current subtitle */
-static unsigned int on_page; /* Number of lines printed on current page */
+static unsigned int eject; /* Eject pending. */
+static unsigned int page; /* Current page number. */
+static const char *title; /* Current title. */
+static const char *subtitle; /* Current subtitle. */
+static unsigned int on_page; /* Number of lines printed on current page. */
static void
listing_page (list_info_type *list)
@@ -832,7 +832,7 @@ calc_hex (list_info_type *list)
static void
print_lines (list_info_type *list, unsigned int lineno,
- char *string, unsigned int address)
+ const char *string, unsigned int address)
{
unsigned int idx;
unsigned int nchars;
@@ -1095,7 +1095,7 @@ print_source (file_info_type * current_file,
while (current_file->linenum < list->hll_line
&& !current_file->at_end)
{
- char *p;
+ const char *p;
cache = cached_lines + next_free_line;
cache->file = current_file;
@@ -1202,7 +1202,7 @@ listing_listing (char *name ATTRIBUTE_UNUSED)
list_info_type *list = head;
file_info_type *current_hll_file = (file_info_type *) NULL;
char *buffer;
- char *p;
+ const char *p;
int show_listing = 1;
unsigned int width;
diff --git a/gas/messages.c b/gas/messages.c
index f161dc3..2c9f3da 100644
--- a/gas/messages.c
+++ b/gas/messages.c
@@ -342,13 +342,13 @@ sprint_value (char *buf, valueT val)
#define HEX_MIN_THRESHOLD -(HEX_MAX_THRESHOLD)
static void
-as_internal_value_out_of_range (char * prefix,
- offsetT val,
- offsetT min,
- offsetT max,
- char * file,
- unsigned line,
- int bad)
+as_internal_value_out_of_range (const char * prefix,
+ offsetT val,
+ offsetT min,
+ offsetT max,
+ char * file,
+ unsigned line,
+ int bad)
{
const char * err;
diff --git a/gas/read.c b/gas/read.c
index f8fff78..22da1df 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4050,10 +4050,11 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
char *r_name;
int c;
struct reloc_list *reloc;
- struct _bfd_rel { char *name; bfd_reloc_code_real_type code; };
- static struct _bfd_rel bfd_relocs[] = {
+ struct _bfd_rel { const char * name; bfd_reloc_code_real_type code; };
+ static struct _bfd_rel bfd_relocs[] =
+ {
{ "NONE", BFD_RELOC_NONE },
- { "8", BFD_RELOC_8 },
+ { "8", BFD_RELOC_8 },
{ "16", BFD_RELOC_16 },
{ "32", BFD_RELOC_32 },
{ "64", BFD_RELOC_64 }
diff --git a/gas/stabs.c b/gas/stabs.c
index 8343315..6b739c7 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -34,7 +34,7 @@
int outputting_stabs_line_debug = 0;
-static void s_stab_generic (int, char *, char *);
+static void s_stab_generic (int, const char *, const char *);
static void generate_asm_file (int, char *);
/* Allow backends to override the names used for the stab sections. */
@@ -176,7 +176,9 @@ aout_process_stab (what, string, type, other, desc)
kinds of stab sections. */
static void
-s_stab_generic (int what, char *stab_secname, char *stabstr_secname)
+s_stab_generic (int what,
+ const char * stab_secname,
+ const char * stabstr_secname)
{
long longint;
char *string, *saved_string_obstack_end;
diff --git a/gas/symbols.c b/gas/symbols.c
index be48f87..484badc 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1888,7 +1888,7 @@ decode_local_label_name (char *s)
char *symbol_decode;
int label_number;
int instance_number;
- char *type;
+ const char *type;
const char *message_format;
int lindex = 0;