From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 25 13:22:23 2013 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3645CE44 for ; Fri, 25 Oct 2013 13:22:23 +0000 (UTC) (envelope-from sean_bruno@yahoo.com) Received: from nm48.bullet.mail.bf1.yahoo.com (nm48.bullet.mail.bf1.yahoo.com [216.109.114.64]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A70812673 for ; Fri, 25 Oct 2013 13:22:22 +0000 (UTC) Received: from [98.139.215.143] by nm48.bullet.mail.bf1.yahoo.com with NNFMP; 25 Oct 2013 13:16:35 -0000 Received: from [98.139.211.162] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 25 Oct 2013 13:16:35 -0000 Received: from [127.0.0.1] by smtp219.mail.bf1.yahoo.com with NNFMP; 25 Oct 2013 13:16:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1382706995; bh=xZWwp3PnqbtAUrM/SfPgtul8cB49bWz30tyBzphuGjc=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Subject:From:Reply-To:To:Cc:In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version:X-Mailer; b=Q14PjMMQd3xZi9vBGWJRbBpKwAo4XctUODjr2FplJvxtP/eXsf10m/JcHMcFp7QLzu6WhRW6M8Zfx7kHQ+xHynE6JF7JwHmlot+MnPFh4hLlSIIYQiaWs5oUZHqN2N/sjIQX+A/CwWaZcACUvnk6kEuiqSDgqO82HTYOgxWsEJA= X-Yahoo-Newman-Id: 268746.66920.bm@smtp219.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: eIEL0SYVM1kURxsC3D5vegHZKLKWt5PxXbbdXsbwVz1hahK XU6sq196uI0pJXEu9JOWB9uJsKy5smtWhGVhSmdi_.Tmuirk_X2X5entO5tf bLpbV7zqAE9BO4KWxQeON.rlQ0Bq2vMlm7cEV1Hxt5dn9Tyc.DkAkJel8Y6z mx5hjbth5F8o3S96Nq5rCiR9bRUSRitFdmJqrmNlm5N_uaXsRtYmbR3fmhkd SRQEt7ibsn.U.x2EKJrX.NTDtKLtPd3ienBQJL9EADX9Dpb.W3WjDZ6vCOBe yoY8lruSdEqymPlyfLWs3kka0NeDQnUEmClIEZoxV28VkXNR_h8vNHFIuEsN ayhCLQE2R4y1FR_aKObZChM3Wfm8E66_p1bbHG4N1aJ_KJ_6ypQqoIIcvz7h Gkp9dVK0qcaiOnAveXIuzr6agXw5GAV2dh_hSbExvbdUXsRu1juv71tQXtzD H_pFHAh4O6H65L1jtFYPxy6jNWT3.b.zI3HfwVnGSQevpyL2sAhtx9FVkBCP 2LHEUS7Mvpm.4wlx3NDOTsLmwFTuW1yIpcENhPPoVmDEKge9KROknA38- X-Yahoo-SMTP: u5BKR6OswBC_iZJVfGRoMkTIpc8pEA4- X-Rocket-Received: from [192.168.100.57] (sean_bruno@63.138.121.126 with ) by smtp219.mail.bf1.yahoo.com with SMTP; 25 Oct 2013 06:16:35 -0700 PDT Subject: Re: warning spew from cddl libnvpair.c From: Sean Bruno To: Daniel Hartmeier In-Reply-To: <20131025122643.GC12556@insomnia.benzedrine.cx> References: <1382672957.18382.11.camel@localhost> <20131025113946.GA15905@britannica.bec.de> <20131025122643.GC12556@insomnia.benzedrine.cx> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-v4hO0we1ysCy4ncReLec" Date: Fri, 25 Oct 2013 09:16:33 -0400 Message-ID: <1382706993.2451.10.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: freebsd-hackers@freebsd.org, hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 13:22:23 -0000 --=-v4hO0we1ysCy4ncReLec Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Fri, 2013-10-25 at 14:26 +0200, Daniel Hartmeier wrote: > How is that valid? >=20 > If nvprt_btwnarrfmt contains %, how would >=20 > (void) fprintf(fp, pctl->nvprt_btwnarrfmt); \ >=20 > not crash? >=20 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 >=20 > (void) fprintf(fp, "%s", pctl->nvprt_btwnarrfmt); \ >=20 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 >=20 > libnvpair.c nvlist_prtctl_setfmt() >=20 > 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. >=20 > If anything in the macro/preprocessor trickery is relevant, I'm not > seeing it. sean --=-v4hO0we1ysCy4ncReLec Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (FreeBSD) iQEcBAABAgAGBQJSam8uAAoJEBkJRdwI6BaH7WoH/RnBGh1nouuzTZPu8e7kVmXK tk67Wrs4/QHXjnTAUmRQ0zpRGmMnRHdFhOlc97rwgWm4mAYbTFvR5Tdkt6668cLg quQlEUvGJk4HV3T48L7lNQeh5oQIo4YnpC40xNJXv4VQS1CTAXzzFkSn5CWqh10Q u2wMKmfY8+jhlD0Bbe1JWRUZlFL414jvZB1LXn1dkXYCtuNDvUB9rsHjOqAFfkrq xuvVDuk9Vhiqq8QOgKef6o95crGbxmcnYM0ckgzwFeGoph1qKlhVxCmqdU1p0yHQ gv18nJ7eFUj9RB4a94/0pNyUmR38JaFoUbuo3xZnOCrXIrYagIGNRfmmb9d38Ug= =qlTq -----END PGP SIGNATURE----- --=-v4hO0we1ysCy4ncReLec--