From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id E144E3858D28; Mon, 17 Oct 2022 13:57:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E144E3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666015052; bh=E5CoqX2aQBzk4dM2okDTZb0oKvp2BsmzBkmpag9OPYk=; h=From:To:Subject:Date:From; b=uPNNMQGoZQfTe/6L/ZeZnVkmwHMDRWDiKJHWbQLX4j8aW3ffIdo3LVWkPnVSF/U5F OkYyAD9zhLLQKh+zyrLJZIqrw5w6qzIzNrLZV2z+hMoJge+knuQWypdDaxJQNaQpWn NHKfd4BLQN632lPLsW/cBqqJ9kFHuJ/kNKCk13fE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix null pointer representations X-Act-Checkin: binutils-gdb X-Git-Author: TaiseiIto X-Git-Refname: refs/heads/master X-Git-Oldrev: e57f7fa070e16683c0e1ddd0d1307d243fad990d X-Git-Newrev: c7f83b0d14e38e4c3f169b4fc538491782e7d915 Message-Id: <20221017135732.E144E3858D28@sourceware.org> Date: Mon, 17 Oct 2022 13:57:32 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc7f83b0d14e3= 8e4c3f169b4fc538491782e7d915 commit c7f83b0d14e38e4c3f169b4fc538491782e7d915 Author: TaiseiIto Date: Tue Sep 13 22:55:03 2022 +0900 Fix null pointer representations =20 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); =20 /* Must have found some sort of architecture. */ - gdb_assert (info.bfd_arch_info !=3D NULL); + gdb_assert (info.bfd_arch_info !=3D nullptr); =20 if (gdbarch_debug) { gdb_printf (gdb_stdlog, "gdbarch_find_by_info: info.bfd_arch_info %s\n", - (info.bfd_arch_info !=3D NULL + (info.bfd_arch_info !=3D nullptr ? info.bfd_arch_info->printable_name : "(null)")); gdb_printf (gdb_stdlog, @@ -1351,16 +1351,16 @@ gdbarch_find_by_info (struct gdbarch_info info) =20 /* Find the tdep code that knows about this architecture. */ for (rego =3D gdbarch_registry; - rego !=3D NULL; + rego !=3D nullptr; rego =3D rego->next) if (rego->bfd_architecture =3D=3D info.bfd_arch_info->arch) break; - if (rego =3D=3D NULL) + if (rego =3D=3D nullptr) { if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " "No matching architecture\n"); - return 0; + return nullptr; } =20 /* Ask the tdep code for an architecture that matches "info". */ @@ -1368,12 +1368,12 @@ gdbarch_find_by_info (struct gdbarch_info info) =20 /* Did the tdep code like it? No. Reject the change and revert to the old architecture. */ - if (new_gdbarch =3D=3D NULL) + if (new_gdbarch =3D=3D nullptr) { if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " "Target rejected architecture\n"); - return NULL; + return nullptr; } =20 /* 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 =3D ®o->arches; - (*list) !=3D NULL && (*list)->gdbarch !=3D new_gdbarch; + (*list) !=3D nullptr && (*list)->gdbarch !=3D new_gdbarch; list =3D &(*list)->next); /* It had better be in the list of architectures. */ - gdb_assert ((*list) !=3D NULL && (*list)->gdbarch =3D=3D new_gdbarch= ); + gdb_assert ((*list) !=3D nullptr && (*list)->gdbarch =3D=3D new_gdba= rch); /* Unlink SELF. */ self =3D (*list); (*list) =3D self->next;