From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115532 invoked by alias); 13 May 2015 15:12:40 -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 115509 invoked by uid 89); 13 May 2015 15:12:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Wed, 13 May 2015 15:12:38 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4DFCaao022668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 13 May 2015 11:12:37 -0400 Received: from c64.redhat.com (vpn-228-13.phx2.redhat.com [10.3.228.13]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4DFCYco004815; Wed, 13 May 2015 11:12:36 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH] Avoid unnecessary work when -Wmisleading-indentation isn't enabled Date: Wed, 13 May 2015 15:16:00 -0000 Message-Id: <1431530756-26831-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg01237.txt.bz2 This might qualify as "obvious". OK for trunk? (if it passes bootstrap and regrtest) gcc/c-family/ChangeLog: * c-indentation.c (warn_for_misleading_indentation): Bail out immediately if -Wmisleading-indentation isn't enabled. --- gcc/c-family/c-indentation.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c index 94565f6..9aeebae 100644 --- a/gcc/c-family/c-indentation.c +++ b/gcc/c-family/c-indentation.c @@ -373,6 +373,12 @@ warn_for_misleading_indentation (location_t guard_loc, enum cpp_ttype next_tok_type, const char *guard_kind) { + /* Early reject for the case where -Wmisleading-indentation is disabled, + to avoid doing work only to have the warning suppressed inside the + diagnostic machinery. */ + if (!warn_misleading_indentation) + return; + if (should_warn_for_misleading_indentation (guard_loc, body_loc, next_stmt_loc, -- 1.8.5.3