Search code examples
adagnat-gps

How to allow Ada Big_Numbers in GPS Community 2021


With Ada 2022, Ada.Numerics.Big_Numbers can be enabled by setting -gnatwi somewhere according to the error I get in GPS Community Edition 2021.

warning: "Ada.Numerics.Big_Numbers" is an Ada 2022 unit [-gnatwi]

I assume the flag must be set for the compiler so I modified the Compiler package in my gpr-file like so:

  package Compiler is
      for Default_Switches ("Ada") use
        Compile_Checks_Switches &
        Build_Switches &
        Runtime_Checks_Switches &
        Style_Checks_Switches &
        Contracts_Switches &
        ("-gnatw.X", -- Disable warnings for No_Exception_Propagation
         "-gnatQ", -- Don't quit. Generate ALI and tree files even if illegalities
         "-gnatwi"); -- Big_Numbers
   end Compiler;

Note the -gnatwi flag at the end.

But GPS still complains wenn I try "Build->Check Semantic" on a file where with Ada.Numerics.Big_Numers is set. Restarting GPS also did not help.


Solution

  • options starting with -gnatw is just about warnings:

    -gnatwxx  Enable selected warning modes, xx = list of parameters:
        i*+  turn on warnings for implementation unit
    

    You probably want:

       -gnatX    Language extensions permitted
    

    Edit:

    As Simon Wright pointed out in the comments, -gnat2020 should work, and is a better option, even though it doesn't seem to be documented.