[U-Boot] [PATCH 2/3] Fix a few gcc warnings.

Scott Wood scottwood at freescale.com
Tue Apr 26 00:32:15 CEST 2011


On Tue, 26 Apr 2011 00:29:06 +0200
Wolfgang Denk <wd at denx.de> wrote:

> Dear Scott Wood,
> 
> In message <20110425162854.05500a06 at schlenkerla.am.freescale.net> you wrote:
> >
> > > I disagree. "printf(foo);" may be suboptimal but there are cases
> > > where I do not want to see a warning about this. Consider for example
> > > common/main.c:
> > > 
> > >  115 #  ifdef CONFIG_AUTOBOOT_PROMPT
> > >  116         printf(CONFIG_AUTOBOOT_PROMPT);
> > >  117 #  endif
> > > 
> > > Here we provide a way for a user-defined autoboot prompt message. Some
> > > users may just want to provide a plain string - what's wrong with
> > > that?  [Yes, there are other ways to implement this, but why make it
> > > more complicated than necessary?]
> > 
> > It won't warn there, because it all happens in the preprocessor.
> 
> Why would it not warn if the user just does
> 
> 	#define CONFIG_AUTOBOOT_PROMPT "my prompt:"

Because the warning only applies to non-literals (preprocessor
substitution doesn't count, as it's a literal when the preprocessor's done
with it).  Otherwise it would be warning on every instance of
printf("foo\n").

-Scott



More information about the U-Boot mailing list