public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>, Jonathan Wakely <jwakely@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH RFA] tree: define tree_code_type in C++11/14 [PR108634]
Date: Mon, 13 Mar 2023 22:02:40 +0100	[thread overview]
Message-ID: <ZA+PcIydApuyTrma@tucnak> (raw)
In-Reply-To: <20230313201512.151814-1-jason@redhat.com>

On Mon, Mar 13, 2023 at 04:15:12PM -0400, Jason Merrill wrote:
> The r13-6577 change to use tree_code_type_tmpl in earlier C++ dialects broke
> gdbhooks, which expects tree_code_type to always be available.  I considered
> trying to make gdbhooks more robust, but it seemed simpler to define
> tree_code_type as a reference to the template.  This still ends up with a
> definition of the reference in each translation unit, but that's allowed by the
> ODR because it always refers to the same entity, and is much smaller than
> having the whole table in each TU.
> 
> 	PR plugins/108634
> 
> gcc/ChangeLog:
> 
> 	* tree-core.h (tree_code_type, tree_code_length):
> 	Define even without inline variable support.
> 	* tree.h (TREE_CODE_CLASS, TREE_CODE_LENGTH):
> 	Only one definition.

I think it would be better to change gdbhooks.py to match what the code
does.
We should adjust the
        # extern const enum tree_code_class tree_code_type[];
        # #define TREE_CODE_CLASS(CODE) tree_code_type[(int) (CODE)]
comment because that isn't true even for new bootstrap compiler.
And, I just wonder if
        val_tree_code_type = gdb.parse_and_eval('tree_code_type')
couldn't be replaced with
        try:
            val_tree_code_type = gdb.parse_and_eval('tree_code_type')
        except;
            val_tree_code_type = gdb.parse_and_eval('tree_code_type_tmpl<0>::tree_code_type')
or so.

	Jakub


  parent reply	other threads:[~2023-03-13 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 20:15 Jason Merrill
2023-03-13 20:47 ` Jason Merrill
2023-03-13 21:02 ` Jakub Jelinek [this message]
2023-03-13 21:54   ` Jakub Jelinek
2023-03-14 15:42 ` [PATCH] gdbhooks: Update gdbhooks.py for recent tree_code_type changes [PR108634] Jakub Jelinek
2023-03-14 15:54   ` Jason Merrill

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=ZA+PcIydApuyTrma@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).