public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2158] [Ada] Simplify redundant checks for non-empty lists
Date: Thu,  8 Jul 2021 13:37:25 +0000 (GMT)	[thread overview]
Message-ID: <20210708133725.54B54398B842@sourceware.org> (raw)

https://gcc.gnu.org/g:73f841cfca82827a60b9a4da8400f6686c85d3ec

commit r12-2158-g73f841cfca82827a60b9a4da8400f6686c85d3ec
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu May 27 17:16:34 2021 +0200

    [Ada] Simplify redundant checks for non-empty lists
    
    gcc/ada/
    
            * sem_ch12.adb, sem_ch6.adb, sem_ch9.adb, sprint.adb: Simplify
            checks for non-empty lists.

Diff:
---
 gcc/ada/sem_ch12.adb | 1 -
 gcc/ada/sem_ch6.adb  | 1 -
 gcc/ada/sem_ch9.adb  | 4 +---
 gcc/ada/sprint.adb   | 8 ++------
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index bf51ce9e7e1..85c854f19f3 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -9724,7 +9724,6 @@ package body Sem_Ch12 is
 
          if Nkind (Par_N) = N_Package_Specification
            and then Decls = Visible_Declarations (Par_N)
-           and then Present (Private_Declarations (Par_N))
            and then not Is_Empty_List (Private_Declarations (Par_N))
          then
             Decls := Private_Declarations (Par_N);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 75e5a99c132..fbb2b55926a 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -549,7 +549,6 @@ package body Sem_Ch6 is
             else
                if Nkind (Par) = N_Package_Specification
                  and then Decls = Visible_Declarations (Par)
-                 and then Present (Private_Declarations (Par))
                  and then not Is_Empty_List (Private_Declarations (Par))
                then
                   Decls := Private_Declarations (Par);
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 65f48a71b08..ab25dd0143a 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -1955,9 +1955,7 @@ package body Sem_Ch9 is
       Tasking_Used := True;
       Analyze_Declarations (Visible_Declarations (N));
 
-      if Present (Private_Declarations (N))
-        and then not Is_Empty_List (Private_Declarations (N))
-      then
+      if not Is_Empty_List (Private_Declarations (N)) then
          Last_Id := Last_Entity (Prot_Typ);
          Analyze_Declarations (Private_Declarations (N));
 
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 446792911dd..c1f1edecd80 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -1065,16 +1065,12 @@ package body Sprint is
                if Present (Expressions (Node)) then
                   Sprint_Comma_List (Expressions (Node));
 
-                  if Present (Component_Associations (Node))
-                    and then not Is_Empty_List (Component_Associations (Node))
-                  then
+                  if not Is_Empty_List (Component_Associations (Node)) then
                      Write_Str (", ");
                   end if;
                end if;
 
-               if Present (Component_Associations (Node))
-                 and then not Is_Empty_List (Component_Associations (Node))
-               then
+               if not Is_Empty_List (Component_Associations (Node)) then
                   Indent_Begin;
 
                   declare


                 reply	other threads:[~2021-07-08 13:37 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=20210708133725.54B54398B842@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).