public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67957] New: gcc's printf attribute accepts %m as a format character
@ 2015-10-13 15:17 christos at zoulas dot com
  2015-10-13 15:18 ` [Bug c/67957] " christos at zoulas dot com
  2015-10-13 15:33 ` schwab@linux-m68k.org
  0 siblings, 2 replies; 3+ messages in thread
From: christos at zoulas dot com @ 2015-10-13 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67957
           Summary: gcc's printf attribute accepts %m as a format
                    character
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christos at zoulas dot com
  Target Milestone: ---

According to TOG
(http://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html), %m is
not a legal formatting character for printf(3) like functions. Some
implementations (glibc) accept this formatting character as an extension and
expand it to the error string via strerror(3) that errno currently points to.
Most other c library implementations do not expand %m. 

Attached is a patch that makes printf warn when %m is present and adds a
"syslog" attribute that accepts %m. I recognize that this is an incompatible
change, and I welcome suggestions how to do this in a less intrusive way.

I tried to mininize the size of the patch; there are better ways to do this,
but require more refactoring.


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

* [Bug c/67957] gcc's printf attribute accepts %m as a format character
  2015-10-13 15:17 [Bug c/67957] New: gcc's printf attribute accepts %m as a format character christos at zoulas dot com
@ 2015-10-13 15:18 ` christos at zoulas dot com
  2015-10-13 15:33 ` schwab@linux-m68k.org
  1 sibling, 0 replies; 3+ messages in thread
From: christos at zoulas dot com @ 2015-10-13 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Christos Zoulas <christos at zoulas dot com> ---
Created attachment 36504
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36504&action=edit
patch


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

* [Bug c/67957] gcc's printf attribute accepts %m as a format character
  2015-10-13 15:17 [Bug c/67957] New: gcc's printf attribute accepts %m as a format character christos at zoulas dot com
  2015-10-13 15:18 ` [Bug c/67957] " christos at zoulas dot com
@ 2015-10-13 15:33 ` schwab@linux-m68k.org
  1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2015-10-13 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
.

*** This bug has been marked as a duplicate of bug 67956 ***


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

end of thread, other threads:[~2015-10-13 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 15:17 [Bug c/67957] New: gcc's printf attribute accepts %m as a format character christos at zoulas dot com
2015-10-13 15:18 ` [Bug c/67957] " christos at zoulas dot com
2015-10-13 15:33 ` schwab@linux-m68k.org

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).