alire
alire copied to clipboard
violation of restriction "No_Implementation_Pragmas" in *_config.ads
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:
- Remove "config/" from
Source_Dirsin the .gpr file and don't use the *_Config package in the code of a project. - Use
pragma Restriction_Warningsinstead.
Neither may be desirable though.
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.
Actually it seems to be caused by pragma Style_Checks, not by No_Elaboration_Code.
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).