public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH v2 04/10] gdb: gdbarch.py: remove Info.__init__
Date: Fri, 24 Feb 2023 22:30:41 -0500	[thread overview]
Message-ID: <20230225033047.373899-5-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20230225033047.373899-1-simon.marchi@polymtl.ca>

Info.__init__ currently assigns `self.predicate = None`.  This was
helpful to ensure that all component types had a `predicate` attribute.
The generator code could then avoid having code like "if the component
is anything but Info, use predicate".  Since the previous commit, all
component types have a predicate attribute which defaults to False.  We
can therefore remove the assignment in Info.__init__, and in turn remove
Info.__init__.  We however need to make the printer parameter of
_Component.__init__ optional, as Info don't need a printer.

Change-Id: I611edeca9cc9837eb49dddfe038595e1ff3b7239
---
 gdb/gdbarch.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gdb/gdbarch.py b/gdb/gdbarch.py
index 63c3aee1dc0e..f97f39b6db0f 100755
--- a/gdb/gdbarch.py
+++ b/gdb/gdbarch.py
@@ -53,7 +53,7 @@ class _Component:
         self,
         name,
         type,
-        printer,
+        printer=None,
         comment=None,
         predicate=False,
         predefault=None,
@@ -97,11 +97,6 @@ class _Component:
 class Info(_Component):
     "An Info component is copied from the gdbarch_info."
 
-    def __init__(self, *, name, type, printer=None):
-        super().__init__(name=name, type=type, printer=printer)
-        # This little hack makes the generator a bit simpler.
-        self.predicate = None
-
 
 class Value(_Component):
     "A Value component is just a data member."
-- 
2.39.2


  parent reply	other threads:[~2023-02-25  3:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-25  3:30 [PATCH v2 00/10] Add typing annotations to gdbarch*.py and make-target-delegates.py Simon Marchi
2023-02-25  3:30 ` [PATCH v2 01/10] gdb: remove invalid / dead code from gdbarch.py Simon Marchi
2023-02-25  3:30 ` [PATCH v2 02/10] gdb: reformat Python files with black 23.1.0 Simon Marchi
2023-02-25  3:30 ` [PATCH v2 03/10] gdb: gdbarch.py: spell out parameters of _Component.__init__ Simon Marchi
2023-02-25  3:30 ` Simon Marchi [this message]
2023-02-25  3:30 ` [PATCH v2 05/10] gdb: pyproject.toml: set pyright typeCheckingMode = "strict" Simon Marchi
2023-02-25  3:30 ` [PATCH v2 06/10] gdb: split gdbarch component types to gdbarch_types.py Simon Marchi
2023-02-25  3:30 ` [PATCH v2 07/10] gdb: gdbarch*.py, copyright.py: add type annotations Simon Marchi
2023-02-25  3:30 ` [PATCH v2 08/10] gdb: make-target-delegates.py: make one string raw Simon Marchi
2023-02-25  3:30 ` [PATCH v2 09/10] gdb: make-target-delegates.py: add Entry type Simon Marchi
2023-02-25  3:30 ` [PATCH v2 10/10] gdb: make-target-delegates.py: add type annotations Simon Marchi
2023-02-25 11:05 ` [PATCH v2 00/10] Add typing annotations to gdbarch*.py and make-target-delegates.py Andrew Burgess
2023-02-27  1:11   ` Simon Marchi

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=20230225033047.373899-5-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    /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).