From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 0982C3858D39 for ; Tue, 25 Jan 2022 07:05:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0982C3858D39 Received: by mail-pl1-x635.google.com with SMTP id d18so5636431plg.2 for ; Mon, 24 Jan 2022 23:05:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=MdgZ7/BY8HamfoALD1uGgmFxnkEv/5cSzDpgd9H0LEM=; b=ZCWuvZi2o1EHvVJ67NZZiCPewxBnSP/MQJdY32wfijrP981TIaIjZpOtLAwnPcpuXH 8C3UhPQx6in7URMREjKcga9WvfRjCT1sr/ci4EOle7dIHxLr6kLkbsBgPv3TcAx6gq7m Ydimtu3IVGTfsn/CNM6sDy5hmnCVmpxv6EQXbNrwGEkwbbwu50Xuc0qrnSRihiqwN6C7 INobrnLnJ+POfiPwKwlOhw4k2rDe8N/fv+wrX+pZ3AcBdSikQY4b+c1EWTur9MnAwgd+ b6WPm6B92pkJbnKYJ607dWepYSI0LJkW05sgfKNQTadYuzLc1HNK7DF++oVhUDGgwW3w kmmA== X-Gm-Message-State: AOAM531Fp9hkahNKimlzZF33ENCb/5389AvX6UkLeGc/uzwDn0P4Kgdt 8YPukhKkvTqgehd/CGfP8zI= X-Google-Smtp-Source: ABdhPJymsTXumASG91xb9sFPCLrqmFLevrAMc+8NzO86N5BHCToCI831UJvwqkv61P5/bxRD/VPg6A== X-Received: by 2002:a17:90b:4b05:: with SMTP id lx5mr2133489pjb.128.1643094313015; Mon, 24 Jan 2022 23:05:13 -0800 (PST) Received: from smtpclient.apple ([103.211.12.136]) by smtp.gmail.com with ESMTPSA id n35sm12919290pgb.25.2022.01.24.23.05.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jan 2022 23:05:12 -0800 (PST) From: Ankur Saini Message-Id: <724C5503-0392-4397-91E8-171E6A3CC0AF@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: =?utf-8?Q?Re=3A_syslog=3A_ISO_C_does_not_support_the_=E2=80=98=25?= =?utf-8?Q?m=E2=80=99_gnu=5Fprintf_format?= Date: Tue, 25 Jan 2022 12:35:09 +0530 In-Reply-To: Cc: gcc@gcc.gnu.org To: Kris Andersen References: X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_FONT_FACE_BAD, HTML_MESSAGE, KAM_SHORT, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: *** X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2022 07:05:15 -0000 > On 25-Jan-2022, at 9:38 AM, Kris Andersen via Gcc = wrote: >=20 > The %m format specifier is a documented feature of syslog, but gcc = gives a > warning when -Wpedantic is used. Is this a bug? >=20 > For example, the program: >=20 > #include > int main(void) > { > syslog(LOG_ERR, "%m"); > return 0; > } >=20 > gives: > warning: ISO C does not support the =E2=80=98%m=E2=80=99 gnu_printf = format [-Wformat=3D] I think, the compiler is correct by complaining about it when strict warnings are enabled. according to GNU documentation = (http://www.gnu.org/software/libc/manual/html_node/Other-Output-Conversion= s.html) =E2=80=9C The =E2=80=98%m=E2=80=99 conversion is a GNU C Library = extension =E2=80=9C >=20 > when compiled[1] with > gcc -Wall -Wextra -Wpedantic -o test test.c >=20 > 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)." >=20 > 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? FWIW, A bug report requesting support for __format__ attribute for syslog is already filed as bug 15338 ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D15338 ) Thanks - Ankur=