From patchwork Fri Feb 25 15:38:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 84545 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 841E4B70F3 for ; Sat, 26 Feb 2011 02:42:54 +1100 (EST) Received: from localhost ([127.0.0.1]:52051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pszoh-0006HV-Sg for incoming@patchwork.ozlabs.org; Fri, 25 Feb 2011 10:42:51 -0500 Received: from [140.186.70.92] (port=60860 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsznT-00060D-FI for qemu-devel@nongnu.org; Fri, 25 Feb 2011 10:41:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsznS-0001lx-53 for qemu-devel@nongnu.org; Fri, 25 Feb 2011 10:41:35 -0500 Received: from mail-vw0-f45.google.com ([209.85.212.45]:47424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsznR-0001ll-W2 for qemu-devel@nongnu.org; Fri, 25 Feb 2011 10:41:34 -0500 Received: by vws19 with SMTP id 19so1617211vws.4 for ; Fri, 25 Feb 2011 07:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=uzIMG/Ye75m9Dbxfd9g5aWuLgk0Ripp8A5/xxZ3aNNA=; b=SZ+0NtAiKcM/M4r4/nA9GiG2UuTI5AbklDiIPNwU8ulzMxxhpPPHAodGCRMrhaZ2pC NmPqM2UbpS0Jpf46a+Bipm17uRFWkvXd9rHmSzHjqFtBb5frLlUax3XqLjn9lZCgW6DF 7gLXHIKoC3MELSaB9uUyZ9DGhf2J4Qi7/EaCo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Up3OZpCasFjZVuDFRE2IUT+UpiHc+bIWUysMPr/xlbwxziIxmNRs3qMMWQ9MvZ4RLJ YpIF5tDgHgpOhQrXYMFqIX7pjY4BWjqBcruV+dZNLzPqx1Lo6eDtApMHkqLwmwjyL5+H X02f1Ge4aZN6C/KkhI+KOtfY6ycG5AKpuBDEM= Received: by 10.220.101.68 with SMTP id b4mr601726vco.169.1298648492859; Fri, 25 Feb 2011 07:41:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.186.7 with HTTP; Fri, 25 Feb 2011 07:38:45 -0800 (PST) In-Reply-To: References: From: Blue Swirl Date: Fri, 25 Feb 2011 17:38:45 +0200 Message-ID: Subject: Re: [Qemu-devel] checkpatch.pl false positive: wants braces on #if To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.45 Cc: QEMU Developers 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 On Wed, Feb 23, 2011 at 6:07 PM, Peter Maydell wrote: > If you run checkpatch.pl on this patch: > http://patchwork.ozlabs.org/patch/84189/ > > it complains: > WARNING: braces {} are necessary even for single statement blocks > #29: FILE: tcg/tcg.c:454: > +#if defined(CONFIG_DEBUG_TCG) > +    s->temps_in_use++; > > > ...but braces on a cpp conditional are a bit tricky :-) > > The script is sufficiently hairy perl that I'm afraid I > can't suggest a solution, only report the problem. Maybe this helps: diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 075b614..4b1e2c2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2537,7 +2537,7 @@ sub process { } if (!defined $suppress_ifbraces{$linenr - 1} && $line =~ /\b(if|while|for|else)\b/ && - $line !~ /\#\s*else/) { + $line !~ /\#\s*(if|else|elif)/) { my $allowed = 0; # Check the pre-context.