summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:51:31 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:51:31 +0200
commit1d67c0c87a56349f7a0169e6bef6385696d86af2 (patch)
treebd9c89e490cb7f7d06965e185aab913e3efb0ea9
parent07f3507442cb3f913000844025ca139925afe110 (diff)
downloadelfutils-1d67c0c87a56349f7a0169e6bef6385696d86af2.tar.gz
lib/
system.h (eu_static_assert): New macro. libdw/ cfi.c: New include system.h. (execute_cfi) (enough_registers): Clear new memory after realloc. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
-rw-r--r--lib/ChangeLog4
-rw-r--r--lib/system.h7
-rw-r--r--libdw/ChangeLog5
-rw-r--r--libdw/cfi.c4
4 files changed, 20 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 47e831ea..46eeeca0 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * system.h (eu_static_assert): New macro.
+
2012-01-21 Ulrich Drepper <drepper@gmail.com>
* Makefile.am (libeu_a_SOURCES): Add color.c.
diff --git a/lib/system.h b/lib/system.h
index 9ac01f89..d9adee9c 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -121,4 +121,11 @@ extern char *color_weak;
extern const char color_off[];
+/* A static assertion. This will cause a compile-time error if EXPR,
+ which must be a compile-time constant, is false. */
+
+#define eu_static_assert(expr) \
+ extern int never_defined_just_used_for_checking[(expr) ? 1 : -1] \
+ __attribute__ ((unused))
+
#endif /* system.h */
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 0d2d5f11..7db34ea5 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * cfi.c: New include system.h.
+ (execute_cfi) (enough_registers): Clear new memory after realloc.
+
+2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* fde.c (__libdw_find_fde): Change <fde != NULL> to likely. Return
DWARF_E_NO_MATCH if .eh_frame_hdr points to FDE which is too short for
searched PC.
diff --git a/libdw/cfi.c b/libdw/cfi.c
index f59f17d6..b1e8d485 100644
--- a/libdw/cfi.c
+++ b/libdw/cfi.c
@@ -35,6 +35,7 @@
#include "cfi.h"
#include "memory-access.h"
#include "encoded-value.h"
+#include "system.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -89,6 +90,9 @@ execute_cfi (Dwarf_CFI *cache,
}
else
{
+ eu_static_assert (reg_unspecified == 0);
+ memset (bigger->regs + bigger->nregs, 0,
+ (reg + 1 - bigger->nregs) * sizeof bigger->regs[0]);
bigger->nregs = reg + 1;
fs = bigger;
}