[PATCH] flexmember: new macro FLEXALIGNOF

2016-09-07 Thread Paul Eggert
* lib/flexmember.h: Include , for offsetof. (FLEXALIGNOF): Rename from _GL_XALLOC_ALIGNOF, as Emacs can use this macro. Update comments. --- ChangeLog| 7 +++ lib/flexmember.h | 15 +-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog

Re: [PATCH v2 0/4] New getprogname module

2016-09-07 Thread Jim Meyering
On Wed, Sep 7, 2016 at 10:22 AM, Gisle Vanem wrote: > Jim Meyering wrote: > >> +# elif HAVE_DECL___ARGV >> + return last_component (__argv); > > This should be: > return last_component (*__argv); > > Or with a bit more care: > if (*__argv == NULL) > return ("?"); > return last_componen

Re: [PATCH v2 0/4] New getprogname module

2016-09-07 Thread Gisle Vanem
Jim Meyering wrote: > +# elif HAVE_DECL___ARGV > + return last_component (__argv); This should be: return last_component (*__argv); Or with a bit more care: if (*__argv == NULL) return ("?"); return last_component (__argv); And in the test: +int +main (void) +{ + char const *p = g

Re: [PATCH] flexmember: port better to GCC + valgrind

2016-09-07 Thread Jim Meyering
On Wed, Sep 7, 2016 at 2:03 AM, Paul Eggert wrote: > With a char[] flexible array member in a struct with nontrivial > alignment, GCC-generated code can access past the end of the > array, because GCC assumes there are padding bytes to get the > struct aligned. So the common idiom of malloc (offs

Re: [PATCH v2 0/4] New getprogname module

2016-09-07 Thread Jim Meyering
On Tue, Sep 6, 2016 at 4:22 PM, Jim Meyering wrote: > On Tue, Sep 6, 2016 at 12:38 PM, Gisle Vanem wrote: >> Jim Meyering wrote: >> >>> From the output of that mingw configure run, it appears they are not >>> declared -- at least not in any header included by this particular >>> test program: >>>

[PATCH] flexmember: port better to GCC + valgrind

2016-09-07 Thread Paul Eggert
With a char[] flexible array member in a struct with nontrivial alignment, GCC-generated code can access past the end of the array, because GCC assumes there are padding bytes to get the struct aligned. So the common idiom of malloc (offsetof (struct s, m), n) does not properly allocate an n-byte

Re: [PATCH] getprogname: port to Solaris 10

2016-09-07 Thread Pino Toscano
In data martedì 6 settembre 2016 23:57:05 CEST, Paul Eggert ha scritto: > * lib/getprogname.c: Include stdlib.h, for getexecname decl. > (getprogname) [HAVE_GETEXECNAME]: Use that, for Solaris 10. > * m4/getprogname.m4 (gl_FUNC_GETPROGNAME): Check for getexecname. > --- Thanks for fixing it! --