Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Leszek Swirski <leszeks@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Do not classify C struct members as a filename
Date: Thu, 25 Jan 2018 02:39:00 -0000	[thread overview]
Message-ID: <6c3f1fc7d56feaaa00ade76f51f7421f@polymtl.ca> (raw)
In-Reply-To: <20180124165107.186980-1-leszeks@google.com>

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 <map>
>     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


  reply	other threads:[~2018-01-25  2:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 16:51 Leszek Swirski via gdb-patches
2018-01-25  2:39 ` Simon Marchi [this message]
2018-01-25 10:04   ` Leszek Swirski via gdb-patches
2018-01-25 14:52     ` Simon Marchi
2018-01-25 15:09       ` [PATCH v3] " Leszek Swirski via gdb-patches
2018-01-25 16:00 ` [PATCH v2] " Tom Tromey
2018-01-25 16:20   ` [PATCH v4] " Leszek Swirski via gdb-patches
2018-02-02  3:35     ` Simon Marchi
2018-01-25 16:39   ` [PATCH v2] " Leszek Swirski via gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c3f1fc7d56feaaa00ade76f51f7421f@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=leszeks@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox