I found a few spots in ada-exp.y that could use 'const'.
Tested by rebuilding.
2021-07-02 Tom Tromey <tromey@adacore.com>
* ada-exp.y (chop_selector, chop_separator, write_selectors)
(write_ambiguous_var, get_symbol_field_type): Use const.
+2021-07-02 Tom Tromey <tromey@adacore.com>
+
+ * ada-exp.y (chop_selector, chop_separator, write_selectors)
+ (write_ambiguous_var, get_symbol_field_type): Use const.
+
2021-07-02 Pedro Alves <pedro@palves.net>
Hannes Domani <ssbssa@yahoo.de>
2021-07-02 Pedro Alves <pedro@palves.net>
Hannes Domani <ssbssa@yahoo.de>
static LONGEST convert_char_literal (struct type *, LONGEST);
static void write_ambiguous_var (struct parser_state *,
static LONGEST convert_char_literal (struct type *, LONGEST);
static void write_ambiguous_var (struct parser_state *,
- const struct block *, char *, int);
+ const struct block *, const char *, int);
static struct type *type_int (struct parser_state *);
static struct type *type_int (struct parser_state *);
-chop_selector (char *name, int end)
+chop_selector (const char *name, int end)
{
int i;
for (i = end - 1; i > 0; i -= 1)
{
int i;
for (i = end - 1; i > 0; i -= 1)
'.'), chop this separator and return the result; else, return
NAME. */
'.'), chop this separator and return the result; else, return
NAME. */
-static char *
-chop_separator (char *name)
+static const char *
+chop_separator (const char *name)
{
if (*name == '.')
return name + 1;
{
if (*name == '.')
return name + 1;
<sep> is '__' or '.', write the indicated sequence of
STRUCTOP_STRUCT expression operators. */
static void
<sep> is '__' or '.', write the indicated sequence of
STRUCTOP_STRUCT expression operators. */
static void
-write_selectors (struct parser_state *par_state, char *sels)
+write_selectors (struct parser_state *par_state, const char *sels)
{
while (*sels != '\0')
{
{
while (*sels != '\0')
{
- char *p = chop_separator (sels);
+ const char *p = chop_separator (sels);
sels = p;
while (*sels != '\0' && *sels != '.'
&& (sels[0] != '_' || sels[1] != '_'))
sels = p;
while (*sels != '\0' && *sels != '.'
&& (sels[0] != '_' || sels[1] != '_'))
*/
static void
write_ambiguous_var (struct parser_state *par_state,
*/
static void
write_ambiguous_var (struct parser_state *par_state,
- const struct block *block, char *name, int len)
+ const struct block *block, const char *name, int len)
{
struct symbol *sym = new (&temp_parse_space) symbol ();
{
struct symbol *sym = new (&temp_parse_space) symbol ();
In case of failure, we return NULL. */
static struct type *
In case of failure, we return NULL. */
static struct type *
-get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
+get_symbol_field_type (struct symbol *sym, const char *encoded_field_name)
- char *field_name = encoded_field_name;
- char *subfield_name;
+ const char *field_name = encoded_field_name;
+ const char *subfield_name;
struct type *type = SYMBOL_TYPE (sym);
int fieldno;
struct type *type = SYMBOL_TYPE (sym);
int fieldno;