[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39eda8f7-8c39-f899-075f-b4abdefe0098@rasmusvillemoes.dk>
Date: Thu, 29 Aug 2019 11:00:58 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Petr Mladek <pmladek@...e.com>,
Uwe Kleine-König <uwe@...ine-koenig.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Jonathan Corbet <corbet@....net>,
metux IT consult Enrico Weigelt <lkml@...ux.net>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] vsprintf: introduce %dE for error constants
On 29/08/2019 10.12, Petr Mladek wrote:
> On Wed 2019-08-28 21:18:37, Uwe Kleine-König wrote:
> BTW: I though more about generating or cut&pasting the arrary.
> I can't find any reasonable way how to generate it.
Something like this seems to work, though it probably needs some massage
to be accepted by kbuild folks:
define filechk_errcode.h
echo '#include <linux/errno.h>' | \
$(CPP) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) -dM - | \
grep 'define E' | sort -k3,3n | \
awk '{print "errcode("$$2")\t/* "$$3" */"}'
endef
include/generated/errcode.h: FORCE
$(call filechk,errcode.h)
Then one can just #define errcode(foo) ... right before #include
<generated/errcode.h>. It cannot be used to generate cases in a switch()
because some expand to the same number, but that's ok, because I can't
imagine the switch actually generating good or small code. I haven't
checked how or whether it works in a cross-compile situation.
Rasmus
Powered by blists - more mailing lists