Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751374AbdFYTxJ convert rfc822-to-8bit (ORCPT ); Sun, 25 Jun 2017 15:53:09 -0400 Received: from zimbra.gr13.net ([46.4.151.110]:57762 "EHLO zimbra.gr13.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751343AbdFYTxI (ORCPT ); Sun, 25 Jun 2017 15:53:08 -0400 Subject: Re: [PATCH] lib: vsprintf: add printf format conversion %M for errno strings To: Joe Perches , linux-kernel@vger.kernel.org References: <20170625171230.7613-1-enrico.weigelt@gr13.net> <1498411624.24295.36.camel@perches.com> From: "Enrico Weigelt, metux IT consult" Message-ID: <6a12988d-bbcc-54e7-be16-eeeb94f88d57@gr13.net> Date: Sun, 25 Jun 2017 21:53:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1498411624.24295.36.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 33 On 25.06.2017 19:27, Joe Perches wrote: > Every use of %M is going to cause gcc when using __printf to emit > a warning like: > > unknown conversion type character ‘M’ in format [-Wformat=] Yeah, that's still an open problem. Actually, I still haven't found out, how it's done w/ all the other kernel-internal conversions. I was under the impression, there was some magic to tell the compiler which letters correspond to which types - unfortunately, didn't find anything like that. Is that really hardcoded in gcc ? > Beyond that, why is this useful? Use that instead of %d where errno values are printed/logged. > There can't possibly be any fast-path use. I'm using it eg. for driver development - always having to look up the numbers is quite ugly and time consuming. > Why not just create a function that does errno/string conversions? Already was about to do so. Shall I call it strerror() ? --mtx -- Enrico, Sohn von Wilfried, a.d.F. Weigelt, metux IT consulting +49-151-27565287