aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-04-19 11:43:44 +0200
committerJan Beulich <jbeulich@suse.com>2023-04-19 11:43:44 +0200
commitac164fa8540426238670184e0007e1d4261eaec8 (patch)
treef35610bb21d1c333e8d4ff69aaa8c286fea17070 /gas/expr.c
parent4f0813127bc0c525fca152bca4fea30b7490ae14 (diff)
downloadgdb-ac164fa8540426238670184e0007e1d4261eaec8.zip
gdb-ac164fa8540426238670184e0007e1d4261eaec8.tar.gz
gdb-ac164fa8540426238670184e0007e1d4261eaec8.tar.bz2
gas: document that get_symbol_name() can clobber the input buffer
Callers which want to make further parsing attempts at the buffer passed to the function need to be aware that due to the potential of string concatenation the input buffer may be altered in ways beyond what can be undone by putting back at *input_line_pointer the character that the function returns.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gas/expr.c b/gas/expr.c
index afb346e..680ec13 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -2388,12 +2388,17 @@ resolve_expression (expressionS *expressionP)
here lessens the crowd at read.c.
Assume input_line_pointer is at start of symbol name, or the
- start of a double quote enclosed symbol name.
- Advance input_line_pointer past symbol name.
- Turn that character into a '\0', returning its former value,
- which may be the closing double quote.
+ start of a double quote enclosed symbol name. Advance
+ input_line_pointer past symbol name. Turn that character into a '\0',
+ returning its former value, which may be the closing double quote.
+
This allows a string compare (RMS wants symbol names to be strings)
- of the symbol name.
+ of the symbol name.
+
+ NOTE: The input buffer is further altered when adjacent strings are
+ concatenated by the function. Callers caring about the original buffer
+ contents will need to make a copy before calling here.
+
There will always be a char following symbol name, because all good
lines end in end-of-line. */