summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-07-03 11:39:24 +0930
committerAlan Modra <amodra@gmail.com>2021-07-05 21:40:49 +0930
commit4dcdbbd1bc1d14f2caff3bb4f8fe1f0e5dabcb85 (patch)
tree9d7ebe37c89f4065d35dcc39ba93a7565fcf9ea6 /cpu
parentb4c4b8aaad84853ddf1b2779a5f1bbe5be157397 (diff)
downloadbinutils-gdb-4dcdbbd1bc1d14f2caff3bb4f8fe1f0e5dabcb85.tar.gz
Re: opcodes: constify & local meps macros
Commit f375d32b35ce changed a generated file. Edit the source instead. * mep.opc (macros): Make static and const. (lookup_macro): Return and use const pointer. (expand_macro): Make mac param const. (expand_string): Make pmacro const.
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ChangeLog7
-rw-r--r--cpu/mep.opc10
2 files changed, 12 insertions, 5 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index 24d0775920e..1c178a8fd3e 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,3 +1,10 @@
+2021-07-05 Alan Modra <amodra@gmail.com>
+
+ * mep.opc (macros): Make static and const.
+ (lookup_macro): Return and use const pointer.
+ (expand_macro): Make mac param const.
+ (expand_string): Make pmacro const.
+
2021-07-03 Nick Clifton <nickc@redhat.com>
* 2.37 release branch created.
diff --git a/cpu/mep.opc b/cpu/mep.opc
index 5a4c93dc3ab..6ad0c5879e8 100644
--- a/cpu/mep.opc
+++ b/cpu/mep.opc
@@ -626,7 +626,7 @@ typedef struct
int len;
} arg;
-macro macros[] =
+static macro const macros[] =
{
{ "sizeof", "(`1.end + (- `1))"},
{ "startof", "(`1 | 0)" },
@@ -659,10 +659,10 @@ str_append (char *dest, const char *input, int len)
return strncat (new_dest, input, len);
}
-static macro *
+static const macro *
lookup_macro (const char *name)
{
- macro *m;
+ const macro *m;
for (m = macros; m->name; ++m)
if (strncmp (m->name, name, strlen(m->name)) == 0)
@@ -672,7 +672,7 @@ lookup_macro (const char *name)
}
static char *
-expand_macro (arg *args, int narg, macro *mac)
+expand_macro (arg *args, int narg, const macro *mac)
{
char *result = 0, *rescanned_result = 0;
char *e = mac->expansion;
@@ -722,7 +722,7 @@ expand_string (const char *in, int first_only)
arg args[MAXARGS];
int state = IN_TEXT;
const char *mark = in;
- macro *pmacro = NULL;
+ const macro *pmacro = NULL;
char *expansion = 0;
char *result = 0;