This switch suppresses listing of inherited aspects.
+.. index:: -gnatw_l (gcc)
+
+:switch:`-gnatw_l`
+ *Activate warnings on inheritely limited types.*
+
+ This switch causes the compiler trigger warnings on record types that do not
+ have a limited keyword but contain a component that is a limited type.
+
+
+.. index:: -gnatw_L (gcc)
+
+:switch:`-gnatw_L`
+ *Suppress warnings on inheritely limited types.*
+
+ This switch suppresses warnings on inheritely limited types.
+
+
.. index:: -gnatwm (gcc)
:switch:`-gnatwm`
@copying
@quotation
-GNAT User's Guide for Native Platforms , Jul 29, 2024
+GNAT User's Guide for Native Platforms , Aug 19, 2024
AdaCore
This switch suppresses listing of inherited aspects.
@end table
+@geindex -gnatw_l (gcc)
+
+
+@table @asis
+
+@item @code{-gnatw_l}
+
+`Activate warnings on inheritely limited types.'
+
+This switch causes the compiler trigger warnings on record types that do not
+have a limited keyword but contain a component that is a limited type.
+@end table
+
+@geindex -gnatw_L (gcc)
+
+
+@table @asis
+
+@item @code{-gnatw_L}
+
+`Suppress warnings on inheritely limited types.'
+
+This switch suppresses warnings on inheritely limited types.
+@end table
+
@geindex -gnatwm (gcc)
-- Check that an entity in a list of progenitors is an interface,
-- emit error otherwise.
+ procedure Warn_On_Inherently_Limited_Type (E : Entity_Id);
+ -- Emit a warning if a record type that does not have a limited keyword in
+ -- its definition has any components that are limited (which implicitly
+ -- make the type limited).
+
-----------------------
-- Access_Definition --
-----------------------
Derive_Progenitor_Subprograms (T, T);
end if;
+ Warn_On_Inherently_Limited_Type (T);
+
Check_Function_Writable_Actuals (N);
end Record_Type_Declaration;
Set_Is_Constrained (T);
end Signed_Integer_Type_Declaration;
+ -------------------------------------
+ -- Warn_On_Inherently_Limited_Type --
+ -------------------------------------
+
+ procedure Warn_On_Inherently_Limited_Type (E : Entity_Id) is
+ C : Entity_Id;
+ begin
+ if Warnsw.Warn_On_Inherently_Limited_Type
+ and then not Is_Limited_Record (E)
+ then
+ C := First_Component (Base_Type (E));
+ while Present (C) loop
+ if Is_Inherently_Limited_Type (Etype (C)) then
+ Error_Msg_Node_2 := E;
+ Error_Msg_NE
+ ("?_l?limited component & makes & limited", E, C);
+ Error_Msg_N
+ ("\\?_l?consider annotating the record type "
+ & "with a LIMITED keyword", E);
+ exit;
+ end if;
+
+ Next_Component (C);
+ end loop;
+ end if;
+ end Warn_On_Inherently_Limited_Type;
+
end Sem_Ch3;
'z' => X.Warn_On_Size_Alignment),
'_' =>
- ('b' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'k' | 'l' | 'm' |
+ ('b' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'k' | 'm' |
'n' | 'o' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' =>
No_Such_Warning,
'a' => X.Warn_On_Anonymous_Allocators,
'c' => X.Warn_On_Unknown_Compile_Time_Warning,
'j' => X.Warn_On_Non_Dispatching_Primitives,
+ 'l' => X.Warn_On_Inherently_Limited_Type,
'p' => X.Warn_On_Pedantic_Checks,
'q' => X.Warn_On_Ignored_Equality,
'r' => X.Warn_On_Component_Order,
Warn_On_Hiding,
Warn_On_Ignored_Equality,
Warn_On_Ineffective_Predicate_Test,
+ Warn_On_Inherently_Limited_Type,
Warn_On_Late_Primitives,
Warn_On_Modified_Unread,
Warn_On_No_Value_Assigned,
Warn_On_Hiding |
Warn_On_Ignored_Equality |
Warn_On_Ineffective_Predicate_Test |
+ Warn_On_Inherently_Limited_Type |
Warn_On_Late_Primitives |
Warn_On_Modified_Unread |
Warn_On_Non_Dispatching_Primitives |
-- values that do not belong to the parent subtype. Modified by use of
-- -gnatw_s/S.
+ Warn_On_Inherently_Limited_Type : Boolean renames F (X.Warn_On_Inherently_Limited_Type);
+ -- Set to True to generate warnings if a record type does not have a
+ -- limited keyword, but is inherently limited. Modified by use of
+ -- -gnatw_l/L.
+
Warn_On_Late_Primitives : Boolean renames F (X.Warn_On_Late_Primitives);
-- Warn when tagged type public primitives are defined after its private
-- extensions.