wpa_supplicant: if printf is a macro, #ifdefs inside are not good

Jouni Malinen j
Sun Feb 15 04:37:08 PST 2009


On Tue, Jan 13, 2009 at 10:02:32AM +0100, Cristian Ionescu-Idbohrn wrote:
> On Tue, 13 Jan 2009, Jouni Malinen wrote:
> > On Mon, Jan 12, 2009 at 11:42:09PM +0100, Cristian Ionescu-Idbohrn wrote:
> > > -	printf("%s\n\n%s\n"
> > > +	/* Printf can be a macro, but no preprocessor directives are
> > > +	   allowed in a macro parameter list.  However, printf is
> > > +	   required to also exist as a function, so let's force it to
> > > +	   not being recognized as a macro with parameters. */
> > > +	(printf)("%s\n\n%s\n"

> If I understand things correctly, it's the 2:nd and 3:rd printf
> in usage:
> 
>   48         printf("options:\n"
..
> ->56 #ifdef CONFIG_DEBUG_FILE
> ->57                "  -f = log output to debug file instead of stdout\n"
> ->58 #endif /* CONFIG_DEBUG_FILE */

OK. I split this into multiple printf calls to avoid the ifdef inside
the string.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list