From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 11 15:18:14 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A09E9B31 for ; Mon, 11 Feb 2013 15:18:14 +0000 (UTC) (envelope-from papowell@astart.com) Received: from astart2.astart.com (99-111-96-109.uvs.sndgca.sbcglobal.net [99.111.96.109]) by mx1.freebsd.org (Postfix) with ESMTP id 6080C86C for ; Mon, 11 Feb 2013 15:18:14 +0000 (UTC) Received: from laptop_83.private (localhost [127.0.0.1]) by astart2.astart.com (8.14.4/8.14.4) with ESMTP id r1BF7KY3044702 for ; Mon, 11 Feb 2013 07:07:21 -0800 (PST) (envelope-from papowell@astart.com) Message-ID: <51190923.7090907@astart.com> Date: Mon, 11 Feb 2013 07:07:15 -0800 From: Patrick Powell Organization: Astart Technologies User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120807 Thunderbird/14.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: Eliminating a warning in sys/boot References: <1360455011.4618.8.camel@powernoodle> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: papowell@astart.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2013 15:18:14 -0000 On 02/10/13 01:27, hiren panchasara wrote: > On Sat, Feb 9, 2013 at 4:10 PM, Sean Bruno wrote: >> So, this is not a valid warning in our universe and I'd like to silence >> it when compiling sys/boot as printf(9) and sprintf(9) supports this >> format. How can we silence this warning for the FreeBSD universe? >> >> ===> efi/libefi (all) >> In file included from efinet.c:39: >> /home/sbruno/fbsd_head/sys/boot/efi/libefi/../../common/dev_net.c:328:19: warning: invalid conversion specifier 'D' >> [-Wformat-invalid-specifier] >> sprintf(temp, "%6D", d->myea, ":"); > Here "d->myea" being char pointer, can we not do following instead? : > sprintf(temp, "%6s", d->myea, ":"); NO NO NO NO! I really suggest that sprintf be removed from the C library. Try: char fixed_buffer[32]; snprintf(fixed_buffer, sizeof(fixed_buffer), "%6whateverformat",whatever); -- Patrick Powell Astart Technologies papowell@astart.com 1530 Jamacha Road, Suite X, Network and System El Cajon, CA 92019 Consulting 858-874-6543 Web Site: www.astart.com