Skip to content

Commit 73fee0e

Browse files
committed
Merge branch 'topic/instance_error' into 'master'
Add a help message when instantiating the same name multiple times Closes #314 See merge request eng/libadalang/langkit-query-language!277
2 parents fc26bf6 + e3cc4ee commit 73fee0e

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

lkql_checker/src/gnatcheck-options.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ package Gnatcheck.Options is
189189
-- This variable should contain a full list of compilation options to be
190190
-- passed to gcc.
191191

192+
Instance_Help_Emitted : Boolean := False;
193+
-- Whether the help message about the new instance system has already been
194+
-- emitted. This message should be removed in 26.0.
195+
192196
--------------------------------------
193197
-- Controlling the gnatcheck report --
194198
--------------------------------------

lkql_checker/src/gnatcheck-rules-rule_table.adb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,13 @@ package body Gnatcheck.Rules.Rule_Table is
10511051
(if Instance.Defined_At /= ""
10521052
then To_String (Instance.Defined_At)
10531053
else "command line") & Diag_Defined_At);
1054+
if not Instance_Help_Emitted then
1055+
Warning
1056+
("if you want to pass multiple parameters to a rule you " &
1057+
"should use the comma separated notation: e.g. " &
1058+
"+RMy_Rule:Param1,Param2");
1059+
Instance_Help_Emitted := True;
1060+
end if;
10541061
Bad_Rule_Detected := True;
10551062
return;
10561063
elsif not Enable and then Instance = null then
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
gnatcheck: rule instance with the same name already exists: "goto_statements" previously instantiated at command line
2+
gnatcheck: if you want to pass multiple parameters to a rule you should use the comma separated notation: e.g. +RMy_Rule:Param1,Param2
23
main.adb:3:04: goto statement [goto_statements]
34
>>>program returned status code 5
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
gnatcheck: rule instance with the same name already exists: "same_alias" previously instantiated at command line
2+
gnatcheck: if you want to pass multiple parameters to a rule you should use the comma separated notation: e.g. +RMy_Rule:Param1,Param2
23
gnatcheck: rule instance with the same name already exists: "comp_check" previously instantiated at command line
34
gnatcheck: rule instance with the same name already exists: "comp_check" previously instantiated at command line
45
>>>program returned status code 5

0 commit comments

Comments
 (0)