* [Ada] Expose symmetry between Known_ and Unknown_ query routines
@ 2021-06-30 9:30 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-30 9:30 UTC (permalink / raw)
To: gcc-patches
[-- 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;
--------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-30 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 9:30 [Ada] Expose symmetry between Known_ and Unknown_ query routines Pierre-Marie de Rodat
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).