public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Add contracts to System.Address_To_Access_Conversions
@ 2022-06-02  9:08 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-06-02  9:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Joffrey Huguet

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

This patch adds SPARK annotations to subprograms from
System.Address_To_Access_Conversions. To_Pointer is considered to have
no global items, if the returned value has no aliases. To_Address is
forbidden in SPARK because addresses are not handled.

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

gcc/ada/

	* libgnat/s-atacco.ads (To_Pointer): Add Global => null.
	(To_Address): Add SPARK_Mode => Off.

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

diff --git a/gcc/ada/libgnat/s-atacco.ads b/gcc/ada/libgnat/s-atacco.ads
--- a/gcc/ada/libgnat/s-atacco.ads
+++ b/gcc/ada/libgnat/s-atacco.ads
@@ -54,8 +54,10 @@ package System.Address_To_Access_Conversions is
    --  optimizations that may cause unexpected results based on the assumption
    --  of no strict aliasing.
 
-   function To_Pointer (Value : Address)        return Object_Pointer;
-   function To_Address (Value : Object_Pointer) return Address;
+   function To_Pointer (Value : Address)        return Object_Pointer with
+     Global => null;
+   function To_Address (Value : Object_Pointer) return Address with
+     SPARK_Mode => Off;
 
    pragma Import (Intrinsic, To_Pointer);
    pragma Import (Intrinsic, To_Address);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  9:08 [Ada] Add contracts to System.Address_To_Access_Conversions 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).