Hi Roland, On Mon, 08 Oct 2012 23:04:25 +0200, Roland McGrath wrote: > Move it into lib/system.
static_assert is C++0x keyword (GDB has gdb_static_assert); but system.h is not exported so I found it OK. Used "system.h", both <system.h> and "system.h" is in use. Thanks, Jan lib/ 2012-10-08 Jan Kratochvil <[email protected]> * system.h (static_assert): New macro. libdw/ 2012-10-08 Jan Kratochvil <[email protected]> * cfi.c: New include system.h. (execute_cfi) (enough_registers): Clear new memory after realloc. diff --git a/lib/system.h b/lib/system.h index 9ac01f8..1996f8b 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 static_assert(expr) \ + extern int __attribute__ ((unused)) \ + never_defined_just_used_for_checking[(expr) ? 1 : -1] + #endif /* system.h */ diff --git a/libdw/cfi.c b/libdw/cfi.c index f59f17d..6aa0bdd 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 { + 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; } _______________________________________________ elfutils-devel mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/elfutils-devel
