Skip to content

Commit 46b701e

Browse files
committed
Merge branch 'topic/vadim/switches' into 'master'
Register `Check.Switches` attribute... See merge request eng/libadalang/langkit-query-language!292
2 parents f705c0b + b4f2385 commit 46b701e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
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 " &
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"packages":[{"attributes":[{"attribute_def":{"builtin":false,"config_concatenable":false,"empty_value":"ALLOW","has_default_in":{"abstract":false,"aggregate":false,"aggregate_library":false,"configuration":false,"library":false,"standard":false},"index_optional":false,"index_type":"LANGUAGE_INDEX","inherit_from_extended":"NOT_INHERITED","is_allowed_in":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true},"is_toolchain_config":false,"value":"LIST","value_case_sensitive":true,"value_is_set":false},"attribute_descr":"Index is a language name. Value is a list of switches to be used when invoking 'gnatcheck' for a source of the language, if there is no applicable attribute Switches.","attribute_name":"Default_Switches"}],"package_descr":"This package specifies the options used when calling the checking tool 'gnatcheck'. Its attribute Default_Switches has the same semantics as for the package Builder. The first string should always be -rules to specify that all the other options belong to the -rules section of the parameters to 'gnatcheck'.","package_name":"Check","projects_kind":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true}},{"attributes":[{"attribute_def":{"builtin":false,"config_concatenable":false,"empty_value":"ALLOW","has_default_in":{"abstract":false,"aggregate":false,"aggregate_library":false,"configuration":false,"library":false,"standard":false},"index_optional":false,"index_type":"NO_INDEX","inherit_from_extended":"NOT_INHERITED","is_allowed_in":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true},"is_toolchain_config":false,"value":"LIST","value_case_sensitive":true,"value_is_set":false},"attribute_descr":"If you want to override ada default file extensions (ada, ads, adb, spc & bdy), use this attribute which includes a list of file patterns where you can specify the following meta characters: * : matches any string of 0 or more characters, ? : matches any character, [list of chars] : matches any character listed, [char-char] : matches any character in given range, [^list of chars] : matches any character not listed. These patterns are case insensitive.","attribute_name":"File_Patterns"}],"package_descr":"This package specifies the options used when calling the tool 'codepeer'.","package_name":"Codepeer","projects_kind":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true}}]}
1+
{"packages":[{"attributes":[{"attribute_def":{"builtin":false,"config_concatenable":false,"empty_value":"ALLOW","has_default_in":{"abstract":false,"aggregate":false,"aggregate_library":false,"configuration":false,"library":false,"standard":false},"index_optional":false,"index_type":"LANGUAGE_INDEX","inherit_from_extended":"NOT_INHERITED","is_allowed_in":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true},"is_toolchain_config":false,"value":"LIST","value_case_sensitive":true,"value_is_set":false},"attribute_descr":"Index is a language name. Value is a list of switches to be used when invoking 'gnatcheck' for a source of the language, if there is no applicable attribute Switches.","attribute_name":"Default_Switches"},{"attribute_def":{"builtin":false,"config_concatenable":false,"empty_value":"ALLOW","has_default_in":{"abstract":false,"aggregate":false,"aggregate_library":false,"configuration":false,"library":false,"standard":false},"index_optional":false,"index_type":"LANGUAGE_INDEX","inherit_from_extended":"NOT_INHERITED","is_allowed_in":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true},"is_toolchain_config":false,"value":"LIST","value_case_sensitive":true,"value_is_set":false},"attribute_descr":"Index is a language name. Value is a list of switches to be used when invoking 'gnatcheck' for a source of the language, if there is no applicable attribute Switches.","attribute_name":"Switches"}],"package_descr":"This package specifies the options used when calling the checking tool 'gnatcheck'. Its attribute Default_Switches has the same semantics as for the package Builder. The first string should always be -rules to specify that all the other options belong to the -rules section of the parameters to 'gnatcheck'.","package_name":"Check","projects_kind":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true}},{"attributes":[{"attribute_def":{"builtin":false,"config_concatenable":false,"empty_value":"ALLOW","has_default_in":{"abstract":false,"aggregate":false,"aggregate_library":false,"configuration":false,"library":false,"standard":false},"index_optional":false,"index_type":"NO_INDEX","inherit_from_extended":"NOT_INHERITED","is_allowed_in":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true},"is_toolchain_config":false,"value":"LIST","value_case_sensitive":true,"value_is_set":false},"attribute_descr":"If you want to override ada default file extensions (ada, ads, adb, spc & bdy), use this attribute which includes a list of file patterns where you can specify the following meta characters: * : matches any string of 0 or more characters, ? : matches any character, [list of chars] : matches any character listed, [char-char] : matches any character in given range, [^list of chars] : matches any character not listed. These patterns are case insensitive.","attribute_name":"File_Patterns"}],"package_descr":"This package specifies the options used when calling the tool 'codepeer'.","package_name":"Codepeer","projects_kind":{"abstract":true,"aggregate":true,"aggregate_library":true,"configuration":true,"library":true,"standard":true}}]}

0 commit comments

Comments
 (0)