https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123851

            Bug ID: 123851
           Summary: Pragma Extensions_Allowed (Off) does not take
                    precedence over -gnatX
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liam at liampwll dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

The GNAT Reference Manual claims that:

> the [Extensions_Allowed] pragma takes precedence over the -gnatX and -gnatX0 
> command switches.

This is however not what GCC actually does, instead the "Off" argument reverts
to that Ada version specified by Ada_Version_Explicit, which is set by a pragma
of a -gnatX/2022/etc. switch.

I would personally like if the current behaviour was kept as it allows the user
to enable experimental extensions for just a small block of code before
switching back to the previously set value which makes code maintenance a
little bit easier in some cases. However, the name Off is misleading and and
currently no one will be able to find out what it actually does without looking
through GCC code so this behaviour may warrant adding a new "Revert" argument
or similar if it is to be kept.

Reply via email to