public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/95312] New: Missing quoting of format directives emitted by -Wformat
@ 2020-05-25  9:55 asolokha at gmx dot com
  2020-05-25 10:01 ` [Bug c/95312] " asolokha at gmx dot com
  0 siblings, 1 reply; 2+ messages in thread
From: asolokha at gmx dot com @ 2020-05-25  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95312

            Bug ID: 95312
           Summary: Missing quoting of format directives emitted by
                    -Wformat
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

All gcc since 4.6, where -Wformat was initially introduced, emit the following
when compiling snippets like that w/ -Wformat:

#include <stdio.h>

int
foo (FILE *f, char *s)
{
  return fscanf (f, "%c%[^\n\n]", s);
}

% gcc-11.0.0 -fsyntax-only -Wformat -c po6k6b4n.c
po6k6b4n.c: In function 'foo':
po6k6b4n.c:6:29: warning: format '%[^

   ' expects a matching 'char *' argument [-Wformat=]
    6 |   return fscanf (f, "%c%[^\n\n]", s);
      |                        ~~~~~^~
      |                             |
      |                             char *

It seems wrong to me that the format directive is not quoted in the warning
text.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/95312] Missing quoting of format directives emitted by -Wformat
  2020-05-25  9:55 [Bug c/95312] New: Missing quoting of format directives emitted by -Wformat asolokha at gmx dot com
@ 2020-05-25 10:01 ` asolokha at gmx dot com
  0 siblings, 0 replies; 2+ messages in thread
From: asolokha at gmx dot com @ 2020-05-25 10:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95312

--- Comment #1 from Arseny Solokha <asolokha at gmx dot com> ---
(In reply to Arseny Solokha from comment #0)
> All gcc since 4.6, where -Wformat was initially introduced

(Well, it of course was introduced much earlier, but since that release it
started emitting verbose diagnostics instead of "too few arguments for
format".)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-25 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  9:55 [Bug c/95312] New: Missing quoting of format directives emitted by -Wformat asolokha at gmx dot com
2020-05-25 10:01 ` [Bug c/95312] " asolokha at gmx dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).