This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] [Ada] Fix parsing for expressions with attributes and characters
- From: sergiodj+buildbot at redhat dot com
- To: gdb-testers at sourceware dot org
- Date: Thu, 20 Aug 2015 04:24:32 -0400
- Subject: [binutils-gdb] [Ada] Fix parsing for expressions with attributes and characters
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT af39b3270a1385027b2a5d145b9ba7564bd39f7a ***
Author: Pierre-Marie de Rodat <derodat@adacore.com>
Branch: master
Commit: af39b3270a1385027b2a5d145b9ba7564bd39f7a
[Ada] Fix parsing for expressions with attributes and characters
Before this change, trying to evaluate the following Ada expression
yielded a syntax error, even though it's completely legal:
(gdb) p s'first = 'a'
Error in expression, near `'.
The problem lies in the lexer (gdb/ada-lex.l): at the point we reach "'a'",
we're still in the BEFORE_QUAL_QUOTE start condition (the mechanism to
distinguish character literals from other "tick" usages: qualified
expressions and attributes), so we consider that this quote is actually a
separate "tick".
This changes resets the start condition to INITIAL in the
{TICK}[a-zA-Z][a-zA-Z]+ rule (for attributes): attributes activate this
BEFORE_QUAL_QUOTE condition and in this case the above rule is always
executed rather than the <BEFORE_QUAL_QUOTE>"'" one (in flex, it's
always the longest match that is chosen). We now have instead:
(gdb) p s'first = 'a'
$1 = true
gdb/ChangeLog:
* ada-lex.l: Reset the start condition to INITIAL in the rule
that matches attributes.
gdb/testsuite/ChangeLog:
* gdb.ada/attr_ref_and_charlit.exp: New testcase.
* gdb.ada/attr_ref_and_charlit/foo.adb: New file.
Tested on x86_64-linux, no regression.
- Follow-Ups:
- Failures on Fedora-i686, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master
- Failures on RHEL-s390x-m64, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-native-gdbserver-m64, branch master
- Failures on Fedora-s390x-m64, branch master
- Failures on Debian-i686, branch master
- Failures on Fedora-x86_64-native-gdbserver-m32, branch master
- Failures on AIX-POWER7-plain, branch master
- Failures on Debian-s390x-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-m64, branch master
- Failures on Fedora-ppc64le-native-extended-gdbserver-m64, branch master
- Failures on Debian-i686-native-gdbserver, branch master
- Failures on Fedora-ppc64be-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-cc-with-index, branch master
- Failures on Fedora-ppc64be-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-native-gdbserver-m64, branch master
- Failures on Debian-i686-native-extended-gdbserver, branch master
- Failures on Debian-x86_64-m64, branch master