Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Andreas Schwab <schwab@linux-m68k.org>,
	Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Make target_read_alloc & al return vectors
Date: Sat, 07 Jul 2018 15:17:00 -0000	[thread overview]
Message-ID: <385ac6f2-e88a-0c40-25a2-d915cc86229c@simark.ca> (raw)
In-Reply-To: <5ead66c6-e0cb-c9b6-b882-79c232cc389c@simark.ca>

On 2018-07-07 11:10 AM, Simon Marchi wrote:
> In file included from /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:39:
> /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
>  static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
>  ^~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
>  #define STRINGIFY_1(x) #x
>                          ^

Actually, it was quite obvious, so I just pushed this patch.

Simon


From e83f4d97504515f8c5f290eeb25eac87cca6892f Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Sat, 7 Jul 2018 11:13:14 -0400
Subject: [PATCH] ia64-tdep.c: Fix -Wwrite-strings errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Simply add const where necessary to get rid of errors like:

/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
 static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
 ^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
 #define STRINGIFY_1(x) #x
                         ^
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:29: note: in expansion of macro ‘STRINGIFY’
 static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
                             ^~~~~~~~~

gdb/ChangeLog:

	* ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name,
	is_signal_frame_name, step_name, init_remote_name,
	create_addr_space_name, destroy_addr_space_name,
	search_unwind_table_name, find_dyn_list_name): Constify.
---
 gdb/ChangeLog             |  7 +++++++
 gdb/ia64-libunwind-tdep.c | 22 ++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 17146e810a37..076f571e2a8b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-07  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name,
+	is_signal_frame_name, step_name, init_remote_name,
+	create_addr_space_name, destroy_addr_space_name,
+	search_unwind_table_name, find_dyn_list_name): Constify.
+
 2018-07-05  Simon Marchi  <simon.marchi@polymtl.ca>

 	* darwin-nat.c (darwin_pthread_kill): New function.
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index 99782b2d7016..b7eef4ac644a 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -111,17 +111,19 @@ struct libunwind_frame_cache
 #define LIBUNWIND_SO_7 "libunwind-" STRINGIFY(UNW_TARGET) ".so.7"
 #endif

-static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
-static char *get_fpreg_name = STRINGIFY(UNW_OBJ(get_fpreg));
-static char *get_saveloc_name = STRINGIFY(UNW_OBJ(get_save_loc));
-static char *is_signal_frame_name = STRINGIFY(UNW_OBJ(is_signal_frame));
-static char *step_name = STRINGIFY(UNW_OBJ(step));
-static char *init_remote_name = STRINGIFY(UNW_OBJ(init_remote));
-static char *create_addr_space_name = STRINGIFY(UNW_OBJ(create_addr_space));
-static char *destroy_addr_space_name = STRINGIFY(UNW_OBJ(destroy_addr_space));
-static char *search_unwind_table_name
+static const char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
+static const char *get_fpreg_name = STRINGIFY(UNW_OBJ(get_fpreg));
+static const char *get_saveloc_name = STRINGIFY(UNW_OBJ(get_save_loc));
+static const char *is_signal_frame_name = STRINGIFY(UNW_OBJ(is_signal_frame));
+static const char *step_name = STRINGIFY(UNW_OBJ(step));
+static const char *init_remote_name = STRINGIFY(UNW_OBJ(init_remote));
+static const char *create_addr_space_name
+  = STRINGIFY(UNW_OBJ(create_addr_space));
+static const char *destroy_addr_space_name
+  = STRINGIFY(UNW_OBJ(destroy_addr_space));
+static const char *search_unwind_table_name
   = STRINGIFY(UNW_OBJ(search_unwind_table));
-static char *find_dyn_list_name = STRINGIFY(UNW_OBJ(find_dyn_list));
+static const char *find_dyn_list_name = STRINGIFY(UNW_OBJ(find_dyn_list));

 static struct libunwind_descr *
 libunwind_descr (struct gdbarch *gdbarch)
-- 
2.18.0



  reply	other threads:[~2018-07-07 15:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22  4:03 Simon Marchi
2018-04-07 17:21 ` Simon Marchi
2018-04-16 20:04 ` Pedro Alves
2018-04-16 20:51   ` [pushed] linux_spu_make_corefile_notes: return note_data instead of nullptr (was: [PATCH] Make target_read_alloc & al return vectors) Simon Marchi
2018-07-07  8:54 ` [PATCH] Make target_read_alloc & al return vectors Andreas Schwab
2018-07-07 15:10   ` Simon Marchi
2018-07-07 15:17     ` Simon Marchi [this message]
2018-07-07 19:32       ` Andreas Schwab
2018-07-07 17:23     ` Andreas Schwab
2018-07-07 17:58       ` Simon Marchi
2018-07-07 18:24         ` Andreas Schwab
2018-07-16 18:02     ` 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=385ac6f2-e88a-0c40-25a2-d915cc86229c@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=simon.marchi@ericsson.com \
    /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