From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 21:01:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------65022CA76BEA60BEE0CA7588" X-SW-Source: 2016-05/txt/msg01696.txt.bz2 This is a multi-part message in MIME format. --------------65022CA76BEA60BEE0CA7588 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 283 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 --------------65022CA76BEA60BEE0CA7588 Content-Type: text/x-patch; name="cexpr.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cexpr.patch" Content-length: 1676 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) { --------------65022CA76BEA60BEE0CA7588--