public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix null pointer representations Date: Mon, 17 Oct 2022 13:57:32 +0000 (GMT) [thread overview] Message-ID: <20221017135732.E144E3858D28@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c7f83b0d14e38e4c3f169b4fc538491782e7d915 commit c7f83b0d14e38e4c3f169b4fc538491782e7d915 Author: TaiseiIto <taisei1212@outlook.jp> Date: Tue Sep 13 22:55:03 2022 +0900 Fix null pointer representations 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". Diff: --- 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 100348444c0..6a72b3f5efd 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 = ®o->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;
reply other threads:[~2022-10-17 13:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221017135732.E144E3858D28@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).