From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12444 invoked by alias); 25 Jan 2018 02:39:12 -0000 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 Received: (qmail 12376 invoked by uid 89); 25 Jan 2018 02:39:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jan 2018 02:39:05 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w0P2cwBO014150 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 24 Jan 2018 21:39:03 -0500 Received: by simark.ca (Postfix, from userid 112) id B06E71E5B7; Wed, 24 Jan 2018 21:38:58 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 8DA461E512; Wed, 24 Jan 2018 21:38:56 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 25 Jan 2018 02:39:00 -0000 From: Simon Marchi To: Leszek Swirski Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2] Do not classify C struct members as a filename In-Reply-To: <20180124165107.186980-1-leszeks@google.com> References: <20180124165107.186980-1-leszeks@google.com> Message-ID: <6c3f1fc7d56feaaa00ade76f51f7421f@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 25 Jan 2018 02:38:58 +0000 X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00495.txt.bz2 On 2018-01-24 11:51, Leszek Swirski via gdb-patches wrote: > There is existing logic in C/C++ expression parsing to avoid > classifying > names as a filename when they are a field on the this object. This > change extends this logic to also avoid classifying names after a > struct-op (-> or .) as a filename, which otherwise causes a syntax > error. > > Thus, it is now possible in the file > > #include > struct D { > void map(); > } > D d; > > to call > > (gdb) print d.map() > > where previously this would have been a syntax error. > > Tested on gdb.cp/*.exp Hi Leszek, I was able to reproduce the problem and confirmed that the patch fixes it. I'm not very strong in the lexing/parsing area, but the change in c-exp.y makes sense to me. I'd like to give others a chance to comment, so let's wait a few days. If nobody answer, we can merge it. One nit, since we are now using C++, can you use bool instead of int? It won't match the old surrounding code, but that's a good reason to modernize the existing code later :). Do you know if we have a test for the same thing, but with the "this" pointer (which was already worked before this patch)? If not, it would be nice to add it to the test as well. You could add a call to D::includefile and continue/break there. From there, you could test calling this->includefile(). Simon