This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] New debug_displays_assert [Re: readelf broken by DWARF-5 patch]


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];

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]