From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 435 invoked by alias); 15 Dec 2010 19:28:20 -0000 Received: (qmail 425 invoked by uid 22791); 15 Dec 2010 19:28:20 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 19:28:15 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBFJS8CY031352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Dec 2010 14:28:08 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBFJS7MB017422; Wed, 15 Dec 2010 14:28:07 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oBFJS6xn019529; Wed, 15 Dec 2010 14:28:07 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 5488A379182; Wed, 15 Dec 2010 12:28:05 -0700 (MST) From: Tom Tromey To: Greg Watson Cc: gdb-patches@sourceware.org Subject: Re: Improve handling of Fortran keywords References: <5503A4B2-EB18-40A9-9182-27E05D73D0EF@computer.org> <9574F1C6-076E-44C8-A487-D97CA5088D54@computer.org> Date: Wed, 15 Dec 2010 19:28:00 -0000 In-Reply-To: <9574F1C6-076E-44C8-A487-D97CA5088D54@computer.org> (Greg Watson's message of "Wed, 15 Dec 2010 13:51:55 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00318.txt.bz2 >>>>> "Greg" == Greg Watson 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 * 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;