From patchwork Wed Oct 27 15:43:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 69366 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]) by ozlabs.org (Postfix) with SMTP id B3AC9B70D5 for ; Thu, 28 Oct 2010 02:43:33 +1100 (EST) Received: (qmail 31166 invoked by alias); 27 Oct 2010 15:43:30 -0000 Received: (qmail 31148 invoked by uid 22791); 27 Oct 2010 15:43:29 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Oct 2010 15:43:23 +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.13.8/8.13.8) with ESMTP id o9RFhLxN003386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Oct 2010 11:43:21 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9RFhKRI012701 for ; Wed, 27 Oct 2010 11:43:21 -0400 Message-ID: <4CC84898.1050601@redhat.com> Date: Wed, 27 Oct 2010 11:43:20 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.14) Gecko/20101020 Lightning/1.0b1 Shredder/3.0.10pre MIME-Version: 1.0 To: gcc-patches List Subject: Various small C++ PATCHes 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 1) check_narrowing only makes sense on a scalar value; we shouldn't invoke it on an initializer-list nested within another one. 2) We have an optimization to discard an empty STATEMENT_LIST when merging it with an enclosing one, but that doesn't work when it's wrapped inside a BIND_EXPR. If the list is empty and the BIND_EXPR isn't somehow special (i.e. representing a try block or the outermost braces of a function) we can discard the BIND_EXPR to allow the optimization. 3) build_cplus_new, given a CONSTRUCTOR argument, ought to wrap it in a TARGET_EXPR. This isn't actually used by the constexpr code; it was used briefly for a while when I was trying to expand constexpr calls immediately when formed, but that turned out to be a dead end. Still, this seems like the right behavior for build_cplus_new. 4) THROW_EXPR ought to have EXPR_LOCATION set, for use in diagnostics (such as the non-constant-expression diagnostic). Tested x86_64-pc-linux-gnu, applied to trunk. commit 0dab78fa5a4af873756f9896032114164c6a30cc Author: Jason Merrill Date: Tue Oct 26 18:31:04 2010 -0400 * except.c (build_throw): Set EXPR_LOCATION. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index b917664..cf8a210 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -648,7 +648,9 @@ build_throw (tree exp) { if (cfun) current_function_returns_abnormally = 1; - return build_min (THROW_EXPR, void_type_node, exp); + exp = build_min (THROW_EXPR, void_type_node, exp); + SET_EXPR_LOCATION (exp, input_location); + return exp; } if (exp == null_node) @@ -834,6 +836,7 @@ build_throw (tree exp) } exp = build1 (THROW_EXPR, void_type_node, exp); + SET_EXPR_LOCATION (exp, input_location); return exp; }