This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Improve handling of Fortran keywords


>>>>> "Greg" == Greg Watson <g.watson@computer.org> writes:

Greg> Nope, this is not going to work. If the identifier being printed
Greg> is shorter than the keyword, they will match. You really have to
Greg> check the length as well.

Oops, duh.

Greg> If you want to use namelen, then I think this is the minimum
Greg> required change.

Thanks.

I am checking it in.  Here is the final patch with ChangeLog entry.

Tom

2010-12-15  Greg Watson  <g.watson@computer.org>

	* f-exp.y (yylex): Check entire token against keywords.

Index: f-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/f-exp.y,v
retrieving revision 1.33
diff -u -r1.33 f-exp.y
--- f-exp.y	2 Jun 2010 22:41:55 -0000	1.33
+++ f-exp.y	15 Dec 2010 19:20:18 -0000
@@ -1150,8 +1150,8 @@
   /* 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 (strlen (f77_keywords[i].operator) == namelen
+	&& strncmp (tokstart, f77_keywords[i].operator, namelen) == 0)
       {
 	/* 	lexptr += strlen(f77_keywords[i].operator); */ 
 	yylval.opcode = f77_keywords[i].opcode;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]