From patchwork Mon May 22 11:19:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 765346 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 3wWbmd1DFQz9s06 for ; Mon, 22 May 2017 21:20:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="nzv5h8nL"; 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=nDyrZKint84CU2ky9fo7PIf0P84xC+T5La4E/m8otstGw+/GAU haSMKDDuFcwiMGHctK8FnJEBqa4OUkltuwXRFuN5Gh9rup3+mTI1+IZYGq+jHk3J OtGp0UfFwO3Q4ayC4yN5a3HPuGvTKO+1KBbvoijlWViivck6tiiksdm3g= 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=2ZiIuccFcr0/xjpx2KYQ3HseGSk=; b=nzv5h8nLoys4e7JUkHeb F6rhYbjWW2G0Jm4CWbjZtv1q7u7OyUP3y9sjXeF6BGEPldw+DNqA90lAK9t5b5Va qWAzUJg077XYxwQR58jLlXHX+WUssMbqO21m2lUHna72EsdzVUuKaObHKeMRAJmu IY0avEmxh6gglCM6KypdZUU= Received: (qmail 121092 invoked by alias); 22 May 2017 11:20:02 -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 120698 invoked by uid 89); 22 May 2017 11:20:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=deeply X-HELO: mail-yw0-f182.google.com Received: from mail-yw0-f182.google.com (HELO mail-yw0-f182.google.com) (209.85.161.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 May 2017 11:19:59 +0000 Received: by mail-yw0-f182.google.com with SMTP id b68so58120728ywe.3 for ; Mon, 22 May 2017 04:20:03 -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=KwHExiwsH6MueLknS7PdXFMvckAQDBZvl0LNgMqh2Pw=; b=V7PS1XVkoTnAGt64KxtyLsoIrelABODGDM9gWKzH/amegKmPUDsKZic94sfaozCqRj xEtqacyZfbPec1RUiWX8Q1kVTUbdvv3PKDvQyUe8JzN/wQGBboZamdkARrEkLOO3fRan 2rbOORQApo/Nny6FlfuX+VHvX2kqKGjus1W7nWCspdIfo29w1jeaBN4wyLalcdbiJHSK FZgRL1ltEhKVN4rF2HtXq3qN3LmFdegrQvS3jAxxUYcsAS88o3qG3OL9rlGDRT+/GAQV TuZFPgnzGgcC2LNXR824s39qhF2qj08zusvILEOM8TCS8hT4jT8ldj54ksh8m5jE2i02 YWiA== X-Gm-Message-State: AODbwcC+VaPexkHNh/llqKgmy8F9/eAY4y50k/A2ZDTPvgq5n6P44qnE qxTCmkDTqt+aSA== X-Received: by 10.129.77.85 with SMTP id a82mr18284850ywb.266.1495452001789; Mon, 22 May 2017 04:20:01 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::94]) by smtp.googlemail.com with ESMTPSA id v14sm2101354ywh.45.2017.05.22.04.20.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 04:20:01 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++ PATCH] namespace pushing/popping Message-ID: <1561eec3-8710-b84c-35f0-2f5e7d4f84e8@acm.org> Date: Mon, 22 May 2017 07:19:59 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 name-lookup.c is somewhat messy in which functions are external interfaces and which are internal workers. One impact is the conditional timekeeping code. In an attempt to clean that up, I'm trying to move the external interfaces to the end of the file and consistently name worker functions do_FOO. This cleans up the namespace pushing and popping. Here we had a popping worker function but no matching pushing worker. nathan 2017-05-22 Nathan Sidwell * name-lookup.c (pushdecl_top_level, pushdecl_top_level_and_finish): Move after namespace pushing and popping functions. (push_to_top_level): Rename to ... (do_push_to_top_level): ... here. Remove timing code. (pop_from_top_level_1): Rename to ... (do_pop_from_top_level): ... here. (do_push_nested_namespace, do_pop_nested_namespace) (push_to_top_level): New wrapper for do_push_to_top_level. (pop_from_top_level): Adjust. (push_nested_namepace, pop_nested_namespace): Wrappers for workers. Index: name-lookup.c =================================================================== --- name-lookup.c (revision 248326) +++ name-lookup.c (working copy) @@ -4491,32 +4491,6 @@ parse_using_directive (tree name_space, } } -/* Pushes X into the global namespace. */ - -tree -pushdecl_top_level (tree x, bool is_friend) -{ - bool subtime = timevar_cond_start (TV_NAME_LOOKUP); - push_to_top_level (); - x = pushdecl_namespace_level (x, is_friend); - pop_from_top_level (); - timevar_cond_stop (TV_NAME_LOOKUP, subtime); - return x; -} - -/* Pushes X into the global namespace and Calls cp_finish_decl to - register the variable, initializing it with INIT. */ - -tree -pushdecl_top_level_and_finish (tree x, tree init) -{ - push_to_top_level (); - x = pushdecl_namespace_level (x, false); - cp_finish_decl (x, init, false, NULL_TREE, 0); - pop_from_top_level (); - return x; -} - /* Combines two sets of overloaded functions into an OVERLOAD chain, removing duplicates. The first list becomes the tail of the result. @@ -6232,8 +6206,8 @@ store_class_bindings (vec