Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Jack Howarth <howarth.mailing.lists@gmail.com>
Cc: GDB Development <gdb@sourceware.org>
Subject: Re: format string is not a string literal
Date: Tue, 24 Feb 2015 18:18:00 -0000	[thread overview]
Message-ID: <CA+=Sn1kwaPGMeTVL1DOqgUgwX+jD92NvdB5SpXSG5xqiK8NtCg@mail.gmail.com> (raw)
In-Reply-To: <CADtEn-1ZT1uznxPzQxr_nBQya1AVrNLyE+ZSDmm2x_ux8qyzUQ@mail.gmail.com>

On Tue, Feb 24, 2015 at 9:13 AM, Jack Howarth
<howarth.mailing.lists@gmail.com> wrote:
>    Building gdb 7.9 on x86_64-apple-darwin14 produces a number of
> warnings from -Wformat-nonliteral...
>
> darwin-nat.c:184:23: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   vprintf_unfiltered (fmt, ap);
>                       ^~~

Looks like a clang bug because vprintf takes a format and an va_arg
type which means there is no way to tell what the format is going to
look into.
Looks like all are the same clang bug.
Please file a bug with Apple and/or LLVM about this bring broken.

>
> remote.c:6986:37: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   if (vsnprintf (rs->buf, max_size, format, ap) >= max_size)
>                                     ^~~~~~
> /usr/include/secure/_stdio.h:75:63: note: expanded from macro 'vsnprintf'
>   __builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
>                                                               ^


See how they even warn about their own header too.


Thanks,
Andrew

> ctf.c:109:39: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   if (vfprintf (handler->metadata_fd, format, args) < 0)
>                                       ^~~~~~
>
> ./guile/scm-string.c:70:25: warning: format string is not a string
> literal [-Wformat-nonliteral]
>   string = xstrvprintf (format, args);
>                         ^~~~~~
>
> ./guile/scm-utils.c:86:25: warning: format string is not a string
> literal [-Wformat-nonliteral]
>   string = xstrvprintf (format, args);
>                         ^~~~~~
>
> auto-load.c:486:40: warning: format string is not a string literal
> [-Wformat-nonliteral]
>       vfprintf_unfiltered (gdb_stdlog, debug_fmt, debug_args);
>                                        ^~~~~~~~~
>
> complaints.c:188:10: warning: format string is not a string literal
> [-Wformat-nonliteral]
>                        complaint->fmt, args);
>                        ^~~~~~~~~~~~~~
> complaints.c:195:12: warning: format string is not a string literal
> [-Wformat-nonliteral]
>         vwarning (complaint->fmt, args);
>                   ^~~~~~~~~~~~~~
> complaints.c:200:23: warning: format string is not a string literal
> [-Wformat-nonliteral]
>           msg = xstrvprintf (complaint->fmt, args);
>                              ^~~~~~~~~~~~~~
>
> ./compile/compile-object-load.c:235:22: warning: format string is not
> a string literal [-Wformat-nonliteral]
>   str = xstrvprintf (fmt, ap);
>                      ^~~
> ./compile/compile-loc2c.c:453:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~
> ./compile/compile-loc2c.c:470:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~
> ./compile/compile-loc2c.c:485:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~


WARNING: multiple messages have this Message-ID
From: Andrew Pinski <pinskia@gmail.com>
To: Jack Howarth <howarth.mailing.lists@gmail.com>
Cc: GDB Development <gdb@sourceware.org>
Subject: Re: format string is not a string literal
Date: Tue, 24 Feb 2015 18:04:00 -0000	[thread overview]
Message-ID: <CA+=Sn1kwaPGMeTVL1DOqgUgwX+jD92NvdB5SpXSG5xqiK8NtCg@mail.gmail.com> (raw)
Message-ID: <20150224180400.XUib4vIrxPa_GY7lw3Luz87LgxDt3Dnq2-ylTgaCsGk@z> (raw)
In-Reply-To: <CADtEn-1ZT1uznxPzQxr_nBQya1AVrNLyE+ZSDmm2x_ux8qyzUQ@mail.gmail.com>

On Tue, Feb 24, 2015 at 9:13 AM, Jack Howarth
<howarth.mailing.lists@gmail.com> wrote:
>    Building gdb 7.9 on x86_64-apple-darwin14 produces a number of
> warnings from -Wformat-nonliteral...
>
> darwin-nat.c:184:23: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   vprintf_unfiltered (fmt, ap);
>                       ^~~

Looks like a clang bug because vprintf takes a format and an va_arg
type which means there is no way to tell what the format is going to
look into.
Looks like all are the same clang bug.
Please file a bug with Apple and/or LLVM about this bring broken.

>
> remote.c:6986:37: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   if (vsnprintf (rs->buf, max_size, format, ap) >= max_size)
>                                     ^~~~~~
> /usr/include/secure/_stdio.h:75:63: note: expanded from macro 'vsnprintf'
>   __builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
>                                                               ^


See how they even warn about their own header too.


Thanks,
Andrew

> ctf.c:109:39: warning: format string is not a string literal
> [-Wformat-nonliteral]
>   if (vfprintf (handler->metadata_fd, format, args) < 0)
>                                       ^~~~~~
>
> ./guile/scm-string.c:70:25: warning: format string is not a string
> literal [-Wformat-nonliteral]
>   string = xstrvprintf (format, args);
>                         ^~~~~~
>
> ./guile/scm-utils.c:86:25: warning: format string is not a string
> literal [-Wformat-nonliteral]
>   string = xstrvprintf (format, args);
>                         ^~~~~~
>
> auto-load.c:486:40: warning: format string is not a string literal
> [-Wformat-nonliteral]
>       vfprintf_unfiltered (gdb_stdlog, debug_fmt, debug_args);
>                                        ^~~~~~~~~
>
> complaints.c:188:10: warning: format string is not a string literal
> [-Wformat-nonliteral]
>                        complaint->fmt, args);
>                        ^~~~~~~~~~~~~~
> complaints.c:195:12: warning: format string is not a string literal
> [-Wformat-nonliteral]
>         vwarning (complaint->fmt, args);
>                   ^~~~~~~~~~~~~~
> complaints.c:200:23: warning: format string is not a string literal
> [-Wformat-nonliteral]
>           msg = xstrvprintf (complaint->fmt, args);
>                              ^~~~~~~~~~~~~~
>
> ./compile/compile-object-load.c:235:22: warning: format string is not
> a string literal [-Wformat-nonliteral]
>   str = xstrvprintf (fmt, ap);
>                      ^~~
> ./compile/compile-loc2c.c:453:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~
> ./compile/compile-loc2c.c:470:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~
> ./compile/compile-loc2c.c:485:30: warning: format string is not a
> string literal [-Wformat-nonliteral]
>   vfprintf_filtered (stream, format, args);
>                              ^~~~~~


  reply	other threads:[~2015-02-24 18:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 17:16 Jack Howarth
2015-02-24 18:18 ` Andrew Pinski [this message]
2015-02-24 18:04   ` Andrew Pinski
2015-02-25  7:58 ` Paul_Koning
2015-02-26  0:06   ` Jack Howarth
2015-02-26  0:12     ` Paul_Koning
     [not found]       ` <CAFXXi0=56gNf2GoSKkrx=bRArhjk+AhSbiu0crpdR3=df7B2BQ@mail.gmail.com>
2015-02-26  0:46         ` pinskia
2015-02-26  2:31           ` Jack Howarth
2015-02-26  2:35             ` pinskia
2015-02-26  2:38               ` Simon Marchi
2015-02-26  8:39                 ` Andrew Pinski
2015-02-26  8:46                   ` Andrew Pinski
2015-02-26  9:52                     ` Jack Howarth
2015-02-26 10:18                       ` Andrew Pinski
2015-02-26 16:26             ` Pedro Alves
2015-02-26 17:44               ` Jack Howarth
2015-02-26 19:55                 ` Pedro Alves
2015-02-26 18:34               ` Paul Smith
2015-02-26 19:41                 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+=Sn1kwaPGMeTVL1DOqgUgwX+jD92NvdB5SpXSG5xqiK8NtCg@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=howarth.mailing.lists@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox