public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: fix warnings in bsd-kvm.c
@ 2021-08-03 22:13 Simon Marchi
  2021-08-04 15:39 ` John Baldwin
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2021-08-03 22:13 UTC (permalink / raw)
  To: gdb-patches

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


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

* Re: [PATCH] gdb: fix warnings in bsd-kvm.c
  2021-08-03 22:13 [PATCH] gdb: fix warnings in bsd-kvm.c Simon Marchi
@ 2021-08-04 15:39 ` John Baldwin
  2021-08-04 19:26   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: John Baldwin @ 2021-08-04 15:39 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 8/3/21 3:13 PM, Simon Marchi via Gdb-patches wrote:
> 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.

LGTM

-- 
John Baldwin

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

* Re: [PATCH] gdb: fix warnings in bsd-kvm.c
  2021-08-04 15:39 ` John Baldwin
@ 2021-08-04 19:26   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2021-08-04 19:26 UTC (permalink / raw)
  To: John Baldwin, gdb-patches



On 2021-08-04 11:39 a.m., John Baldwin wrote:
> On 8/3/21 3:13 PM, Simon Marchi via Gdb-patches wrote:
>> 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.
> 
> LGTM
> 

Pushed, thanks.

Simon

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

end of thread, other threads:[~2021-08-04 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 22:13 [PATCH] gdb: fix warnings in bsd-kvm.c Simon Marchi
2021-08-04 15:39 ` John Baldwin
2021-08-04 19:26   ` Simon Marchi

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