Skip to content

Commit c47a3f8

Browse files
committed
Register Check.Switches attribute...
... and define `Check.Default_Switches` as alias of first, for better consistency with `Switches`/`Default_Switches` attributes handling in other tools.
1 parent f705c0b commit c47a3f8

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lkql_checker/src/gnatcheck-projects.adb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ package body Gnatcheck.Projects is
6767

6868
Default_Switches_Attr : constant GPR2.Q_Attribute_Id :=
6969
(GPR2."+"("Check"), GPR2."+"("Default_Switches"));
70+
Switches_Attr : constant GPR2.Q_Attribute_Id :=
71+
(GPR2."+"("Check"), GPR2."+"("Switches"));
7072
File_Patterns_Attr : constant GPR2.Q_Attribute_Id :=
7173
(GPR2."+"("CodePeer"), GPR2."+"("File_Patterns"));
7274

@@ -177,8 +179,8 @@ package body Gnatcheck.Projects is
177179
Command_Line : GNAT.OS_Lib.Argument_List_Access;
178180

179181
begin
180-
if Proj.Has_Attribute (Default_Switches_Attr, Ada_Idx) then
181-
Attr := Proj.Attribute (Default_Switches_Attr, Ada_Idx);
182+
if Proj.Has_Attribute (Switches_Attr, Ada_Idx) then
183+
Attr := Proj.Attribute (Switches_Attr, Ada_Idx);
182184

183185
if Attr.Kind = Single then
184186
Error
@@ -659,11 +661,19 @@ package body Gnatcheck.Projects is
659661
"that all the other options belong to the -rules section of " &
660662
"the parameters to 'gnatcheck'.");
661663
Add
662-
(Default_Switches_Attr,
664+
(Switches_Attr,
663665
Index_Type => Language_Index,
664666
Value => List,
665667
Value_Case_Sensitive => True,
666668
Is_Allowed_In => Everywhere);
669+
GPR2.Project.Registry.Attribute.Description.Set_Attribute_Description
670+
(Switches_Attr,
671+
"Index is a language name. Value is a " &
672+
"list of switches to be used when invoking 'gnatcheck' for a " &
673+
"source of the language, if there is no applicable attribute " &
674+
"Switches.");
675+
Add_Alias (Name => Default_Switches_Attr,
676+
Alias_Of => Switches_Attr);
667677
GPR2.Project.Registry.Attribute.Description.Set_Attribute_Description
668678
(Default_Switches_Attr,
669679
"Index is a language name. Value is a " &

0 commit comments

Comments
 (0)