]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
lib/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 8 Oct 2012 21:51:31 +0000 (23:51 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 8 Oct 2012 21:51:31 +0000 (23:51 +0200)
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>
lib/ChangeLog
lib/system.h
libdw/ChangeLog
libdw/cfi.c

index 47e831ea89c2cdb6a6f24a3cf9ff53a7d56c5420..46eeeca05803a984bd14d02b02e2b96393b073b1 100644 (file)
@@ -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.
index 9ac01f8947797728bce9b20ee3cb6222f7a86cd8..d9adee9c27e4bd997046f0db44db951cf1212504 100644 (file)
@@ -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 */
index 0d2d5f11357a2fc3306582ad06cf7d6d3f5f3a81..7db34ea5d2550696d24b17ac44d25c46415c4f5c 100644 (file)
@@ -1,3 +1,8 @@
+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
index f59f17d6152689a58aacf9a27cf2a815d2f1d5ca..b1e8d4858637c222840b3940802d4592e9647d59 100644 (file)
@@ -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;
            }