aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-14 22:13:54 +1030
committerAlan Modra <amodra@gmail.com>2023-01-16 23:25:32 +1030
commit6eb099ae9324f1210d98a406dee07f22ab26a4eb (patch)
tree3c8202ab6286e37eab4820af9500ec0c80339c92 /gas/expr.c
parent6e4b74e9a962dd730e84ca54e6d5654b03e69b09 (diff)
downloadbinutils-6eb099ae9324f1210d98a406dee07f22ab26a4eb.zip
binutils-6eb099ae9324f1210d98a406dee07f22ab26a4eb.tar.gz
binutils-6eb099ae9324f1210d98a406dee07f22ab26a4eb.tar.bz2
Tidy gas/expr.c static state
* expr.c (seen, nr_seen): Make file scope. (expr_begin): Clear seen, nr_seen, and expr_symbol_lines. (expr_end): New function. * expr.h (expr_end): Declare. * output-file.c (output_file_close): Call expr_end. * config/tc-hppa.c (expr_end): Rename to expr_parse_end. * config/tc-mips.c: Likewise. * config/tc-riscv.c: Likewise. * config/tc-sparc.c: Likewise.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gas/expr.c b/gas/expr.c
index 28ec58c..ba3d210 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -130,12 +130,12 @@ expr_symbol_where (symbolS *sym, const char **pfile, unsigned int *pline)
/* Look up a previously used .startof. / .sizeof. symbol, or make a fresh
one. */
+static symbolS **seen[2];
+static unsigned int nr_seen[2];
static symbolS *
symbol_lookup_or_make (const char *name, bool start)
{
- static symbolS **seen[2];
- static unsigned int nr_seen[2];
char *buf = concat (start ? ".startof." : ".sizeof.", name, NULL);
symbolS *symbolP;
unsigned int i;
@@ -1596,6 +1596,17 @@ expr_begin (void)
e.X_op = O_max;
gas_assert (e.X_op == O_max);
}
+
+ memset (seen, 0, sizeof seen);
+ memset (nr_seen, 0, sizeof nr_seen);
+ expr_symbol_lines = NULL;
+}
+
+void
+expr_end (void)
+{
+ for (size_t i = 0; i < ARRAY_SIZE (seen); i++)
+ free (seen[i]);
}
/* Return the encoding for the operator at INPUT_LINE_POINTER, and