This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix compile-cplus-types.c build errors
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 30 Aug 2018 15:10:20 -0000
- Subject: [binutils-gdb] Fix compile-cplus-types.c build errors
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a0dc02a6df86011462293cc11b4e35c0f18effd0
commit a0dc02a6df86011462293cc11b4e35c0f18effd0
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Thu Aug 30 11:09:48 2018 -0400
Fix compile-cplus-types.c build errors
I see these errors when building with clang:
CXX compile/compile-cplus-types.o
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs]
fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
~~ ^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags<gcc_cp_qualifiers>::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare]
if (quals != GCC_CP_REF_QUAL_NONE)
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
Fix the first one by using host_address_to_string.
Fix the second one by comparing to 0 instead. I think the current
comparison simply uses the wrong enum type. Comparing to 0 seems like
the right thing to do, because we want to check whether any flags are
specified.
gdb/ChangeLog:
* compile/compile-cplus-types.c
(compile_cplus_instance::leave_scope): Take the address of scope
object.
(compile_cplus_instance::convert_qualified_base): Compare quals
to 0.
Diff:
---
gdb/ChangeLog | 8 ++++++++
gdb/compile/compile-cplus-types.c | 7 +++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2e59caf..66c2e33 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2018-08-30 Simon Marchi <simon.marchi@ericsson.com>
+
+ * compile/compile-cplus-types.c
+ (compile_cplus_instance::leave_scope): Take the address of scope
+ object.
+ (compile_cplus_instance::convert_qualified_base): Compare quals
+ to 0.
+
2018-08-30 Keith Seitz <keiths@redhat.com>
* compile/compile-cplus-types.c (compile_cplus_instance::enter_scope):
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index e86a573..7fc4136 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -306,7 +306,10 @@ compile_cplus_instance::leave_scope ()
if (current.m_pushed)
{
if (debug_compile_cplus_scopes)
- fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
+ {
+ fprintf_unfiltered (gdb_stdlog, "leaving scope %s\n",
+ host_address_to_string (¤t));
+ }
/* Pop namespaces. */
std::for_each
@@ -1058,7 +1061,7 @@ compile_cplus_instance::convert_qualified_base (gcc_type base,
{
gcc_type result = base;
- if (quals != GCC_CP_REF_QUAL_NONE)
+ if (quals != 0)
result = plugin ().build_qualified_type (base, quals);
return result;