lkml.org 
[lkml]   [2017]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] lib: vsprintf: add printf format conversion %M for errno strings
From
Date
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

\
 
 \ /
  Last update: 2017-06-25 21:54    [W:0.082 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site