From patchwork Thu Aug 26 18:38:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 62798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 849C1B70DF for ; Fri, 27 Aug 2010 04:42:19 +1000 (EST) Received: from localhost ([127.0.0.1]:45780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OohOy-0006IC-UU for incoming@patchwork.ozlabs.org; Thu, 26 Aug 2010 14:42:16 -0400 Received: from [140.186.70.92] (port=43821 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OohM8-0005Is-61 for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OohM6-0006yX-UV for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:20 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:44249) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OohM6-0006pV-R9 for qemu-devel@nongnu.org; Thu, 26 Aug 2010 14:39:18 -0400 Received: by mail-qw0-f45.google.com with SMTP id 5so1984947qwh.4 for ; Thu, 26 Aug 2010 11:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=d00O242jDkDJXzZCYEbe7S3MMn35Y3Qx43G3TC0R3Lw=; b=Z2qWVuKDC8yyMPUU8xrsi5GO6qW7RBq0mo57et69p4ophza2mcYyTMOWt/D9lmOuxS FlMTb/ABfjH/zmWv/M53lLF7KfHmhKHkhHI4/odSZD6c8UxA2QfFncfX87y/AOYwpyKr HW7G+ftj2O6L+d/DljWatyqi539hHaW3+v3kk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=xq7pEyySykPl87To6xykWSKSd1EeQjJHPpRHGvLk5mOWrvciRfx6OQ7kY4ZBHSeOlq O+Sr1hLYzgL1amyzSCzrmP+NUewK8PHUkhmE3Au4YhaFmigiyB9VhhE96DdyQCXrzAdr HUqTX1ulBzDpm+WlwEZvd5h0RkccxsR6S1tGA= Received: by 10.229.181.8 with SMTP id bw8mr7444711qcb.113.1282847958538; Thu, 26 Aug 2010 11:39:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.183.135 with HTTP; Thu, 26 Aug 2010 11:38:58 -0700 (PDT) From: Blue Swirl Date: Thu, 26 Aug 2010 18:38:58 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 5/5] HACKING: add rules for printf-like functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add rules for printf-like functions, based on libvirt HACKING. Signed-off-by: Blue Swirl --- HACKING | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/HACKING b/HACKING index a3d714f..5beb765 100644 --- a/HACKING +++ b/HACKING @@ -107,3 +107,16 @@ so instead of e.g. isalnum you should use qemu_isalnum. Because of the memory management rules, you must use qemu_strdup/qemu_strndup instead of plain strdup/strndup. + +5. Printf-style functions + +Whenever you add a new printf-style function, i.e., one with a format +string argument and following "..." in its prototype, be sure to use +gcc's printf attribute directive in the prototype. + +This makes it so gcc's -Wformat and -Wformat-security options can do +their jobs and cross-check format strings with the number and types +of arguments. + +Currently many functions in QEMU are not following this rule but +patches to add the attribute would be very much appreciated.