public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [Ada] Remove dead code from Enclosing_Package_Or_Subprogram routine
Date: Mon, 08 Jul 2019 08:19:00 -0000	[thread overview]
Message-ID: <20190708081859.GA80776@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Calls to Scope always return unique entities, i.e. package/subprogram
and not their bodies, so there is no need to expect them.

Cleanup only; semantics unaffected. (This routine was only used in CCG
and GNATprove backends anyway.)

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-07-08  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_util.adb (Enclosing_Package_Or_Subprogram): Do not expect
	package and subprogram bodies.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 492 bytes --]

--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -6924,12 +6924,7 @@ package body Sem_Util is
       S := Scope (E);
       while Present (S) loop
          if Is_Package_Or_Generic_Package (S)
-           or else Ekind (S) = E_Package_Body
-         then
-            return S;
-
-         elsif Is_Subprogram_Or_Generic_Subprogram (S)
-           or else Ekind (S) = E_Subprogram_Body
+           or else Is_Subprogram_Or_Generic_Subprogram (S)
          then
             return S;
 


                 reply	other threads:[~2019-07-08  8:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708081859.GA80776@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).