public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb: fix warnings in bsd-kvm.c
Date: Tue,  3 Aug 2021 18:13:41 -0400	[thread overview]
Message-ID: <20210803221341.15357-1-simon.marchi@polymtl.ca> (raw)

Building on OpenBSD, I get warnings like:

      CXX    bsd-kvm.o
    /home/simark/src/binutils-gdb/gdb/bsd-kvm.c:241:18: error: ISO C++11 does not allow conversion from string literal to 'char *' [-Werror,-Wwritable-strings]
      nl[0].n_name = "_dumppcb";
                     ^

Silence those by adding casts.

Change-Id: I2bef4eebcc306762a4e3e5b5c52f67ecf2820503
---
 gdb/bsd-kvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index d058aac39ec6..5b414309f119 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -238,7 +238,7 @@ bsd_kvm_target::fetch_registers (struct regcache *regcache, int regnum)
   /* On dumping core, BSD kernels store the faulting context (PCB)
      in the variable "dumppcb".  */
   memset (nl, 0, sizeof nl);
-  nl[0].n_name = "_dumppcb";
+  nl[0].n_name = (char *) "_dumppcb";
 
   if (kvm_nlist (core_kd, nl) == -1)
     error (("%s"), kvm_geterr (core_kd));
@@ -256,7 +256,7 @@ bsd_kvm_target::fetch_registers (struct regcache *regcache, int regnum)
      "proc0paddr".  */
 
   memset (nl, 0, sizeof nl);
-  nl[0].n_name = "_proc0paddr";
+  nl[0].n_name = (char *) "_proc0paddr";
 
   if (kvm_nlist (core_kd, nl) == -1)
     error (("%s"), kvm_geterr (core_kd));
@@ -280,7 +280,7 @@ bsd_kvm_target::fetch_registers (struct regcache *regcache, int regnum)
      variable "thread0".  */
 
   memset (nl, 0, sizeof nl);
-  nl[0].n_name = "_thread0";
+  nl[0].n_name = (char *) "_thread0";
 
   if (kvm_nlist (core_kd, nl) == -1)
     error (("%s"), kvm_geterr (core_kd));
-- 
2.32.0


             reply	other threads:[~2021-08-03 22:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 22:13 Simon Marchi [this message]
2021-08-04 15:39 ` John Baldwin
2021-08-04 19:26   ` 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=20210803221341.15357-1-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).