public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix null pointer representations
@ 2022-09-13 13:55 TaiseiIto
  2022-09-20 18:49 ` Tom Tromey
  2022-10-14 23:42 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: TaiseiIto @ 2022-09-13 13:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: tom, TaiseiIto

Since "NULL" and "0" are used to represent invalid address in function
"gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
them to "nullptr".
---
 gdb/arch-utils.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 9bd4f0ddae6..01111b69d6b 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1326,13 +1326,13 @@ gdbarch_find_by_info (struct gdbarch_info info)
   gdbarch_info_fill (&info);
 
   /* Must have found some sort of architecture.  */
-  gdb_assert (info.bfd_arch_info != NULL);
+  gdb_assert (info.bfd_arch_info != nullptr);
 
   if (gdbarch_debug)
     {
       gdb_printf (gdb_stdlog,
 		  "gdbarch_find_by_info: info.bfd_arch_info %s\n",
-		  (info.bfd_arch_info != NULL
+		  (info.bfd_arch_info != nullptr
 		   ? info.bfd_arch_info->printable_name
 		   : "(null)"));
       gdb_printf (gdb_stdlog,
@@ -1351,16 +1351,16 @@ gdbarch_find_by_info (struct gdbarch_info info)
 
   /* Find the tdep code that knows about this architecture.  */
   for (rego = gdbarch_registry;
-       rego != NULL;
+       rego != nullptr;
        rego = rego->next)
     if (rego->bfd_architecture == info.bfd_arch_info->arch)
       break;
-  if (rego == NULL)
+  if (rego == nullptr)
     {
       if (gdbarch_debug)
 	gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
 		    "No matching architecture\n");
-      return 0;
+      return nullptr;
     }
 
   /* Ask the tdep code for an architecture that matches "info".  */
@@ -1368,12 +1368,12 @@ gdbarch_find_by_info (struct gdbarch_info info)
 
   /* Did the tdep code like it?  No.  Reject the change and revert to
      the old architecture.  */
-  if (new_gdbarch == NULL)
+  if (new_gdbarch == nullptr)
     {
       if (gdbarch_debug)
 	gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
 		    "Target rejected architecture\n");
-      return NULL;
+      return nullptr;
     }
 
   /* Is this a pre-existing architecture (as determined by already
@@ -1390,10 +1390,10 @@ gdbarch_find_by_info (struct gdbarch_info info)
 		    new_gdbarch->bfd_arch_info->printable_name);
       /* Find the existing arch in the list.  */
       for (list = &rego->arches;
-	   (*list) != NULL && (*list)->gdbarch != new_gdbarch;
+	   (*list) != nullptr && (*list)->gdbarch != new_gdbarch;
 	   list = &(*list)->next);
       /* It had better be in the list of architectures.  */
-      gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
+      gdb_assert ((*list) != nullptr && (*list)->gdbarch == new_gdbarch);
       /* Unlink SELF.  */
       self = (*list);
       (*list) = self->next;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix null pointer representations
  2022-09-13 13:55 [PATCH] Fix null pointer representations TaiseiIto
@ 2022-09-20 18:49 ` Tom Tromey
  2022-10-14 23:42 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2022-09-20 18:49 UTC (permalink / raw)
  To: TaiseiIto via Gdb-patches; +Cc: TaiseiIto, tom

>>>>> TaiseiIto via Gdb-patches <gdb-patches@sourceware.org> writes:

> Since "NULL" and "0" are used to represent invalid address in function
> "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
> them to "nullptr".

Thank you, this is ok.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix null pointer representations
  2022-09-13 13:55 [PATCH] Fix null pointer representations TaiseiIto
  2022-09-20 18:49 ` Tom Tromey
@ 2022-10-14 23:42 ` Tom Tromey
  2022-10-17 13:18   ` Tom Tromey
  1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2022-10-14 23:42 UTC (permalink / raw)
  To: TaiseiIto; +Cc: gdb-patches, tom

>>>>> TaiseiIto  <taisei1212@outlook.jp> writes:

> Since "NULL" and "0" are used to represent invalid address in function
> "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
> them to "nullptr".

I don't think there was a reply to this updated patch?
Anyway it is ok, please check it in.  Thank you.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix null pointer representations
  2022-10-14 23:42 ` Tom Tromey
@ 2022-10-17 13:18   ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2022-10-17 13:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: TaiseiIto, gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

>>>>> TaiseiIto  <taisei1212@outlook.jp> writes:
>> Since "NULL" and "0" are used to represent invalid address in function
>> "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
>> them to "nullptr".

Tom> I don't think there was a reply to this updated patch?
Tom> Anyway it is ok, please check it in.  Thank you.

I discussed this off-list with the author, and I'm going to push it now.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-17 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 13:55 [PATCH] Fix null pointer representations TaiseiIto
2022-09-20 18:49 ` Tom Tromey
2022-10-14 23:42 ` Tom Tromey
2022-10-17 13:18   ` Tom Tromey

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).