Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-23 Thread Eric Blake
On 06/23/2011 03:02 AM, Jim Meyering wrote: > but that would require a different diagnostic, since there > is no "array" involved, so it may be better to leave that for > a separate stack-size-related test. -Wframe-larger-than=4096 might be a useful entry to add to the manywarnings module. -- Er

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-23 Thread Eric Blake
On 06/23/2011 03:02 AM, Jim Meyering wrote: > Eric Blake wrote: >> POSIX allows PATH_MAX to be undefined. And even if you use the >> gnulib pathmax module, where "pathmax.h" guarantees a definition, >> the definition might not be constant or might be so large as to >> be wasteful or cause stack ov

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-23 Thread Eric Blake
On 06/23/2011 06:34 AM, Jim Meyering wrote: >> +# not be constant, or might overflow a stack. In general, use PATH_MAX as >> +# a limit, not an array or alloca size. >> +sc_prohibit_path_max_allocation: >> +@prohibit='(\balloca *\([^)]*|\[[^]]*)PATH_MAX' \ >> +halt='Avoid a

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-23 Thread Jim Meyering
Eric Blake wrote: > On 06/23/2011 03:02 AM, Jim Meyering wrote: >> Eric Blake wrote: >>> POSIX allows PATH_MAX to be undefined. And even if you use the >>> gnulib pathmax module, where "pathmax.h" guarantees a definition, >>> the definition might not be constant or might be so large as to >>> be w

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-23 Thread Jim Meyering
Eric Blake wrote: > POSIX allows PATH_MAX to be undefined. And even if you use the > gnulib pathmax module, where "pathmax.h" guarantees a definition, > the definition might not be constant or might be so large as to > be wasteful or cause stack overflows. PATH_MAX should only be > used as a limi

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-22 Thread Eric Blake
On 06/22/2011 04:21 PM, Paul Eggert wrote: > On 06/22/11 14:53, Eric Blake wrote: >> That's where the joy of per-file exceptions is handy > > Fine, but if I look at (say) Emacs, all six instances > of "[PATH_MAX" are fine. This particular syntax check > may be more trouble than it's worth. It's

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-22 Thread Paul Eggert
On 06/22/11 14:53, Eric Blake wrote: > That's where the joy of per-file exceptions is handy Fine, but if I look at (say) Emacs, all six instances of "[PATH_MAX" are fine. This particular syntax check may be more trouble than it's worth.

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-22 Thread Eric Blake
On 06/22/2011 03:49 PM, Paul Eggert wrote: > On 06/22/11 14:10, Eric Blake wrote: >> +@prohibit='\[PATH''_MAX' > > Doesn't this go too far? For example, gnulib's lib/stat.c does this: > > /* Due to mingw's oddities, ... > Fortunately, mingw PATH_MAX is small enough for stack >

Re: [PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-22 Thread Paul Eggert
On 06/22/11 14:10, Eric Blake wrote: > + @prohibit='\[PATH''_MAX' Doesn't this go too far? For example, gnulib's lib/stat.c does this: /* Due to mingw's oddities, ... Fortunately, mingw PATH_MAX is small enough for stack allocation. */ char fixed_name[PATH_MAX

[PATCH] maint.mk: add syntax-check to avoid char[PATH_MAX]

2011-06-22 Thread Eric Blake
POSIX allows PATH_MAX to be undefined. And even if you use the gnulib pathmax module, where "pathmax.h" guarantees a definition, the definition might not be constant or might be so large as to be wasteful or cause stack overflows. PATH_MAX should only be used as a limit or hueristic, not an array