From: Tom Rini Date: Tue, 11 Apr 2017 10:13:05 -0400 Subject: [U-Boot] [PATCH v2] tiny-printf: Add support for %p format In-Reply-To: References: <20170410065322.17131-1-vigneshr@ti.com> <20170411140018.GU19897@bill-the-cat> Message-ID: <20170411141305.GV19897@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Apr 11, 2017 at 08:03:07AM -0600, Simon Glass wrote: > Hi Tom, > > On 11 April 2017 at 08:00, Tom Rini wrote: > > On Tue, Apr 11, 2017 at 07:56:06AM -0600, Simon Glass wrote: > >> On 10 April 2017 at 00:53, Vignesh R wrote: > >> > Add support for %p, %pa[p], %pM, %pm and %pI4 formats to tiny-printf. > >> > %pM and %pI4 are widely used by SPL networking stack and is required if > >> > networking support is desired in SPL. > >> > %p, %pa and %pap are mostly used by debug prints and hence supported > >> > only when DEBUG is enabled. > > [snip] > >> > +static void pointer(struct printf_info *info, const char *fmt, void *ptr) > >> > +{ > >> > +#ifdef DEBUG > >> > >> What is the #ifdef DEBUG for? It may not be enabled globally so I > >> don't think you can do this. You probably need this code always. > > > > So, %p/%pa/%pa[p] are used in debug() prints, which only matter when > > DEBUG is set. Doing it this way means we globally bloat by (I think I > > snipped out..) 25 bytes? instead of ~250 bytes. And since we're in > > tiny-printf, which we use when every byte counts, I'm happier about only > > bloating by 25 bytes here. > > What I mean is that typically DEBUG is enabled file by file. So if I > want to output something I need to enable DEBUG in this file as well? > That seems confusing to me. Perhaps it needs another CONFIG option? I usually end up whacking DEBUG into common.h myself, so I hadn't thought about it that way. Long-term, yeah, we should think about how to handle debug stuff as there's times you want everything on and times you just want a little bit on, and we're talking about the we-need-space case here too. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: