GNAT warning management
Etienne Buira via Gcc-help <[email protected]> Fri, 17 Jul 2026 10:22:54 +0000
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <aloCfq_hEZOQ2DYN@Z926fQmE5jqhFMgp6> |
--gk69lsrOyXmVH32o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi folks,
I have an issue with gnat warnings.
A small buildable program is attached (gnat_warning.adb).
When built with -gnatyL, it spits some warnings "maximum nesting level
exceeded".
- Is that supposed to happen at all as the warnings are generated on
generic package instantiation?
- There are pragmas intented to remove those warnings, is it still
normal to have them? Is there a working way to hide them?
When built with -gnatw.y, it also spits "requires body" although it's
already a body. But I have no strong opinion on which is the strongest
between "this switch makes no sense when compiling an executable" and
"this makes no sense to issue such info-message when compiling an
executable". All i know is it would be nice if it were the second (to
share switches in a mostly-library project with some executables).
Another glitch i came across is building doesn't fail when building with
gprbuild (it does with gnatmake) and Compiler.Default_Switches("Ada")
contains "-gnatwe" and the -gnatyL4 raises warnings (I checked -gnatwe
is effectively in command line using -v switch).
Should I file a bug for this one?
Regards
--gk69lsrOyXmVH32o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=gnat_warning.adb
pragma Ada_2022;
with Ada.Containers.Indefinite_Vectors;
with Ada.Text_IO;
procedure gnat_warning is
pragma Warnings(Off, "maximum nesting level exceeded");
package StringListPkg is new Ada.Containers.Indefinite_Vectors(Index_Type => Positive,
Element_Type => String);
pragma Warnings(On, "maximum nesting level exceeded");
stringList : constant StringListPkg.Vector := [ "one", "two", "three" ];
begin
for index in stringList.First_Index..stringList.Last_Index loop
Ada.Text_IO.Put_Line(stringList.Element(index));
end loop;
end gnat_warning;
--gk69lsrOyXmVH32o--