From: Jan Kratochvil Date: Mon, 8 Oct 2012 21:51:31 +0000 (+0200) Subject: lib/ X-Git-Tag: elfutils-0.156~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d67c0c87a56349f7a0169e6bef6385696d86af2;p=thirdparty%2Felfutils.git 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 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 47e831ea8..46eeeca05 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2012-10-08 Jan Kratochvil + + * system.h (eu_static_assert): New macro. + 2012-01-21 Ulrich Drepper * Makefile.am (libeu_a_SOURCES): Add color.c. diff --git a/lib/system.h b/lib/system.h index 9ac01f894..d9adee9c2 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 0d2d5f113..7db34ea5d 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2012-10-08 Jan Kratochvil + + * cfi.c: New include system.h. + (execute_cfi) (enough_registers): Clear new memory after realloc. + 2012-10-08 Jan Kratochvil * fde.c (__libdw_find_fde): Change to likely. Return diff --git a/libdw/cfi.c b/libdw/cfi.c index f59f17d61..b1e8d4858 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 #include #include @@ -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; }