alire icon indicating copy to clipboard operation
alire copied to clipboard

violation of restriction "No_Implementation_Pragmas" in *_config.ads

Open onox opened this issue 3 years ago • 3 comments
trafficstars

The use of pragma Profile (No_Implementation_Extensions); or pragma Restrictions (No_Implementation_Pragmas); in gnat.adc causes compilation to fail in the config/*_config.ads file with the error:

*_config.ads:3:01: violation of restriction "No_Implementation_Pragmas".

I'm using for Local_Configuration_Pragmas use "gnat.adc"; in package Compiler in the .gpr file.

I have found 2 workarounds:

  1. Remove "config/" from Source_Dirs in the .gpr file and don't use the *_Config package in the code of a project.
  2. Use pragma Restriction_Warnings instead.

Neither may be desirable though.

onox avatar Jul 18 '22 21:07 onox

So this will be caused by the pragma Restrictions (No_Elaboration_Code); ? This was interesting for embedded I think, @Fabien-Chouteau will know better.

Bypassing the config system is always an option, but as you say it seems a bit extreme.

mosteo avatar Jul 21 '22 09:07 mosteo

Actually it seems to be caused by pragma Style_Checks, not by No_Elaboration_Code.

onox avatar Jul 22 '22 02:07 onox

The issue is that we won't be able to generate code that will be compatible with every coding style, that's why we disable the checks.

So I don't think there is a way to be compatible with Restrictions (No_Implementation_Pragmas).

Fabien-Chouteau avatar Jul 22 '22 08:07 Fabien-Chouteau