From patchwork Mon Aug 21 18:59: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: 804132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-460662-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="nd9XfUW9"; dkim-atps=neutral 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 3xbjfJ0cWBz9s7v for ; Tue, 22 Aug 2017 04:59:17 +1000 (AEST) 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=gKkAlDhca5zbYS4KFEjzLZ4CMejy54lQLn57PTJH2D+8eQ4vf/ 2041LxSdnYMEfcHsM+izpUHSn+TTBPqi8hCju41L6aQKQX1PsS2cMlbIN0rVwHdb 9SFaGDs56YIgUpJcoxhBMU6ikOf/UTPxXP6aUf4gjw7zNZ8BlW1Nlom3A= 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=9yBLxVJl1+p4m39zm3p7kFR8yT4=; b=nd9XfUW9zliDgfOt9R46 Lw4BOHaBBkrTd3XyL38m57egllfN1liH8zpq/rHNG96tmY6GuAgzCyboMFRHGO+c j+UiJkLASXO0EDLFPeTBxYqnXM9qiQnSJURcuyXYZ+yiWHRa75zrt7sYBKpr+24E MRkfX4fQqN6i0FQ+noGWfDk= Received: (qmail 112978 invoked by alias); 21 Aug 2017 18:59:10 -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 112534 invoked by uid 89); 21 Aug 2017 18:59:09 -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=formed, ripping X-HELO: mail-yw0-f176.google.com Received: from mail-yw0-f176.google.com (HELO mail-yw0-f176.google.com) (209.85.161.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Aug 2017 18:59:07 +0000 Received: by mail-yw0-f176.google.com with SMTP id h127so27941361ywf.0 for ; Mon, 21 Aug 2017 11:59:07 -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=xBPxwDMh+2CQ+fc6f5ZKNu+G9MFWnbsWoLRke+dYtOI=; b=OIS1y7bOmZill9hTJdj+7d+/SvityRrELApAMbAAHCtNtdT3mPfzunUsKYUzPa0Ugi IZhMQ9F7LtQZx9/XiIxrAXH9TmskZp2Qo82Qlx+fvvX/uMAJw5r37NW6Z+Qz8WGCyJK/ QbRTSGFrP/ltO7eCg5EemdwinCieVcWsQmmAqiJJlg54Xken/z2SWuagwiYJKLIJNFqS VgZIBvmLu2cjsgyMc0iVfdKDFLoKvFitWkM9TPb1HkSFgP/5xul9lqlEjMEBDm9kbJqU On1FretwAHU8Pho54kDlLpzlXNZPmKi0hGBGYFxeKIrr2+NKMJn/gXFsLUipC2Uv/YHC tL0w== X-Gm-Message-State: AHYfb5jDg2msmnfyoGNnl0h0CDBvrngouh/ILFC/N/DfCjuaQjwm8ZQn SCRp3jy+tnf4jg== X-Received: by 10.129.122.16 with SMTP id v16mr7605145ywc.69.1503341945960; Mon, 21 Aug 2017 11:59:05 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::2:59fa]) by smtp.googlemail.com with ESMTPSA id u9sm4857798ywl.17.2017.08.21.11.59.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 11:59:05 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [C++ PATCH]: Dead code-ectomy Message-ID: Date: Mon, 21 Aug 2017 14:59:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Some more dead code in class lookup. It's not been well formed to allow class fields to be the type-name for a very long time now. I booted with a gcc-unreachable inside the elided loop condition, before ripping the loop out completely. Again, applied to trunk to get wider exposure. nathan 2017-08-21 Nathan Sidwell * search.c (lookup_field_r): Remove obsolete code for type-named field in PoD. Index: search.c =================================================================== --- search.c (revision 251241) +++ search.c (working copy) @@ -1111,39 +1111,22 @@ lookup_field_r (tree binfo, void *data) nval = dep_using; } - /* If there is no declaration with the indicated name in this type, - then there's nothing to do. */ - if (!nval) - goto done; - /* If we're looking up a type (as with an elaborated type specifier) we ignore all non-types we find. */ - if (lfi->want_type && !DECL_DECLARES_TYPE_P (nval)) + if (lfi->want_type && nval && !DECL_DECLARES_TYPE_P (nval)) { - if (lfi->name == TYPE_IDENTIFIER (type)) - { - /* If the aggregate has no user defined constructors, we allow - it to have fields with the same name as the enclosing type. - If we are looking for that name, find the corresponding - TYPE_DECL. */ - for (nval = TREE_CHAIN (nval); nval; nval = TREE_CHAIN (nval)) - if (DECL_NAME (nval) == lfi->name - && TREE_CODE (nval) == TYPE_DECL) - break; - } - else - nval = NULL_TREE; - if (!nval && CLASSTYPE_NESTED_UTDS (type) != NULL) - { - binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type), - lfi->name); - if (e != NULL) - nval = TYPE_MAIN_DECL (e->type); - else - goto done; - } + nval = NULL_TREE; + if (CLASSTYPE_NESTED_UTDS (type)) + if (binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type), + lfi->name)) + nval = TYPE_MAIN_DECL (e->type); } + /* If there is no declaration with the indicated name in this type, + then there's nothing to do. */ + if (!nval) + goto done; + /* If the lookup already found a match, and the new value doesn't hide the old one, we might have an ambiguity. */ if (lfi->rval_binfo