Skip to content

Commit 42904fa

Browse files
committed
Fix emission of the '-rules' depreciation message
Avoid multiple emission of this message and categories it as an information message, not an error.
1 parent 5033bf3 commit 42904fa

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

lkql_checker/src/gnatcheck-output.adb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,6 @@ package body Gnatcheck.Output is
123123
end if;
124124
end Error_No_Tool_Name;
125125

126-
------------------
127-
-- Error_In_Tty --
128-
------------------
129-
130-
procedure Error_In_Tty (Message : String) is
131-
begin
132-
if isatty (fileno (stderr)) /= 0 then
133-
Put_Line (Standard_Error, Executable & ": " & Message);
134-
end if;
135-
end Error_In_Tty;
136-
137126
-----------------------
138127
-- Get_Indent_String --
139128
-----------------------
@@ -314,6 +303,17 @@ package body Gnatcheck.Output is
314303
end if;
315304
end Info_No_EOL;
316305

306+
-----------------
307+
-- Info_In_Tty --
308+
-----------------
309+
310+
procedure Info_In_Tty (Message : String) is
311+
begin
312+
if isatty (fileno (stderr)) /= 0 then
313+
Put_Line (Standard_Error, Message);
314+
end if;
315+
end Info_In_Tty;
316+
317317
------------------------
318318
-- Print_Tool_Version --
319319
------------------------

lkql_checker/src/gnatcheck-output.ads

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ package Gnatcheck.Output is
4343
procedure Error_No_Tool_Name (Message : String);
4444
-- Sends into Stderr the error message with no tool name prefix
4545

46-
procedure Error_In_Tty (Message : String);
47-
-- Same as ``Error`` but send the message only if Stderr is a TTY. Also,
48-
-- ``Message`` is not added to the stderr log file.
49-
5046
procedure Warning (Message : String);
5147
-- Same as Error, but do nothing if Warning_Mode = Quiet.
5248

@@ -71,6 +67,10 @@ package Gnatcheck.Output is
7167
-- that is, the last line does not contain a (platform-specific) EOL
7268
-- character(s).
7369

70+
procedure Info_In_Tty (Message : String);
71+
-- Same as ``Info`` but send the message only if Stderr is a TTY. Also,
72+
-- ``Message`` is not added to the current ``Log_File``.
73+
7474
Indent_String : constant String := " ";
7575
-- Used as indentation element in various output
7676

lkql_checker/src/gnatcheck-projects.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,13 +1212,14 @@ package body Gnatcheck.Projects is
12121212
Individual_Rules_Set := True;
12131213
end case;
12141214
if not Rules_Depreciation_Emitted then
1215-
Error_In_Tty
1215+
Info_In_Tty
12161216
("The '-rules' section is now deprecated. You should only " &
12171217
"use the '--rule' and '--rule-file' command-line options.");
1218-
Error_In_Tty
1218+
Info_In_Tty
12191219
("You can use the '--emit-lkql-rule-file' flag to " &
12201220
"automatically translate your rule configuration to the " &
12211221
"new LKQL format.");
1222+
Rules_Depreciation_Emitted := True;
12221223
end if;
12231224
end loop;
12241225
end Process_Sections;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
gnatcheck: The '-rules' section is now deprecated. You should only use the '--rule' and '--rule-file' command-line options.
2-
gnatcheck: You can use the '--emit-lkql-rule-file' flag to automatically translate your rule configuration to the new LKQL format.
1+
The '-rules' section is now deprecated. You should only use the '--rule' and '--rule-file' command-line options.
2+
You can use the '--emit-lkql-rule-file' flag to automatically translate your rule configuration to the new LKQL format.
33
main.adb:3:04: goto statement

0 commit comments

Comments
 (0)