From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Date: Tue, 19 Aug 2014 14:27:04 +0200 Subject: [U-Boot] [PATCH 08/23] Add pr_fmt() macro In-Reply-To: References: <1408346196-30419-1-git-send-email-thierry.reding@gmail.com> <1408346196-30419-9-git-send-email-thierry.reding@gmail.com> Message-ID: <20140819122703.GE19515@ulmo> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Aug 18, 2014 at 12:24:06PM -0600, Simon Glass wrote: > On 18 August 2014 01:16, Thierry Reding wrote: > > From: Thierry Reding > > > > This macro can be overridden in source files (before including common.h) > > and can be used to specify a prefix for debug and error messages. An > > example of how to use this is shown below: > > > > #define pr_fmt(fmt) "foo: " fmt > > > > #include > > > > ... > > debug("bar"); > > > > The resulting message will read: > > > > foo: bar > > > > Signed-off-by: Thierry Reding > > Acked-by: Simon Glass > > Seems OK. But I wonder if a string might be simpler? > > #define DEBUG_PREFIX "foo: " > > +#ifndef DEBUG_PREFIX > +#define DEBUG_PREFIX "" > +#endif The advantage of using the macro is that it can perform more complicated transformations on the format string, like this for example: #define pr_fmt(fmt) "foo: %s():" fmt, __func__ Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: