help / color / mirror / Atom feed
* Aggregate with (parens) considered obsolescent
@ 2022-04-11 16:15 Simon Wright
  0 siblings, 0 replies; only message in thread
From: Simon Wright @ 2022-04-11 16:15 UTC (permalink / raw)

GCC 12. with the -gnat2022 switch, supports (a large part of) ARM
2022. One of the changes is AI12-0212[1], the use of square brackets
[] in array aggregates.

I was surprised to find that the compiler reports the use of
parentheses () for array aggregates as obsolescent! To quote PR104751[2],


   procedure New_Syntax is
      T : array (1 .. 5) of Integer;
      T := (1, 2, 3, 4, 5);
   end New_Syntax;

with -gnat2022 -gnatwj gives

   new_syntax.adb:4:09: warning: array aggregate using () is an obsolescent
   syntax, use [] instead [-gnatwj]

but use of parens is not in Annex J; use of brackets is an option,
AARM 202x Draft 32, 4.3.3(49.m).

Having -gnatwj as part of -gnatwa makes this very intrusive.

The fact that it happens with -gnatwa, which is a switch that I
suspect quite a lot of us use, will be particularly annoying for those
who use -gnatwe (treat warnings as errors) and who want to support
multiple compiler releases (for example, the Ada Drivers Library).

The response dismissing the PR suggested using

   pragma Warnings (Off, "*array aggregate*");

and one glimmer of hope is that this can be used as a configuration

I could remove the problem from macOS releases that I support
(sem_aggr.adb:1803..1815), but of course that would lead users into
problems when using another GCC 12+ release.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-11 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 16:15 Aggregate with (parens) considered obsolescent Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox