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
Subject: [Ada] Expose symmetry between Known_ and Unknown_ query routines
Date: Wed, 30 Jun 2021 05:30:46 -0400	[thread overview]
Message-ID: <20210630093046.GA2444@adacore.com> (raw)

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

We have two families of routines to query entity properties: Known_XXX
and Unknown_XXX. They now simply negate each other instead of negating
their complex conditions.

Code cleanup only related to handling of Alignment in GNATprove;
semantics is unaffected.

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

gcc/ada/

	* einfo-utils.adb
	(Unknown_Alignment): Simply negate the Known_ counterpart.
	(Unknown_Component_Bit_Offset): Likewise.
	(Unknown_Esize): Likewise.
	(Unknown_Normalized_First_Bit): Likewise.
	(Unknown_Normalized_Position): Likewise.
	(Unknown_Normalized_Position_Max): Likewise.
	(Unknown_RM_Size): Likewise.

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

diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -593,13 +593,12 @@ package body Einfo.Utils is
 
    function Unknown_Alignment                     (E : Entity_Id) return B is
    begin
-      return Alignment (E) = Uint_0
-        or else Alignment (E) = No_Uint;
+      return not Known_Alignment (E);
    end Unknown_Alignment;
 
    function Unknown_Component_Bit_Offset          (E : Entity_Id) return B is
    begin
-      return Component_Bit_Offset (E) = No_Uint;
+      return not Known_Component_Bit_Offset (E);
    end Unknown_Component_Bit_Offset;
 
    function Unknown_Component_Size                (E : Entity_Id) return B is
@@ -609,32 +608,27 @@ package body Einfo.Utils is
 
    function Unknown_Esize                         (E : Entity_Id) return B is
    begin
-      return Esize (E) = No_Uint
-               or else
-             Esize (E) = Uint_0;
+      return not Known_Esize (E);
    end Unknown_Esize;
 
    function Unknown_Normalized_First_Bit          (E : Entity_Id) return B is
    begin
-      return Normalized_First_Bit (E) = No_Uint;
+      return not Known_Normalized_First_Bit (E);
    end Unknown_Normalized_First_Bit;
 
    function Unknown_Normalized_Position           (E : Entity_Id) return B is
    begin
-      return Normalized_Position (E) = No_Uint;
+      return not Known_Normalized_Position (E);
    end Unknown_Normalized_Position;
 
    function Unknown_Normalized_Position_Max       (E : Entity_Id) return B is
    begin
-      return Normalized_Position_Max (E) = No_Uint;
+      return not Known_Normalized_Position_Max (E);
    end Unknown_Normalized_Position_Max;
 
    function Unknown_RM_Size                       (E : Entity_Id) return B is
    begin
-      return (RM_Size (E) = Uint_0
-                and then not Is_Discrete_Type (E)
-                and then not Is_Fixed_Point_Type (E))
-        or else RM_Size (E) = No_Uint;
+      return not Known_RM_Size (E);
    end Unknown_RM_Size;
 
    --------------------



                 reply	other threads:[~2021-06-30  9:30 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=20210630093046.GA2444@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@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).