This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix gdb build with --enable-build-with-cxx --disable-nls
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 15 Apr 2016 23:34:13 -0000
- Subject: [binutils-gdb] Fix gdb build with --enable-build-with-cxx --disable-nls
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2b2798cc9716f45f752ea03411b6f9c9afc17cc6
commit 2b2798cc9716f45f752ea03411b6f9c9afc17cc6
Author: Pedro Alves <palves@redhat.com>
Date: Fri Apr 15 17:08:53 2016 +0100
Fix gdb build with --enable-build-with-cxx --disable-nls
Compiling gdb with --enable-build-with-cxx --disable-nls, we get:
.../src/gdb/ada-lang.c:7657:16: error: invalid conversion from â??const char*â?? to â??char*â?? [-fpermissive]
type_str = (type != NULL
^
In file included from .../src/gdb/common/common-defs.h:67:0,
from .../src/gdb/defs.h:28,
from .../src/gdb/ada-lang.c:21:
.../src/gdb/common/gdb_locale.h:40:27: error: invalid conversion from â??const char*â?? to â??char*â?? [-fpermissive]
# define _(String) (String)
^
.../src/gdb/ada-lang.c:7730:46: note: in expansion of macro â??_â??
char *name_str = name != NULL ? name : _("<null>");
^
Makefile:1140: recipe for target 'ada-lang.o' failed
gdb/ChangeLog:
2016-04-15 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_lookup_struct_elt_type): Constify 'type_str' and
'name_str' locals.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/ada-lang.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f879b8a..c83cd02 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-04-15 Pedro Alves <palves@redhat.com>
+ * ada-lang.c (ada_lookup_struct_elt_type): Constify 'type_str' and
+ 'name_str' locals.
+
+2016-04-15 Pedro Alves <palves@redhat.com>
+
* btrace.c (pt_btrace_insn_flags): Change return type to
btrace_insn_flags. Use btrace_insn_flags for local.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 7cdb693..d01660a 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7649,7 +7649,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
|| (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION))
{
- char *type_str;
+ const char *type_str;
if (noerr)
return NULL;
@@ -7727,7 +7727,7 @@ ada_lookup_struct_elt_type (struct type *type, char *name, int refok,
BadName:
if (!noerr)
{
- char *name_str = name != NULL ? name : _("<null>");
+ const char *name_str = name != NULL ? name : _("<null>");
error (_("Type %s has no component named %s"),
type_as_string_and_cleanup (type), name_str);