Re: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread DJ Delorie
> FWIW I'm not in love with the name of the macro, but I find it useful. > In the initial version of patches 10 and 12 (state purging within "gas" > and "ld" subdirs) I didn't have this macro, and had about 30 memset > invocations. Another option is to save the state as it was initialized, and re

Re: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread David Malcolm
On Mon, 2015-06-01 at 17:47 -0400, DJ Delorie wrote: > > +/* Fill an lvalue with zero bits. */ > > +#define CLEAR_VAR(S) \ > > + do { memset (&(S), 0, sizeof (S)); } while (0) > > Hmmm... I don't see the point in this. The macro is almost as long as > a bare memset() would be, and replaces a we

Re: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread DJ Delorie
> +/* Fill an lvalue with zero bits. */ > +#define CLEAR_VAR(S) \ > + do { memset (&(S), 0, sizeof (S)); } while (0) Hmmm... I don't see the point in this. The macro is almost as long as a bare memset() would be, and replaces a well-known function with something unknown outside this project.

[PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro

2015-06-01 Thread David Malcolm
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 v