cortex-gnat-rts icon indicating copy to clipboard operation
cortex-gnat-rts copied to clipboard

GCC 12 gives unexpected warning about obsolescent syntax

Open simonjwright opened this issue 3 years ago • 0 comments

... for instance, as

temeraire:test-stm32f4 simon$ gprbuild -P testbed -c -u -f iteration.adb
Compile
   [Ada]          iteration.adb
iteration.adb:52:07: warning: in instantiation at a-cobove.adb:263 [-gnatwj]
iteration.adb:52:07: warning: array aggregate using () is an obsolescent syntax, use [] instead [-gnatwj]

even though this warning is only supposed to be given if compiling with -gnat2022.

The reason is the the compiler (at opt.ads:194), if it's compiling an internal unit, sets Ada_Version to Ada_Version_Runtime, which is Ada_With_Extensions, which is greater than (or equal to) Ada_2022; and the generic a-cobove.adb (Ada.Containers.Bounded_Vectors) is indeed internal.

I see no prospect of this being changed, so the best solution for GCC 12 is to compile with -gnatwaJ, not just -gnatwa.

simonjwright avatar Apr 13 '22 17:04 simonjwright