From: Kris Andersen <kris.andersen@gmail.com>
To: gcc@gcc.gnu.org
Subject: syslog: ISO C does not support the ‘%m’ gnu_printf format
Date: Mon, 24 Jan 2022 23:08:15 -0500 [thread overview]
Message-ID: <CABk8Po9W-oEs9+6BNtxRprmkg0b2HOhQ9PPTcTfP40rF_99hEA@mail.gmail.com> (raw)
The %m format specifier is a documented feature of syslog, but gcc gives a
warning when -Wpedantic is used. Is this a bug?
For example, the program:
#include <syslog.h>
int main(void)
{
syslog(LOG_ERR, "%m");
return 0;
}
gives:
warning: ISO C does not support the ‘%m’ gnu_printf format [-Wformat=]
when compiled[1] with
gcc -Wall -Wextra -Wpedantic -o test test.c
The man page for syslog(3) states that %m is supported: "the two-character
sequence %m will be replaced by the error message string strerror(errno)."
Submitting a bug report for this feels like arguing that the answer in the
back of the book is wrong (...rarely the right move). What am I missing
here?
Thanks in advance,
Kris
[1]: gcc (GCC) 11.2.1 20211203 on Linux version 5.15.16-200.fc35.x86_64
(Fedora v35)
next reply other threads:[~2022-01-25 4:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 4:08 Kris Andersen [this message]
2022-01-25 7:05 ` Ankur Saini
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=CABk8Po9W-oEs9+6BNtxRprmkg0b2HOhQ9PPTcTfP40rF_99hEA@mail.gmail.com \
--to=kris.andersen@gmail.com \
--cc=gcc@gcc.gnu.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).