From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id E9C263886C5E for ; Wed, 30 Jun 2021 09:30:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E9C263886C5E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 51C74116D8A for ; Wed, 30 Jun 2021 05:30:46 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wMTeEd+BvgLx for ; Wed, 30 Jun 2021 05:30:46 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 40ECC116D3C for ; Wed, 30 Jun 2021 05:30:46 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 402C81E7; Wed, 30 Jun 2021 05:30:46 -0400 (EDT) Date: Wed, 30 Jun 2021 05:30:46 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [Ada] Expose symmetry between Known_ and Unknown_ query routines Message-ID: <20210630093046.GA2444@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2021 09:30:53 -0000 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --VbJkn9YxBvnuCH5J Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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; -------------------- --VbJkn9YxBvnuCH5J--