From patchwork Wed Oct 30 19:50:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 287334 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 79C392C03A0 for ; Thu, 31 Oct 2013 06:50:23 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=Fv3bAyL3oi0KRpoIyOaNisDlFaCNZ0W446X7+ALkbMgrGh eqiVNYFmVGsA3ibzJsmo/Y63oRvbAEKC+Ffh0wlSGFKlcMWf4ewS86lOutdStJZb tFOt3vZAlsz1/ikDKWOGg4XFypy1/ZzWYcK7rmthAUIkbuxn352LwhMPwVgVo= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=JcYGk1t0IalyjBBwPf4iNQh8I/A=; b=E0KsvmXHChArCGFwYM86 66ryTBvppQ/VKxBRiBQXODYjSfalkynOQ6yngy0X3uBSjPuyM17FXi3Da1TiZZaT lkiUA2x2tFWr3UxglzHI027F9Og9M4S05DqP/wPUnj4+4tFZCKA6e8lVtqtIGi9n fHZTre5eOoNmljzMx4sf/uE= Received: (qmail 13982 invoked by alias); 30 Oct 2013 19:50:18 -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 13965 invoked by uid 89); 30 Oct 2013 19:50:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS 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 ESMTP; Wed, 30 Oct 2013 19:50:16 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9UJoEmW008397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Oct 2013 15:50:15 -0400 Received: from [10.10.116.17] ([10.10.116.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9UJoEj9003584 for ; Wed, 30 Oct 2013 15:50:14 -0400 Message-ID: <527162F5.9040702@redhat.com> Date: Wed, 30 Oct 2013 15:50:13 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: gcc-patches List Subject: Two tiny C++ cleanup PATCHes 1) We want to skip anonymous structs when pushing member cleanups, too. 2) We shouldn't create a static variable for a compound literal in e.g. sizeof. I don't think either of these will actually affect compiler output, they're just cleanups I noticed while working on other things. Tested x86_64-pc-linux-gnu, applying to trunk. commit d643f3c28260e0295e6ac3dd0b4d80e26b00ea3f Author: Jason Merrill Date: Tue Oct 22 16:33:38 2013 -0400 * semantics.c (finish_compound_literal): Don't create a static variable inside cp_unevaluated_operand. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 052746c..a54123e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2501,6 +2501,7 @@ finish_compound_literal (tree type, tree compound_literal, if ((!at_function_scope_p () || CP_TYPE_CONST_P (type)) && TREE_CODE (type) == ARRAY_TYPE && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) + && !cp_unevaluated_operand && initializer_constant_valid_p (compound_literal, type)) { tree decl = create_temporary_var (type);