From patchwork Fri May 20 21:01:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 624623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rBL2Y2cbtz9t6N for ; Sat, 21 May 2016 07:01:24 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=xMD5S9Ad; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=Ha/N5WSjznNAAkYFWEhvCsLOBXxIjPxb+h/mD6FHrKtB7l3chZ 2B7ExyPPBE1LgiclPiftf7UyuNeAP/xQ6/v77YCbGADl5TklTdHQ7XC+5MAnr67N +4yQjiQS3iPqAYMKGfhxy46weCTIJbEQ98eMwd5BnQM0kMQYFknmrOaao= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=13KRIEAjU6pX39m/FRSLzwNMYqk=; b=xMD5S9AdDEOZrSNr7+2P 0bhwZQHjlpJYZdn576KnhYc2sbqqVxZAxz+H5DQcuZZ7QfJkFTr5PAvbSp13EtFU Clzj/ODTuIGtO82hmeF9W+wX59DJFFNiE7eYcRalpQeaXayvJTFq2z9vFZEysD+B 9npf7eh21FLCGqGmUAv9suI= Received: (qmail 101729 invoked by alias); 20 May 2016 21:01:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101672 invoked by uid 89); 20 May 2016 21:01:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=parms, grammar, H*MI:d3ff, Hx-languages-length:1846 X-HELO: mail-qk0-f173.google.com Received: from mail-qk0-f173.google.com (HELO mail-qk0-f173.google.com) (209.85.220.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 20 May 2016 21:01:05 +0000 Received: by mail-qk0-f173.google.com with SMTP id y126so38930540qke.1 for ; Fri, 20 May 2016 14:01:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version; bh=4xvNcDm7t/h45vGTtw6j93DuCjw1t1Cm/69GQ6Kdoxc=; b=Bxkb9GRhLCdmlEWs2FEJwHo6rCv1xnhSJ8EdiWp4My73Tp7AD5amrUI3kFdpF2PP3J TTTyTTHdjhmwKpMV+2mgOVeDqqPvY9TWdcpk66c3RB/b0Z36W3zKcR0o+hcsmDKkREZ0 ey6sCo6fEdWpgGU05AjCQIPc+1GiJC+1hZrSbWnDXKXtfpKK5EA2OMnXma6/9dqFsUGe 23WJzIh/v4YBlrN9v6g1hwVIcH3uDwOoqtrVjxHRBX9l/QqiPiTWPNeeEmSzLRop2ETo vNKeDrCs1MsQi9HKMoVP54VHjjJSSq0jRS5iQwfSmkylEzeZqi4uuTU17zY/LR+XUfMf BOpA== X-Gm-Message-State: AOPr4FVjXTYVrMhNSc+Js6rItcyBd9W/6tVAIhTlQ3GhVwzJK4RP8xDiV6izKD+XwaulJg== X-Received: by 10.55.23.29 with SMTP id i29mr5414812qkh.201.1463778063586; Fri, 20 May 2016 14:01:03 -0700 (PDT) Received: from ?IPv6:2601:181:c003:1930:a2a8:cdff:fe3e:b48? ([2601:181:c003:1930:a2a8:cdff:fe3e:b48]) by smtp.googlemail.com with ESMTPSA id t1sm558775qtc.6.2016.05.20.14.01.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 May 2016 14:01:02 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++] code cleanup Message-ID: Date: Fri, 20 May 2016 17:01:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 When working on the constexpr machinery for gcc 6, I noticed a couple of cleanup opportunities. 1) cxx_bind_parameters_in_call contains 'if (cond) goto x; ... x:;', which can easily be rewritten to 'if (!cond) { ...}' 2) a which vs that grammar error. applied to trunk. nathan 2016-05-20 Nathan Sidwell * constexpr.c (cxx_bind_parameters_in_call): Avoid gratuitous if ... goto. (cxx_eval_call_expression): Fix comment grammar. Index: cp/constexpr.c =================================================================== --- cp/constexpr.c (revision 236510) +++ cp/constexpr.c (working copy) @@ -1201,18 +1201,18 @@ cxx_bind_parameters_in_call (const const /* Just discard ellipsis args after checking their constantitude. */ if (!parms) continue; - if (*non_constant_p) - /* Don't try to adjust the type of non-constant args. */ - goto next; - - /* Make sure the binding has the same type as the parm. */ - if (TREE_CODE (type) != REFERENCE_TYPE) - arg = adjust_temp_type (type, arg); - if (!TREE_CONSTANT (arg)) - *non_constant_args = true; - *p = build_tree_list (parms, arg); - p = &TREE_CHAIN (*p); - next: + + if (!*non_constant_p) + { + /* Make sure the binding has the same type as the parm. But + only for constant args. */ + if (TREE_CODE (type) != REFERENCE_TYPE) + arg = adjust_temp_type (type, arg); + if (!TREE_CONSTANT (arg)) + *non_constant_args = true; + *p = build_tree_list (parms, arg); + p = &TREE_CHAIN (*p); + } parms = TREE_CHAIN (parms); } } @@ -1420,7 +1420,7 @@ cxx_eval_call_expression (const constexp *slot = entry = ggc_alloc (); *entry = new_call; } - /* Calls which are in progress have their result set to NULL + /* Calls that are in progress have their result set to NULL, so that we can detect circular dependencies. */ else if (entry->result == NULL) {