From patchwork Wed Feb 28 14:00:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 879148 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-474013-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bLTMsaYv"; 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 3zrxzv5jjgz9s1q for ; Thu, 1 Mar 2018 01:00:59 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=orb5AA3Q75UxhFT/ UBaOwBDL3eErhxhcXazBhKhCbs0p9gL7Hz4dVPRqQVq4DgTkdVZX9ZkrU0PmglK/ LDmmgNiKatqA4trndRsSRkXwYwytsoDgrG+9eEiaEe3B6HdewEvSQ7b83isUOgjZ ajKJ2Z87j+oe+ZLHwIzZa9WJI98= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=57J+eSR8yE7W8xN0qNkj2m jQ1C4=; b=bLTMsaYvrWhIETssx9iY9jfaJJ93NsmUh8n8T/nk2PMbtZkAWSdth9 tWGJLMrpz5+y29cL1MFxot7nDlHEEEw1oz6ajb23HO7VPFFi24JB2cLQ72i3h4zh Ii6tXWD4MpZyILYdX49/nDtrUMyEtAUARt9S1BQA0E5ZocCw9YnHE= Received: (qmail 104529 invoked by alias); 28 Feb 2018 14:00:36 -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 104273 invoked by uid 89); 28 Feb 2018 14:00:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Feb 2018 14:00:05 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 31CEC81393 for ; Wed, 28 Feb 2018 15:00:03 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nh1jYpLFKApm for ; Wed, 28 Feb 2018 15:00:03 +0100 (CET) Received: from arcturus.home (ADijon-653-1-18-212.w90-39.abo.wanadoo.fr [90.39.175.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 08524812FD for ; Wed, 28 Feb 2018 15:00:02 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix handling of incomplete types with -fdump-ada-spec (2/2) Date: Wed, 28 Feb 2018 15:00:01 +0100 Message-ID: <2349794.0xnm4f7mv0@arcturus.home> MIME-Version: 1.0 This extends the previous change to "opaque" types, i.e. types that are still incomplete at the end of the translation unit. Tested on x86_64-suse-linux, applied on the mainline. 2018-02-28 Eric Botcazou c-family/ * c-ada-spec.c (dump_ada_node) : Do not use generic address for incomplete structures. (dump_forward_type): Do not bail out for incomplete structures. (dump_ada_declaration): Do not special-case incomplete structures for subtypes. Dump them as null records for types. 2018-02-28 Eric Botcazou * c-c++-common/dump-ada-spec-11.c: New test. Index: c-ada-spec.c =================================================================== --- c-ada-spec.c (revision 258064) +++ c-ada-spec.c (working copy) @@ -2266,11 +2266,8 @@ dump_ada_node (pretty_printer *buffer, tree node, { tree type_name = TYPE_NAME (TREE_TYPE (node)); - /* For now, handle access-to-access and access-to-incomplete - as opaque System.Address. */ - if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE - || (RECORD_OR_UNION_TYPE_P (TREE_TYPE (node)) - && !COMPLETE_TYPE_P (TREE_TYPE (node)))) + /* For now, handle access-to-access as System.Address. */ + if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE) { if (package_prefix) { @@ -2515,11 +2512,6 @@ dump_forward_type (pretty_printer *buffer, tree ty if (DECL_IS_BUILTIN (decl) || TREE_VISITED (decl)) return; - /* We'll need to generate a completion at some point. */ - if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)) - && !COMPLETE_TYPE_P (TREE_TYPE (decl))) - return; - /* Forward declarations are only needed within a given file. */ if (DECL_SOURCE_FILE (decl) != DECL_SOURCE_FILE (t)) return; @@ -2743,23 +2735,15 @@ dump_ada_declaration (pretty_printer *buffer, tree INDENT (spc); - if (RECORD_OR_UNION_TYPE_P (typ) && !COMPLETE_TYPE_P (typ)) - { - pp_string (buffer, "-- skipped incomplete struct "); - dump_ada_node (buffer, t, type, spc, false, true); - } - else - { - if (RECORD_OR_UNION_TYPE_P (typ)) - dump_forward_type (buffer, stub, t, spc); + if (RECORD_OR_UNION_TYPE_P (typ)) + dump_forward_type (buffer, stub, t, spc); - pp_string (buffer, "subtype "); - dump_ada_node (buffer, t, type, spc, false, true); - pp_string (buffer, " is "); - dump_ada_node (buffer, typ, type, spc, false, true); - pp_string (buffer, "; -- "); - dump_sloc (buffer, t); - } + pp_string (buffer, "subtype "); + dump_ada_node (buffer, t, type, spc, false, true); + pp_string (buffer, " is "); + dump_ada_node (buffer, typ, type, spc, false, true); + pp_string (buffer, "; -- "); + dump_sloc (buffer, t); TREE_VISITED (t) = 1; return 1; @@ -2788,8 +2772,10 @@ dump_ada_declaration (pretty_printer *buffer, tree case UNION_TYPE: if (!COMPLETE_TYPE_P (TREE_TYPE (t))) { - pp_string (buffer, "-- skipped incomplete struct "); + pp_string (buffer, "type "); dump_ada_node (buffer, t, type, spc, false, true); + pp_string (buffer, " is null record; -- incomplete struct"); + TREE_VISITED (t) = 1; return 1; }