From patchwork Sun Aug 15 17:51:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 61771 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 18B59B70A9 for ; Mon, 16 Aug 2010 07:06:30 +1000 (EST) Received: from localhost ([127.0.0.1]:54100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OkkPS-0003qY-PD for incoming@patchwork.ozlabs.org; Sun, 15 Aug 2010 17:06:27 -0400 Received: from [140.186.70.92] (port=56836 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Okjpt-0003sf-2c for qemu-devel@nongnu.org; Sun, 15 Aug 2010 16:29:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OkhMk-0002VL-O6 for qemu-devel@nongnu.org; Sun, 15 Aug 2010 13:51:31 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:58067) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OkhMk-0002VF-IT for qemu-devel@nongnu.org; Sun, 15 Aug 2010 13:51:26 -0400 Received: by qyk5 with SMTP id 5so1864250qyk.4 for ; Sun, 15 Aug 2010 10:51:26 -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=ujJzjMivO/ikoclAwLIVOZnT5fpdgrJnBE3PICDF2FU=; b=CjAvVYT3+H5VheHydJvMbRnos936wWvXdFK4eNyAKAf9xI7lSGikhoPET1DOKzyRZe 3nkvS+vC51zjzd7z/ArpJFX6LaXl4HiSkBJEGNM9DviCCSkTEPJIKeK7vGmWDKYBz5cV aprqjUn+T0Tgx0+i6TYjk0KXto95MGAvF7NZ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=ZuDPr+ssRkQi7FZpMIFj3BP6K6OKzbkorgQVuZyFCh070K1OLoh2EloyKOJPJeNIB3 rLYaSqxu8sSloPQ613sYiTmBYVoTHJBe8CFGWyNXSos31ziTcZABzaxMOAqorcQeKpfO 0LYisUPLkIvt1ixlmW3QdrcVzZ3DiGkUYLI3Y= Received: by 10.224.2.147 with SMTP id 19mr2680749qaj.58.1281894686181; Sun, 15 Aug 2010 10:51:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.183.135 with HTTP; Sun, 15 Aug 2010 10:51:06 -0700 (PDT) From: Blue Swirl Date: Sun, 15 Aug 2010 17:51:06 +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 54bd2fd..8e2a298 100644 --- a/HACKING +++ b/HACKING @@ -103,3 +103,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.