From: Viljar Indus <in...@adacore.com>

Records without a limited keyword now emit a warning if
they contain a member that has an inherently limited type.

gcc/ada/

        * libgnat/a-coinho__shared.ads: add limited keyword.
        * libgnat/g-awk.adb: add limited keyword.
        * libgnat/g-comlin.ads: add limited keyword.
        * libgnat/s-excmac__arm.ads: add limited keyword.
        * libgnat/s-excmac__gcc.ads: add limited keyword.
        * libgnat/s-soflin.ads: add limited keyword.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnat/a-coinho__shared.ads | 2 +-
 gcc/ada/libgnat/g-awk.adb            | 2 +-
 gcc/ada/libgnat/g-comlin.ads         | 4 ++--
 gcc/ada/libgnat/s-excmac__arm.ads    | 2 +-
 gcc/ada/libgnat/s-excmac__gcc.ads    | 2 +-
 gcc/ada/libgnat/s-soflin.ads         | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/libgnat/a-coinho__shared.ads 
b/gcc/ada/libgnat/a-coinho__shared.ads
index ddab1fd7d93..57abd1bafe3 100644
--- a/gcc/ada/libgnat/a-coinho__shared.ads
+++ b/gcc/ada/libgnat/a-coinho__shared.ads
@@ -109,7 +109,7 @@ private
 
    type Holder_Access is access all Holder;
 
-   type Shared_Holder is record
+   type Shared_Holder is limited record
       Counter : System.Atomic_Counters.Atomic_Counter;
       Element : Element_Access;
    end record;
diff --git a/gcc/ada/libgnat/g-awk.adb b/gcc/ada/libgnat/g-awk.adb
index 62856d9204a..c9284944dd5 100644
--- a/gcc/ada/libgnat/g-awk.adb
+++ b/gcc/ada/libgnat/g-awk.adb
@@ -261,7 +261,7 @@ package body GNAT.AWK is
    -- Session Data --
    ------------------
 
-   type Session_Data is record
+   type Session_Data is limited record
       Current_File : Text_IO.File_Type;
       Current_Line : Unbounded_String;
       Separators   : Split.Mode_Access;
diff --git a/gcc/ada/libgnat/g-comlin.ads b/gcc/ada/libgnat/g-comlin.ads
index c20cd5eb31a..2a131e5d78c 100644
--- a/gcc/ada/libgnat/g-comlin.ads
+++ b/gcc/ada/libgnat/g-comlin.ads
@@ -1045,7 +1045,7 @@ private
 
    type Depth is range 1 .. Max_Depth;
 
-   type Level is record
+   type Level is limited record
       Name_Last : Natural := 0;
       Dir       : GNAT.Directory_Operations.Dir_Type;
    end record;
@@ -1087,7 +1087,7 @@ private
       --  separators in the pattern.
    end record;
 
-   type Opt_Parser_Data (Arg_Count : Natural) is record
+   type Opt_Parser_Data (Arg_Count : Natural) is limited record
       Arguments : GNAT.OS_Lib.Argument_List_Access;
       --  null if reading from the command line
 
diff --git a/gcc/ada/libgnat/s-excmac__arm.ads 
b/gcc/ada/libgnat/s-excmac__arm.ads
index 23d02f85ff9..463191d6b42 100644
--- a/gcc/ada/libgnat/s-excmac__arm.ads
+++ b/gcc/ada/libgnat/s-excmac__arm.ads
@@ -154,7 +154,7 @@ package System.Exceptions.Machine is
    --  A GNAT exception object to be dealt with by the personality routine
    --  called by the GCC unwinding runtime.
 
-   type GNAT_GCC_Exception is record
+   type GNAT_GCC_Exception is limited record
       Header : Unwind_Control_Block;
       --  ABI Exception header first
 
diff --git a/gcc/ada/libgnat/s-excmac__gcc.ads 
b/gcc/ada/libgnat/s-excmac__gcc.ads
index 24899055506..6cbc92654ec 100644
--- a/gcc/ada/libgnat/s-excmac__gcc.ads
+++ b/gcc/ada/libgnat/s-excmac__gcc.ads
@@ -142,7 +142,7 @@ package System.Exceptions.Machine is
    --  A GNAT exception object to be dealt with by the personality routine
    --  called by the GCC unwinding runtime.
 
-   type GNAT_GCC_Exception is record
+   type GNAT_GCC_Exception is limited record
       Header : Unwind_Exception;
       --  ABI Exception header first
 
diff --git a/gcc/ada/libgnat/s-soflin.ads b/gcc/ada/libgnat/s-soflin.ads
index c2d947535d9..61025e5961d 100644
--- a/gcc/ada/libgnat/s-soflin.ads
+++ b/gcc/ada/libgnat/s-soflin.ads
@@ -339,7 +339,7 @@ package System.Soft_Links is
    --  specific data. This type is used to store the necessary data into the
    --  Task_Control_Block or into a global variable in the non tasking case.
 
-   type TSD is record
+   type TSD is limited record
       Pri_Stack_Info : aliased Stack_Checking.Stack_Info;
       --  Information on stack (Base/Limit/Size) used by System.Stack_Checking.
       --  If this TSD does not belong to the environment task, the Size field
-- 
2.45.2

Reply via email to