From patchwork Fri May 5 16:53:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 759088 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 3wKHyp1f57z9s7r for ; Sat, 6 May 2017 02:53:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="y59nUpgW"; 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=q5llqJ1jbavkOBPEgpvYHzBq3UNMn7hekQjadtcPcOfKmRN6/t CqdvnFtdEFSmXu2mCMyumMxgWflviNcz2VWyIdK8Mm6P24iwFaxVaTfC1iK90vMe xwc8jF/uo4fY3CcL4BIx7h+0hlsiFCIX0feibG3mb6QEOr3hbEAbXJVpw= 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=4sFJqTwfFMfdzANdgC+AGliksLE=; b=y59nUpgWzMa3QZ9F0kuU jx3RE0ApqfWx07y9vlQEKM3D0HPVm/FbjfYJKuIK9+TKUM1J2mj4Zrt2K6AjNwBv AQlDq8KCa2lSNp+pEAvRB8JS+81iU3aRQif897c6uAQLBDFlvJON8acMgqx1p0I/ 1iF073KipraIJqGN6ZE/yJg= Received: (qmail 113508 invoked by alias); 5 May 2017 16:53:09 -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 113473 invoked by uid 89); 5 May 2017 16:53:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=hygiene X-HELO: mail-yw0-f174.google.com Received: from mail-yw0-f174.google.com (HELO mail-yw0-f174.google.com) (209.85.161.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 May 2017 16:53:04 +0000 Received: by mail-yw0-f174.google.com with SMTP id k11so5697982ywb.1 for ; Fri, 05 May 2017 09:53:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=VoD1fvdHTvUedQRsIJblCDst2ckwTd9S1RTabAmnOl4=; b=YvSzCxPDgTN7HYTppOecIfETBlTgXqzC/RR3e6PZRwrAFpaFMSMCFsxEMmkhpVz3Ev 9wlTAD/ll2PpA39FpzMpuMqW7RUJBYU07mJw0ZwserYykF9EaCdJ9DcoPLYBQUuDI4Ev e1FU3xsdYx/0I8n36DV97TomT/CNKKPRi9cbPeHbWyF27Y4rUwRuPbxVOtk/hVO5e8Ra urQmoXe8AN3X3Q5jOroTlr2rAP85p/Ts0eS0XGdME7fKLR9W1gdsudO5AZ1dqE0R2dyg tx6xu6vDxGDoQV+nZUIrulNyTP3QdiIKxoQpQ/QERqpgOjC2LMK6Pc6QqMQe1MqD0WRD Fqmg== X-Gm-Message-State: AODbwcC/9k1ayO4zjtfCZFgMkFqM+Qg25nNrCnCDQmbMwtFH5QV5WR2F FoZ8MMJxzxEUlA== X-Received: by 10.129.79.198 with SMTP id d189mr3233638ywb.47.1494003185519; Fri, 05 May 2017 09:53:05 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::2:16e0]) by smtp.googlemail.com with ESMTPSA id u207sm2523057ywc.60.2017.05.05.09.53.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 09:53:05 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++ PATCH] scope hygiene Message-ID: Date: Fri, 5 May 2017 12:53:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 We were not pushing the initialization protector of a file-scope static into its own scope. My cleanup of name-lookup will barf on that mismatch, so fix it now. When we push an error_mark_node local var, we can just call pushdecl, and that'll allow me to get rid of push_local_binding. nathan 2017-05-05 Nathan Sidwell * call.c (make_temporary_var_for_ref_to_temp): Push decl into current scope. * lex.c (unqualified_name_lookup_error): Likewise. Index: call.c =================================================================== --- call.c (revision 247636) +++ call.c (working copy) @@ -10234,10 +10234,7 @@ perform_direct_initialization_if_possibl tree make_temporary_var_for_ref_to_temp (tree decl, tree type) { - tree var; - - /* Create the variable. */ - var = create_temporary_var (type); + tree var = create_temporary_var (type); /* Register the variable. */ if (VAR_P (decl) @@ -10245,15 +10242,16 @@ make_temporary_var_for_ref_to_temp (tree { /* Namespace-scope or local static; give it a mangled name. */ /* FIXME share comdat with decl? */ - tree name; TREE_STATIC (var) = TREE_STATIC (decl); CP_DECL_THREAD_LOCAL_P (var) = CP_DECL_THREAD_LOCAL_P (decl); set_decl_tls_model (var, DECL_TLS_MODEL (decl)); - name = mangle_ref_init_variable (decl); + + tree name = mangle_ref_init_variable (decl); DECL_NAME (var) = name; SET_DECL_ASSEMBLER_NAME (var, name); - var = pushdecl_top_level (var); + + var = pushdecl (var); } else /* Create a new cleanup level if necessary. */ Index: lex.c =================================================================== --- lex.c (revision 247636) +++ lex.c (working copy) @@ -447,13 +447,9 @@ unqualified_name_lookup_error (tree name this NAME in the innermost block scope. */ if (local_bindings_p ()) { - tree decl; - decl = build_decl (loc, VAR_DECL, name, error_mark_node); - DECL_CONTEXT (decl) = current_function_decl; - push_local_binding (name, decl, 0); - /* Mark the variable as used so that we do not get warnings - about it being unused later. */ - TREE_USED (decl) = 1; + tree decl = build_decl (loc, VAR_DECL, name, error_mark_node); + TREE_USED (decl) = true; + pushdecl (decl); } }