This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[obv/commit] Fix PR gdb/21364: Dead code due to an unreachable condition in osdata.c
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>
- Date: Mon, 10 Apr 2017 12:46:49 -0400
- Subject: [obv/commit] Fix PR gdb/21364: Dead code due to an unreachable condition in osdata.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=sergiodj at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C5D7BC04B938
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C5D7BC04B938
Pedro's recent commits enabling -Wwrite-strings has changed a bit the
logic of info_osdata. Now, 'type' is always non-NULL, so we have to
check if it's an empty string instead of NULL. One of the checks was
fixed, but there is another that was left behind. This commit fixes
it.
gdb/ChangeLog:
2017-04-10 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21364
* osdata.c (info_osdata): Check if 'type' is an empty string
instead of NULL.
---
gdb/ChangeLog | 6 ++++++
gdb/osdata.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e49e7a5..2302886 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-10 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR gdb/21364
+ * osdata.c (info_osdata): Check if 'type' is an empty string
+ instead of NULL.
+
2017-04-10 Pedro Alves <palves@redhat.com>
* thread.c (add_thread_silent, delete_thread_1, find_thread_ptid)
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 4b33ccb..84c4ed7 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -318,7 +318,7 @@ info_osdata (const char *type)
for a column named "Title", and only include it with MI
output; this column's normal use is for titles for interface
elements like menus, and it clutters up CLI output. */
- if (!type && !uiout->is_mi_like_p ())
+ if (*type == '\0' && !uiout->is_mi_like_p ())
{
struct osdata_column *col;
int ix;
--
2.9.3