From patchwork Fri Dec 11 18:07:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1415197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=BZ2FNOmA; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CszJf43Zlz9sSf for ; Sat, 12 Dec 2020 05:07:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D699D39730CA; Fri, 11 Dec 2020 18:07:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by sourceware.org (Postfix) with ESMTPS id 0336139730C2 for ; Fri, 11 Dec 2020 18:07:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0336139730C2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qt1-x82b.google.com with SMTP id c14so7093892qtn.0 for ; Fri, 11 Dec 2020 10:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=EOPcZkN+UBbFpAU9N6D53Vd/3TvmH4xPN77Q5hCUdg0=; b=BZ2FNOmAJMLD8eoROAklb4wRnaI5BwvSI1t2SMfKYnLe/Uo//qKJQj5L1PwThqn12O 0o2jhgPzS+S/ATCeunkUmyesSWBIcJoRvYH5uEOZU1gvWDSlyo/qgX5Nvozj0zsvFsAE okTIE0jd0O8NPNKbciNNoqZqnb/2fCvfzkNVG/awg+bFMjCa/a+NApQJN+q5ec2rgtFA RkmNc4D0lxi0IP16w9mqN6pxMTET5DUNqPbTtkV7VZEDaIo0qemk9UxiaNvf/+tJl/iE pb4bepdkbW6aQDtg4C36Sbrl0suErliz74vrL+qleHtAP/lwk7VZeDm7fKVIEcknqsDz ASAQ== 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=EOPcZkN+UBbFpAU9N6D53Vd/3TvmH4xPN77Q5hCUdg0=; b=X/8k1yGn8kwdPPaUzfR01gX84uVNocM/pb+zMp9Uig/9u8lnqcGCAtsO3CPgFp5BIa Kv+GVIcTjyvbP1y5WstIZOztFkywaCRzLs+xFWZ4OY3My9dSHn4VVbw7Py8gNEXvM+tF g2YrQiSnqPiRsp6ZHLJcIATKQXQsLdR+3/sQsL8IsbMr3dGhKgY/Dj2O2lao9fp64w8Y /kN7Qh91/CdLvliIbWPk/1sigxnl/OqLgammgwZ9TXt23jXQ+fgx8JkL63xe/9hyfAeA YKeD3c4DEGjqWjR6/fRCIVw1DJsU66evDmVVZPvH9xmYxJm6VgarADYeAsmEYuJnjgLd heqA== X-Gm-Message-State: AOAM530gQqDuLukjoYScknJ/bacYRmKS/0tk1Odq482xrmyeFiMlx0oE DUopFZaOZCyp6Jpm3fxezvw= X-Google-Smtp-Source: ABdhPJyXIFgAEdAQm0783BmW6FiGahqQ3kKHF5VVY9PiFYoQGbgayw8eNyb72lL7x2ZyLY+T8vO1qA== X-Received: by 2002:ac8:7111:: with SMTP id z17mr17220738qto.369.1607710028158; Fri, 11 Dec 2020 10:07:08 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:7d2d:1a8a:7a22:aa55? ([2620:10d:c091:480::1:e048]) by smtp.googlemail.com with ESMTPSA id x47sm7739262qtb.86.2020.12.11.10.07.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Dec 2020 10:07:07 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: Refactor final cleanup Message-ID: <2c806ae5-cc5d-aab0-1cb5-1b9b671e57b0@acm.org> Date: Fri, 11 Dec 2020 13:07:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This is a small refactor of the end of decl processing, into which dropping module support will be simpler. gcc/cp/ * decl2.c (c_parse_final_cleanups): Refactor loop. pushing to trunk diff --git i/gcc/cp/decl2.c w/gcc/cp/decl2.c index c122017c2fa..b13c9d9f73d 100644 --- i/gcc/cp/decl2.c +++ w/gcc/cp/decl2.c @@ -4887,11 +4887,7 @@ lower_var_init () void c_parse_final_cleanups (void) { - tree vars; - bool reconsider; size_t i; - unsigned ssdf_count = 0; - int retries = 0; tree decl; locus_at_end_of_parsing = input_location; @@ -4957,11 +4953,10 @@ c_parse_final_cleanups (void) /* Track vtables we want to emit that refer to consteval functions. */ auto_vec consteval_vtables; - do + int retries = 0; + unsigned ssdf_count = 0; + for (bool reconsider = true; reconsider; retries++) { - tree t; - tree decl; - reconsider = false; /* If there are templates that we've put off instantiating, do @@ -4974,6 +4969,7 @@ c_parse_final_cleanups (void) instantiation of members of that class. If we write out vtables then we remove the class from our list so we don't have to look at it again. */ + tree t; for (i = keyed_classes->length (); keyed_classes->iterate (--i, &t);) if (maybe_emit_vtables (t, consteval_vtables)) @@ -5003,9 +4999,7 @@ c_parse_final_cleanups (void) aggregates added during the initialization of these will be initialized in the correct order when we next come around the loop. */ - vars = prune_vars_needing_no_initialization (&static_aggregates); - - if (vars) + if (tree vars = prune_vars_needing_no_initialization (&static_aggregates)) { /* We need to start a new initialization function each time through the loop. That's because we need to know which @@ -5052,7 +5046,6 @@ c_parse_final_cleanups (void) instantiations, etc. */ reconsider = true; ssdf_count++; - /* ??? was: locus_at_end_of_parsing.line++; */ } /* Now do the same for thread_local variables. */ @@ -5162,14 +5155,12 @@ c_parse_final_cleanups (void) if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl)) DECL_EXTERNAL (decl) = 0; } + if (vec_safe_length (pending_statics) != 0 && wrapup_global_declarations (pending_statics->address (), pending_statics->length ())) reconsider = true; - - retries++; } - while (reconsider); lower_var_init ();