Improve handling of Fortran keywords

Tom Tromey tromey@redhat.com
Tue Dec 14 17:41:00 GMT 2010


>>>>> "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;



More information about the Gdb-patches mailing list