{"id":825836,"url":"http://patchwork.ozlabs.org/api/1.2/patches/825836/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20171014164803.GA103178@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171014164803.GA103178@adacore.com>","list_archive_url":null,"date":"2017-10-14T16:48:03","name":"[Ada] Spurious ineffective use_type_clause warning on private type","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bed20267eb9f5ca07384e30bfdbc0798c6171814","submitter":{"id":64226,"url":"http://patchwork.ozlabs.org/api/1.2/people/64226/?format=json","name":"Pierre-Marie de Rodat","email":"derodat@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20171014164803.GA103178@adacore.com/mbox/","series":[{"id":8199,"url":"http://patchwork.ozlabs.org/api/1.2/series/8199/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=8199","date":"2017-10-14T16:48:03","name":"[Ada] Spurious ineffective use_type_clause warning on private type","version":1,"mbox":"http://patchwork.ozlabs.org/series/8199/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/825836/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/825836/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-464218-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-464218-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"TNgdXrjO\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yDrBT4YFjz9t3H\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 15 Oct 2017 03:48:33 +1100 (AEDT)","(qmail 1118 invoked by alias); 14 Oct 2017 16:48:24 -0000","(qmail 881 invoked by uid 89); 14 Oct 2017 16:48:12 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSat, 14 Oct 2017 16:48:04 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 6373056153;\n\tSat, 14 Oct 2017 12:48:03 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\t15KVqNuZm6jG; Sat, 14 Oct 2017 12:48:03 -0400 (EDT)","from tron.gnat.com (tron.gnat.com [205.232.38.10])\tby\n\trock.gnat.com (Postfix) with ESMTP id 52E2A56079;\n\tSat, 14 Oct 2017 12:48:03 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4862)\tid 51CFA319;\n\tSat, 14 Oct 2017 12:48:03 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=VwvtRyJEQiqehPwiI50ygKtyMT47SXrcZwwtpynZIokLfDHkCy\n\tsmUqXqw+laRpxxiOgpGcyAXl57qZbn5lZSwS0AA9t5VYcybE87UPjZerVuQXpq2o\n\t+poqnSaCA8CY3e/Q4C0xWgIhYsHRW2A10LHfPSAixFmXUn8W2GPVteP+4=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=cu4tzdETq2d5H63bLHOxQuqwIZI=; b=TNgdXrjOb0729yG0JXkQ\n\tPNk0omwxDkTzB5mz2898DUPFatnIo3ZQqmzLyTU4WJuamq5JYC9py7FELx7RVb32\n\teBPhgbESpILEKvaSjFvCxOH65hhh9Okw9gERzSaNuyNEeC986cazIMUsELo2hCLy\n\tcJerny33894XopitnyrbqXE=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.2 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2032","X-HELO":"rock.gnat.com","Date":"Sat, 14 Oct 2017 12:48:03 -0400","From":"Pierre-Marie de Rodat <derodat@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Justin Squirek <squirek@adacore.com>","Subject":"[Ada] Spurious ineffective use_type_clause warning on private type","Message-ID":"<20171014164803.GA103178@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"a8Wt8u1KmwUX3Y2C\"","Content-Disposition":"inline","User-Agent":"Mutt/1.5.23 (2014-03-12)","X-IsSubscribed":"yes"},"content":"This patch corrects an issue whereby a defaulted formal subprogram was not\nbeing accounted for when checking for ineffective use_type_clauses on private\ntypes used as generic actuals.\n\n------------\n-- Source --\n------------\n\n--  types.ads\n\npackage Types is\n   type Enum_1 is private;\nprivate\n   type Enum_1 is (Red_1, Green_1, Blue_1);\nend;\n\n--  main.adb\n\nwith Types;\nprocedure Main is\n\n   generic\n      type Elem is private;\n      with function \"=\" (L, R : Elem)\n         return Boolean is <>;\n   package Nested_4 is end;\n\n   use type Types.Enum_1;\n   package X is new Nested_4 (Types.Enum_1);\nbegin\n   null;\nend;\n\n----------------------------\n-- Compilation and output --\n----------------------------\n\n& gnatmake -q -gnatwu main.adb\nmain.adb:6:21: warning: function \"=\" is not referenced\nmain.adb:11:12: warning: package \"X\" is not referenced\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-10-14  Justin Squirek  <squirek@adacore.com>\n\n\t* sem_ch8.adb (Analyze_Subprogram_Renaming): Modify condition that\n\ttriggers marking on formal subprograms.","diff":"Index: sem_ch8.adb\n===================================================================\n--- sem_ch8.adb\t(revision 253753)\n+++ sem_ch8.adb\t(working copy)\n@@ -3644,19 +3644,16 @@\n       --  and mark any use_package_clauses that affect the visibility of the\n       --  implicit generic actual.\n \n-      if From_Default (N)\n-        and then Is_Generic_Actual_Subprogram (New_S)\n-        and then Present (Alias (New_S))\n+      if Is_Generic_Actual_Subprogram (New_S)\n+        and then (Is_Intrinsic_Subprogram (New_S) or else From_Default (N))\n       then\n-         Mark_Use_Clauses (Alias (New_S));\n+         Mark_Use_Clauses (New_S);\n \n-      --  Check intrinsic operators used as generic actuals since they may\n-      --  make a use_type_clause effective.\n+         --  Handle overloaded subprograms\n \n-      elsif Is_Generic_Actual_Subprogram (New_S)\n-        and then Is_Intrinsic_Subprogram (New_S)\n-      then\n-         Mark_Use_Clauses (New_S);\n+         if Present (Alias (New_S)) then\n+            Mark_Use_Clauses (Alias (New_S));\n+         end if;\n       end if;\n    end Analyze_Subprogram_Renaming;\n \n","prefixes":["Ada"]}