aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2026-02-27 08:00:32 +0100
committerJan Beulich <jbeulich@suse.com>2026-02-27 08:00:32 +0100
commit097423696e95e81141a1000ab43cc380c3417345 (patch)
treec06dd629566653e02c2f8a2465f88e1e7f9a5e5c /gas
parente80ac000da58023b89e499a56ccc6c41098c4e95 (diff)
downloadbinutils-master.zip
binutils-master.tar.gz
binutils-master.tar.bz2
gas: use get_single_number() in get_linefile_number()HEADmaster
We don't really want to handle expressions there, we want plain numbers.
Diffstat (limited to 'gas')
-rw-r--r--gas/read.c13
-rw-r--r--gas/testsuite/gas/all/linefile.l2
2 files changed, 9 insertions, 6 deletions
diff --git a/gas/read.c b/gas/read.c
index 5905865..bac5bea 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2047,11 +2047,11 @@ s_file (int ignore ATTRIBUTE_UNUSED)
static bool
get_linefile_number (int *flag)
{
- expressionS exp;
+ offsetT val;
SKIP_WHITESPACE ();
- if (*input_line_pointer < '0' || *input_line_pointer > '9')
+ if (is_end_of_stmt (*input_line_pointer))
return false;
/* Don't mistakenly interpret octal numbers as line numbers. */
@@ -2062,16 +2062,17 @@ get_linefile_number (int *flag)
return true;
}
- expression_and_evaluate (&exp);
- if (exp.X_op != O_constant)
+ val = get_single_number ();
+ /* Zero was handled above; getting back zero indicates an error. */
+ if (val == 0)
return false;
#if defined (BFD64) || LONG_MAX > INT_MAX
- if (exp.X_add_number < INT_MIN || exp.X_add_number > INT_MAX)
+ if (val < INT_MIN || val > INT_MAX)
return false;
#endif
- *flag = exp.X_add_number;
+ *flag = val;
return true;
}
diff --git a/gas/testsuite/gas/all/linefile.l b/gas/testsuite/gas/all/linefile.l
index 089f328..c0d7c40 100644
--- a/gas/testsuite/gas/all/linefile.l
+++ b/gas/testsuite/gas/all/linefile.l
@@ -1,6 +1,8 @@
# This should match the output of gas linefile.s.
.*linefile\.s: Assembler messages:
+#?.*linefile\.s:1: Error: .*
.*linefile\.s:2: Warning: line 2
+.*linefile\.s:4: Error: .*
.*linefile\.s:5: Warning: line 5
.*linefile\.s:8: Warning: line 8
#pass