From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35531 invoked by alias); 11 Mar 2016 20:05:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 35504 invoked by uid 89); 11 Mar 2016 20:05:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 11 Mar 2016 20:05:00 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 3B1A8A4534 for ; Fri, 11 Mar 2016 20:04:59 +0000 (UTC) Received: from c64.redhat.com (vpn-230-176.phx2.redhat.com [10.3.230.176]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2BK4w8w012893; Fri, 11 Mar 2016 15:04:58 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [committed 1/2] Wmisleading-indentation: add reproducer for PR c/70085 Date: Fri, 11 Mar 2016 20:05:00 -0000 Message-Id: <1457728075-11443-1-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1457020600.1637.29.camel@redhat.com> References: <1457020600.1637.29.camel@redhat.com> X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00711.txt.bz2 PR c/70085 reported a false-positive from -Wmisleading-indentation. The warning was fixed by the fix for PR c/68187 (r233972), but it seems worth capturing the reproducer for PR c/70085 as an additional test case, as it's slightly different to those seen in PR c/68187. Committed to trunk (as "obvious") as r234145. gcc/testsuite/ChangeLog: PR c/70085 * c-c++-common/Wmisleading-indentation.c (pr70085): New test case. --- gcc/testsuite/c-c++-common/Wmisleading-indentation.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/testsuite/c-c++-common/Wmisleading-indentation.c b/gcc/testsuite/c-c++-common/Wmisleading-indentation.c index 7b499d4..38c8aec 100644 --- a/gcc/testsuite/c-c++-common/Wmisleading-indentation.c +++ b/gcc/testsuite/c-c++-common/Wmisleading-indentation.c @@ -1054,3 +1054,19 @@ fn_42_c (int locked, int i) return 0; #undef engine_ref_debug } + +/* We shouldn't complain about the following function. */ +#define ENABLE_FEATURE +int pr70085 (int x, int y) +{ + if (x > y) + return x - y; + + #ifdef ENABLE_FEATURE + if (x == y) + return 0; + #endif + + return -1; +} +#undef ENABLE_FEATURE -- 1.8.5.3