Re: a few more patches

Craig Small <[email protected]> Fri, 18 Feb 2022 15:29:48 +1100
Newsgroups gmane.linux.procps.devel
Message-ID <CALy8Cw7Z8bgdi3xpEZdsc34VvjtMSMLcSWoswyEgms_EGVD7QA@mail.gmail.com>
Hi Jim,
  I'm using gcc version 11.2.0 (Debian 11.2.0-13)

Did you try it with my small test program and -Wformat ?

The question is, who's GCC is doing the right thing?

 - Craig


On Thu, 17 Feb 2022 at 20:48, Jim Warner <[email protected]> wrote:

> On 2/17/22 1:47 AM, Craig Small wrote:
> > I can't find an email if I gave specifics about the warnings or not, but
> > they are below.
> >
> > This seems a bit of a bogus warning. You are using snprintf() with a %s
> > which could be a long string and limiting it to 4 characters.
> > The issue is, not checking the return value. But! you know what the
> > source string is (another window name) so it won't be larger than 4 and
> > truncate.
> >
> > There are probably three ways ahead with this:
> >   * Disable the warning when using --enable-harden-flags
> >   * Add a compiler note to not complain
> >   * Change the top.c code to check the return value
> >
> > I see not a lot of value of this warning, especially in this context;
> > what's your view?
>
> Hi Craig,
>
> I can't generate this warning no matter what options or CFLAGS I use.
>
> My gcc is 11.2.0.
>
> What's yours?
>
> Regards,
>
> Jim
>