comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Aggregate with (parens) considered obsolescent
Date: Mon, 11 Apr 2022 17:15:08 +0100	[thread overview]
Message-ID: <ly1qy338c3.fsf@pushface.org> (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],

=============
Compiling

   procedure New_Syntax is
      T : array (1 .. 5) of Integer;
   begin
      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
pragma.

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.

[1] http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0212-1.txt?rev=1.29&raw=N
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104751

                 reply	other threads:[~2022-04-11 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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