This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] New debug_displays_assert [Re: readelf broken by DWARF-5 patch]
- From: Jan Kratochvil <jkratoch at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 2 Mar 2017 10:17:11 +0100
- Subject: [patch] New debug_displays_assert [Re: readelf broken by DWARF-5 patch]
- Authentication-results: sourceware.org; auth=none
- References: <20170302025004.GD3924@bubble.grove.modra.org>
Hi Alan,
On Thu, 02 Mar 2017 03:50:05 +0100, Alan Modra wrote:
> Jan, your DWARF-5 patch broke readelf, because new entries were added
> to dwarf.c:debug_displays without making corresponding changes to
> dwarf.h:dwarf_section_display_enum. Please fix.
Is this patch OK for check-in? As binutils still does not use C++ the
static_assert() functionality is copied from gdb_static_assert().
Jan
binutils/
2017-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (debug_displays_assert): New static assertion.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index ad0bfcf..fdfbc16 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -8591,3 +8591,6 @@ struct dwarf_section_display debug_displays[] =
{ { ".debug_tu_index", "", NULL, NULL, 0, 0, 0, NULL, 0, NULL },
display_cu_index, &do_debug_cu_index, FALSE },
};
+
+/* A static assertion. */
+extern int debug_displays_assert[ARRAY_SIZE (debug_displays) == max ? 1 : -1];