On Tue, Jun 11, 2019 at 03:58:27PM +0000, Michael Matz wrote:
> On Tue, 11 Jun 2019, Martin Liška wrote:
>
> > I see 3 occurrences of the alloca (0) in libiberty/regex.c, but there are
> > properly
> > guarded within:
> >
> > # ifdef C_ALLOCA
> > alloca (0);
> > # endif
> >
> > and then I noticed 2 more occurrences in gdb that break build right now:
> >
> > gdb/regcache.c: alloca (0);
> > gdb/top.c: alloca (0);
> >
> > Is it the right approach to remove these 2 in gdb?
>
> It's more an indication that the annotation requesting the warning for
> unused results is simply overeager (aka wrong) for alloca. (sure, the
> uses in gdb probably could be cleaned up as well, but that doesn't affect
> the wrongness of the warning).
Yeah. Either we special-case alloca in the warn_unused_result code
- if the call flags include ECF_MAY_BE_ALLOCA and argument is 0, don't warn,
or don't add the attribute to alloca, or add yet another attribute that will
be used for alloca only.
Jakub