From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116374 invoked by alias); 25 May 2017 20:57:00 -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 116356 invoked by uid 89); 25 May 2017 20:56:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=everythings, H*M:5b12, H*MI:5b12, everything's X-HELO: mail-yw0-f180.google.com Received: from mail-yw0-f180.google.com (HELO mail-yw0-f180.google.com) (209.85.161.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 May 2017 20:56:57 +0000 Received: by mail-yw0-f180.google.com with SMTP id b68so108950630ywe.3 for ; Thu, 25 May 2017 13:57:01 -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=ahs6fHo4OtOC8xHAtCIC+I2udCuUiNKiQ+seLvXQwa0=; b=J7LgGwgFOVjHF4DiTv962VckCtkluAJA2JU3QZWvJQrFHk2G9zxvk47caIQzc62LT7 ub8WrjiG00fnRKRSV5lFxaZ9G3GcJYnATp7C6uNdy2MgOl9DLp2Byp1U29ZhCkTq7niL isQjP1hWIJI+qFR3PgyDZ7t2UTNP3lFA57wdJx8QRgC7HZSD+EucekykIBDnI8WgR4+x E6BWi1DQxQ545yhUk2t35Zvkr9b/L3JcHw05NZ7NqJO51YcadwDsSiWZlnMKujsYELCT DFE6pRpe8tmGBqJigSYoV+bbFjbn/adQz3DrZULI0k0D01PXjj1mhLJRVDHtnMe4R2mZ nfIg== X-Gm-Message-State: AODbwcBEfT1XVjZAXrILCSm+j+xzm6crE7AdvWY4XeAm6RHCgYj9el++ htgMRnFbOIw5sQ== X-Received: by 10.129.141.4 with SMTP id d4mr25371322ywg.158.1495745819888; Thu, 25 May 2017 13:56:59 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:f6d0:5ac5:64cd:f102? ([2620:10d:c091:200::2:a1d1]) by smtp.googlemail.com with ESMTPSA id t9sm3529418ywc.19.2017.05.25.13.56.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 May 2017 13:56:59 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++ PATCH] Kill OVL_CURRENT, OVL_NEXT Message-ID: <8ea31017-15c1-9e86-5b12-03f59acbc039@acm.org> Date: Thu, 25 May 2017 21:21:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------AB3240D035EAA70743CE2859" X-SW-Source: 2017-05/txt/msg01991.txt.bz2 This is a multi-part message in MIME format. --------------AB3240D035EAA70743CE2859 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 282 This patch finally expunges OVL_CURRENT & OVL_NEXT. Everything's switched over to using the new iterators. The use in check_explicit_specialization is temporary, until I enable 2D overload sets, and then it'll just use lookup_add on the overload set. nathan -- Nathan Sidwell --------------AB3240D035EAA70743CE2859 Content-Type: text/x-patch; name="ovlect.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ovlect.diff" Content-length: 3508 2017-05-25 Nathan Sidwell Kill OVL_CURRENT, OVL_NEXT. * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete. * name-lookup.c (set_decl_namespace): Use ovl_iterator. (consider_binding_level): Use OVL_FIRST. (cp_emit_debug_info_for_using): Use lkp_iterator. * pt.c (check_explicit_specialization): Use ovl_iterator. Index: cp-tree.h =================================================================== --- cp-tree.h (revision 248467) +++ cp-tree.h (working copy) @@ -659,12 +659,6 @@ typedef struct ptrmem_cst * ptrmem_cst_t (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function) #define OVL_CHAIN(NODE) TREE_CHAIN (NODE) -/* Polymorphic access to FUNCTION and CHAIN. */ -#define OVL_CURRENT(NODE) \ - ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE)) -#define OVL_NEXT(NODE) \ - ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE) - /* If set, this was imported in a using declaration. */ #define OVL_USING_P(NODE) TREE_LANG_FLAG_1 (OVERLOAD_CHECK (NODE)) /* If set, this overload is a hidden decl. */ Index: name-lookup.c =================================================================== --- name-lookup.c (revision 248467) +++ name-lookup.c (working copy) @@ -4275,13 +4275,13 @@ set_decl_namespace (tree decl, tree scop friends in any namespace. */ if (friendp && DECL_USE_TEMPLATE (decl)) return; - if (is_overloaded_fn (old)) + if (OVL_P (old)) { tree found = NULL_TREE; - tree elt = old; - for (; elt; elt = OVL_NEXT (elt)) + + for (ovl_iterator iter (old); iter; ++iter) { - tree ofn = OVL_CURRENT (elt); + tree ofn = *iter; /* Adjust DECL_CONTEXT first so decls_match will return true if DECL will match a declaration in an inline namespace. */ DECL_CONTEXT (decl) = DECL_CONTEXT (ofn); @@ -4932,10 +4932,7 @@ consider_binding_level (tree name, best_ /* OVERLOADs or decls from using declaration are wrapped into TREE_LIST. */ if (TREE_CODE (d) == TREE_LIST) - { - d = TREE_VALUE (d); - d = OVL_CURRENT (d); - } + d = OVL_FIRST (TREE_VALUE (d)); /* Don't use bindings from implicitly declared functions, as they were likely misspellings themselves. */ @@ -6290,14 +6287,18 @@ cp_emit_debug_info_for_using (tree t, tr t = BASELINK_FUNCTIONS (t); /* FIXME: Handle TEMPLATE_DECLs. */ - for (t = OVL_CURRENT (t); t; t = OVL_NEXT (t)) - if (TREE_CODE (t) != TEMPLATE_DECL) - { - if (building_stmt_list_p ()) - add_stmt (build_stmt (input_location, USING_STMT, t)); - else - (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false); - } + for (lkp_iterator iter (t); iter; ++iter) + { + tree fn = *iter; + if (TREE_CODE (fn) != TEMPLATE_DECL) + { + if (building_stmt_list_p ()) + add_stmt (build_stmt (input_location, USING_STMT, fn)); + else + debug_hooks->imported_module_or_decl (fn, + NULL_TREE, context, false); + } + } } #include "gt-cp-name-lookup.h" Index: pt.c =================================================================== --- pt.c (revision 248466) +++ pt.c (working copy) @@ -2931,8 +2931,8 @@ check_explicit_specialization (tree decl /* Glue all these conversion functions together with those we already have. */ - for (; ovl; ovl = OVL_NEXT (ovl)) - fns = lookup_add (OVL_CURRENT (ovl), fns); + for (ovl_iterator iter (ovl); iter; ++iter) + fns = lookup_add (*iter, fns); } } --------------AB3240D035EAA70743CE2859--