This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 1 Jun 2015 17:04:16 -0400
- Subject: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro
- Authentication-results: sourceware.org; auth=none
- References: <1433192664-50156-1-git-send-email-dmalcolm at redhat dot com>
include/ChangeLog:
* libiberty.h (CLEAR_VAR): New macro.
---
include/libiberty.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/libiberty.h b/include/libiberty.h
index b33dd65..93e4131 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -699,6 +699,10 @@ extern void stack_limit_increase (unsigned long);
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+/* Fill an lvalue with zero bits. */
+#define CLEAR_VAR(S) \
+ do { memset (&(S), 0, sizeof (S)); } while (0)
+
/* Drastically simplified alloca configurator. If we're using GCC,
we use __builtin_alloca; otherwise we use the C alloca. The C
alloca is always available. You can override GCC by defining
--
1.8.5.3