• Aggregate with (parens) considered obsolescent

    From Simon Wright@21:1/5 to All on Mon Apr 11 17:15:08 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)