From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14511 invoked by alias); 4 Mar 2016 07:20:41 -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 14491 invoked by uid 89); 4 Mar 2016 07:20:41 -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=Root, Hx-languages-length:1849, surprise 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, 04 Mar 2016 07:20:39 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C225932B716 for ; Fri, 4 Mar 2016 07:20:38 +0000 (UTC) Received: from slagheap.utah.redhat.com ([10.3.113.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u247Kcst016864; Fri, 4 Mar 2016 02:20:38 -0500 Subject: Re: [PATCH 2/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #1) To: David Malcolm , gcc-patches@gcc.gnu.org References: <1457018483-26829-1-git-send-email-dmalcolm@redhat.com> <1457018483-26829-2-git-send-email-dmalcolm@redhat.com> From: Jeff Law Message-ID: <56D93746.8080009@redhat.com> Date: Fri, 04 Mar 2016 07:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1457018483-26829-2-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00313.txt.bz2 On 03/03/2016 08:21 AM, David Malcolm wrote: > Comment #1 of PR c/68187 identified another overzealous warning > from -Wmisleading-indentation, with OpenSSL 1.0.1, on this poorly > indented code: > > 115 if (locked) > 116 i = CRYPTO_add(&e->struct_ref, -1, CRYPTO_LOCK_ENGINE); > 117 else > 118 i = --e->struct_ref; > 119 engine_ref_debug(e, 0, -1) > 120 if (i > 0) > 121 return 1; Egad. How do people read this code when they have to understand it and make changes. What a steaming pile of ..... > > Root cause is that "engine_ref_debug" is actually a debugging macro > that was empty in the given configuration, so the code effectively > was: > > 117 else // GUARD > 118 i = --e->struct_ref; // BODY > 119 > 120 if (i > 0) // NEXT > > hence the warning. No surprise we triggered seeing that. > > OK for trunk? > > Note: one of the new test cases adds a dg-warning/dg-message pair, and so > would require updating if/when the wording change posted here: > https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00068.html > ("[PATCH] PR c/69993: improvements to wording of -Wmisleading-indentation") > is applied. > > gcc/c-family/ChangeLog: > PR c/68187 > * c-indentation.c (get_visual_column): Move code to determine next > tab stop to... > (next_tab_stop): ...this new function. > (line_contains_hash_if): Delete function. > (detect_preprocessor_logic): Delete function. > (get_first_nws_vis_column): New function. > (detect_intervening_unindent): New function. > (should_warn_for_misleading_indentation): Replace call to > detect_preprocessor_logic with a call to > detect_intervening_unindent. > > gcc/testsuite/ChangeLog: > PR c/68187 > * c-c++-common/Wmisleading-indentation.c (fn_42_a): New test > function. > (fn_42_b): Likewise. > (fn_42_c): Likewise. OK. Jeff