aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-07 12:34:06 +0100
committerNick Clifton <nickc@redhat.com>2016-04-07 12:34:06 +0100
commite140100a5da85568e83ffe8e77d3f5e4a59ddee8 (patch)
treec9dbe69c7bf5550b708733dcb153336c940bd541 /gas/expr.c
parentdf154dc15f5385c9ec3b998788536dede9882393 (diff)
downloadgdb-e140100a5da85568e83ffe8e77d3f5e4a59ddee8.zip
gdb-e140100a5da85568e83ffe8e77d3f5e4a59ddee8.tar.gz
gdb-e140100a5da85568e83ffe8e77d3f5e4a59ddee8.tar.bz2
Allow integer contants to have a U suffix. Improve error reporting for missing closing parentheses.
PR gas/19910 * config/tc-sparc.c (sparc_ip): Report an error if the expression inside a %-macro could not be fully parsed. * expr.c (integer_constant): Accept and ignore U suffixes to integers. (operand): When a missing closing parenthesis is encountered, report the character that was found instead. * testsuite/gas/mips/tls-ill.l: Update expected error message. * testsuite/gas/sparc/pr19910-1.d: New test driver. * testsuite/gas/sparc/pr19910-1.s: New test. * testsuite/gas/sparc/pr19910-2.l: Expected error output. * testsuite/gas/sparc/pr19910-2.s: New test. * testsuite/gas/sparc/sparc.exp: Run the new tests.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gas/expr.c b/gas/expr.c
index c6c730e..afe46c4 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -508,6 +508,13 @@ integer_constant (int radix, expressionS *expressionP)
&& input_line_pointer - 1 == suffix)
c = *input_line_pointer++;
+#ifndef tc_allow_U_suffix
+#define tc_allow_U_suffix 1
+#endif
+ /* PR 19910: Look for, and ignore, a U suffix to the number. */
+ if (tc_allow_U_suffix && (c == 'U' || c == 'u'))
+ c = * input_line_pointer++;
+
if (small)
{
/* Here with number, in correct radix. c is the next char.
@@ -950,7 +957,13 @@ operand (expressionS *expressionP, enum expr_mode mode)
/* expression () will pass trailing whitespace. */
if ((c == '(' && *input_line_pointer != ')')
|| (c == '[' && *input_line_pointer != ']'))
- as_bad (_("missing '%c'"), c == '(' ? ')' : ']');
+ {
+ if (* input_line_pointer)
+ as_bad (_("found '%c', expected: '%c'"),
+ * input_line_pointer, c == '(' ? ')' : ']');
+ else
+ as_bad (_("missing '%c'"), c == '(' ? ')' : ']');
+ }
else
input_line_pointer++;
SKIP_WHITESPACE ();