From dce0d46490cc3f929a5636902f47e2410719e33c Mon Sep 17 00:00:00 2001 From: Viljar Indus Date: Thu, 1 Aug 2024 15:59:00 +0300 Subject: ada: Emit a warning on inheritly limited types Record types that do not have a limited keyword but have a member with a limited type are also considered to be limited types. This can be confusing to understand for newer Ada users. It is better to emit a warning in this scenario and suggest that the type should be marked with a limited keyword. This diagnostic will be acticated when the -gnatw_l switch is used. gcc/ada/ * sem_ch3.adb: Add method Check_Inherited_Limted_Record for emitting the warning for an inherited limited type. * warnsw.adb: Add processing for the -gnatw_l switch that triggeres the inheritly limited type warning. * warnsw.ads: same as above. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add entry for -gnatw_l switch. * gnat_ugn.texi: Regenerate. --- .../gnat_ugn/building_executable_programs_with_gnat.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/ada/doc/gnat_ugn') diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst index ce3ed0c..07ca2ea 100644 --- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst +++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst @@ -3430,6 +3430,23 @@ of the pragma in the :title:`GNAT_Reference_manual`). 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` -- cgit v1.1