From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [pushed] dwarf2read: Silence -Wenum-compare-switch warning
Date: Sun, 31 Dec 2017 02:27:00 -0000 [thread overview]
Message-ID: <1514687209-2126-1-git-send-email-simon.marchi@ericsson.com> (raw)
Compiling with Clang 6 gives:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24385:14: error: comparison of two values with different enumeration types in switch statement ('enum dwarf_macro_record_type' and 'dwarf_macinfo_record_type') [-Werror,-Wenum-compare-switch]
case DW_MACINFO_vendor_ext:
^~~~~~~~~~~~~~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24561:7: error: comparison of two values with different enumeration types in switch statement ('enum dwarf_macro_record_type' and 'dwarf_macinfo_record_type') [-Werror,-Wenum-compare-switch]
case DW_MACINFO_vendor_ext:
^~~~~~~~~~~~~~~~~~~~~
This code uses the two enum types on purpose, because it handles both
.debug_macro and .debug_macinfo sections. Add some pragmas to disable
the warning in these specific cases.
gdb/ChangeLog:
* dwarf2read.c (dwarf_decode_macro_bytes): Ignore
-Wenum-compare-switch warning.
(dwarf_decode_macros): Likewise.
---
gdb/ChangeLog | 6 ++++++
gdb/dwarf2read.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 54b7041..7689e0e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-30 Simon Marchi <simon.marchi@ericsson.com>
+
+ * dwarf2read.c (dwarf_decode_macro_bytes): Ignore
+ -Wenum-compare-switch warning.
+ (dwarf_decode_macros): Likewise.
+
2017-12-30 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 85e33f0..fcd5e99 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -24179,6 +24179,8 @@ dwarf_decode_macro_bytes (bfd *abfd,
/* Note that we rely on the fact that the corresponding GNU and
DWARF constants are the same. */
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
switch (macinfo_type)
{
/* A zero macinfo type indicates the end of the macro
@@ -24403,6 +24405,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
return;
break;
}
+ DIAGNOSTIC_POP
} while (macinfo_type != 0);
}
@@ -24495,6 +24498,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
/* Note that we rely on the fact that the corresponding GNU and
DWARF constants are the same. */
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
switch (macinfo_type)
{
/* A zero macinfo type indicates the end of the macro
@@ -24575,6 +24580,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
return;
break;
}
+ DIAGNOSTIC_POP
} while (macinfo_type != 0 && current_file == NULL);
/* Second pass: Process all entries.
--
2.7.4
reply other threads:[~2017-12-31 2:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1514687209-2126-1-git-send-email-simon.marchi@ericsson.com \
--to=simon.marchi@ericsson.com \
--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).