Date: Fri, 25 Oct 2013 09:16:33 -0400 From: Sean Bruno <sean_bruno@yahoo.com> To: Daniel Hartmeier <daniel@benzedrine.cx> Cc: freebsd-hackers@freebsd.org, hackers@freebsd.org Subject: Re: warning spew from cddl libnvpair.c Message-ID: <1382706993.2451.10.camel@localhost> In-Reply-To: <20131025122643.GC12556@insomnia.benzedrine.cx> References: <1382672957.18382.11.camel@localhost> <20131025113946.GA15905@britannica.bec.de> <20131025122643.GC12556@insomnia.benzedrine.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Fri, 2013-10-25 at 14:26 +0200, Daniel Hartmeier wrote: > How is that valid? > > If nvprt_btwnarrfmt contains %, how would > > (void) fprintf(fp, pctl->nvprt_btwnarrfmt); \ > > not crash? > If someone created a macro (e.g. NVLIST_PRTFUNC) that had % as an argument, bad things would happen, you would get a "incomplete format specifier warning on compile in that case. > And if it may not contain %, why not use > > (void) fprintf(fp, "%s", pctl->nvprt_btwnarrfmt); \ > That would mean writing a C function for each and every variable type to be printed. right? > It can be set to arbitrary values with > > libnvpair.c nvlist_prtctl_setfmt() > > That's exactly why the compiler warns, no? I'm specifically looking at the macros that expand first (ARENDER for example). nvlist_prtctl_setfmt() doesn't seem to error check at all, but I'm not clear how its used outside of the library. > > If anything in the macro/preprocessor trickery is relevant, I'm not > seeing it. sean [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (FreeBSD) iQEcBAABAgAGBQJSam8uAAoJEBkJRdwI6BaH7WoH/RnBGh1nouuzTZPu8e7kVmXK tk67Wrs4/QHXjnTAUmRQ0zpRGmMnRHdFhOlc97rwgWm4mAYbTFvR5Tdkt6668cLg quQlEUvGJk4HV3T48L7lNQeh5oQIo4YnpC40xNJXv4VQS1CTAXzzFkSn5CWqh10Q u2wMKmfY8+jhlD0Bbe1JWRUZlFL414jvZB1LXn1dkXYCtuNDvUB9rsHjOqAFfkrq xuvVDuk9Vhiqq8QOgKef6o95crGbxmcnYM0ckgzwFeGoph1qKlhVxCmqdU1p0yHQ gv18nJ7eFUj9RB4a94/0pNyUmR38JaFoUbuo3xZnOCrXIrYagIGNRfmmb9d38Ug= =qlTq -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382706993.2451.10.camel>
