This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Improve handling of Fortran keywords
- From: Tom Tromey <tromey at redhat dot com>
- To: Greg Watson <g dot watson at computer dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 14 Dec 2010 10:41:14 -0700
- Subject: Re: Improve handling of Fortran keywords
- References: <5503A4B2-EB18-40A9-9182-27E05D73D0EF@computer.org>
>>>>> "Greg" == Greg Watson <g.watson@computer.org> writes:
Greg> Currently, gdb 7.2 will not allow me to use identifier names such
Greg> as "integer_var" as it treats the first "integer" part as a
Greg> keyword without checking that the identifier is actually longer
Greg> than the keyword. Here's a simple patch to fix this (and make
Greg> Fortran debugging more useful).
Could you try this patch instead?
I think it should have the same effect, but it is simpler.
Tom
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 415819a..487b00d 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1150,8 +1150,7 @@ yylex ()
/* Catch specific keywords. */
for (i = 0; f77_keywords[i].operator != NULL; i++)
- if (strncmp (tokstart, f77_keywords[i].operator,
- strlen(f77_keywords[i].operator)) == 0)
+ if (strncmp (tokstart, f77_keywords[i].operator, namelen)) == 0)
{
/* lexptr += strlen(f77_keywords[i].operator); */
yylval.opcode = f77_keywords[i].opcode;