From 4892e31daceb8ab230768a15eb0a01b814e8bbfd Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Thu, 11 Mar 2021 17:20:41 -0500 Subject: [Ada] Warn on 'in out' param containing access in predefined private type gcc/ada/ * sem_util.adb, sem_util.ads (Has_Access_Values): New formal Include_Internal to indicate whether internal types should be included. * sem_warn.adb (Check_References): Change E_Out_Parameter to Formal_Kind, to match the comment about Spec_Entity. Pass Include_Internal => False to Has_Access_Values, so that we warn on types with access values that happen to be in internal types, such as Unbounded_String. * sem_attr.adb (Attribute_Has_Access_Values): Pass Include_Internal => True to Has_Access_Values, to preserve existing behavior. * libgnat/g-rewdat.adb (Do_Output): Change B from 'in out' to 'in', to avoid warning enabled by the change to sem_warn.adb. * libgnat/s-objrea.adb (Check_Read_Offset): Change S from 'in out' to 'in', to avoid warning enabled by the change to sem_warn.adb. --- gcc/ada/libgnat/g-rewdat.adb | 4 ++-- gcc/ada/libgnat/s-objrea.adb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/ada/libgnat') diff --git a/gcc/ada/libgnat/g-rewdat.adb b/gcc/ada/libgnat/g-rewdat.adb index c257afa..3b4a0d0 100644 --- a/gcc/ada/libgnat/g-rewdat.adb +++ b/gcc/ada/libgnat/g-rewdat.adb @@ -37,7 +37,7 @@ package body GNAT.Rewrite_Data is subtype SEO is Stream_Element_Offset; procedure Do_Output - (B : in out Buffer; + (B : Buffer; Data : Stream_Element_Array; Output : not null access procedure (Data : Stream_Element_Array)); -- Do the actual output. This ensures that we properly send the data @@ -81,7 +81,7 @@ package body GNAT.Rewrite_Data is --------------- procedure Do_Output - (B : in out Buffer; + (B : Buffer; Data : Stream_Element_Array; Output : not null access procedure (Data : Stream_Element_Array)) is diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb index 50be05a..b5ca32f 100644 --- a/gcc/ada/libgnat/s-objrea.adb +++ b/gcc/ada/libgnat/s-objrea.adb @@ -47,7 +47,7 @@ package body System.Object_Reader is function Trim_Trailing_Nuls (Str : String) return String; -- Return a copy of a string with any trailing NUL characters truncated - procedure Check_Read_Offset (S : in out Mapped_Stream; Size : uint32); + procedure Check_Read_Offset (S : Mapped_Stream; Size : uint32); -- Check that the SIZE bytes at the current offset are still in the stream ------------------------------------- @@ -1931,7 +1931,7 @@ package body System.Object_Reader is return To_String_Ptr_Len (Read (S)); end Read; - procedure Check_Read_Offset (S : in out Mapped_Stream; Size : uint32) is + procedure Check_Read_Offset (S : Mapped_Stream; Size : uint32) is begin if S.Off + Offset (Size) > Offset (Last (S.Region)) then raise IO_Error with "could not read from object file"; -- cgit v1.1