Skip to content

Commit 9d9874c

Browse files
committed
Unify version information output
1 parent 547bdb8 commit 9d9874c

File tree

9 files changed

+19
-46
lines changed

9 files changed

+19
-46
lines changed

lkql_checker/src/gnatcheck-output.adb

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ with GNAT.Directory_Operations; use GNAT.Directory_Operations;
1313
with GNAT.OS_Lib; use GNAT.OS_Lib;
1414
with GNAT.Traceback.Symbolic;
1515

16-
with Gnatcheck.Options; use Gnatcheck.Options;
17-
with Gnatcheck.String_Utilities; use Gnatcheck.String_Utilities;
16+
with Gnatcheck.Options; use Gnatcheck.Options;
1817

1918
with Interfaces.C_Streams; use Interfaces.C_Streams;
2019

@@ -250,39 +249,15 @@ package body Gnatcheck.Output is
250249
Emit_Message (Message, New_Line => New_Line, Log_Message => Log_Message);
251250
end Print;
252251

253-
------------------------
254-
-- Print_Tool_Version --
255-
------------------------
256-
257-
procedure Print_Tool_Version (Released_At : Positive) is
258-
begin
259-
if Gnatkp_Mode then
260-
Put_Line ("GNATKP " & Date);
261-
else
262-
Put_Line ("GNATCHECK " & Version_String);
263-
end if;
264-
265-
Put_Line
266-
("Copyright (C) "
267-
& Image (Released_At)
268-
& '-'
269-
& Current_Year
270-
& ", AdaCore.");
271-
end Print_Tool_Version;
272-
273252
------------------------
274253
-- Print_Version_Info --
275254
------------------------
276255

277-
procedure Print_Version_Info (Released_At : Positive) is
256+
procedure Print_Version_Info is
278257
begin
279-
Print (Executable & " " & Version_String, Log_Message => False);
258+
Print (Executable & " " & Version_String);
280259
Print
281-
("Copyright "
282-
& Image (Released_At)
283-
& '-'
284-
& Current_Year
285-
& ", AdaCore.",
260+
("Copyright (C) " & "2004" & '-' & Current_Year & ", AdaCore.",
286261
Log_Message => False);
287262
end Print_Version_Info;
288263

lkql_checker/src/gnatcheck-output.ads

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ package Gnatcheck.Output is
1313
-- Whether a warning message has been emitted while "warnings as errors"
1414
-- mode is enabled. This ensure the return code of GNATcheck is not 0.
1515

16-
procedure Print_Version_Info (Released_At : Positive);
16+
procedure Print_Version_Info;
1717
-- Prints into Stderr the tool version information in the following format:
1818
--
19-
-- <toolname>
20-
-- Copyright <Released_At>-<current year>, AdaCore.
21-
--
22-
-- Released_At is supposed to be the year when the tool is first released.
23-
24-
procedure Print_Tool_Version (Released_At : Positive);
25-
-- Similar to Print_Version_Info, but sends the output into Stdout and
26-
-- the format of the information printed is similar to what is printed
27-
-- for '--version' option by all the other GNAT tools.
19+
-- (gnatcheck|gnatkp) <version> (<date>)
20+
-- Copyright (C) 2004-<current year>, AdaCore.
2821

2922
procedure Report_Unhandled_Exception (Ex : Exception_Occurrence);
3023
-- Reports an unhandled exception into Standard_Error

lkql_checker/src/gnatcheck-projects.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ package body Gnatcheck.Projects is
11361136
if Arg.Verbose.Get and then not Arg.Aggregated_Project then
11371137
-- When processing aggregated projects one by one, we want
11381138
-- Verbose_Mode to print this only in the outer invocation.
1139-
Print_Version_Info (2004);
1139+
Print_Version_Info;
11401140
end if;
11411141

11421142
-- We generate the rule help unconditionally

lkql_checker/src/gnatcheck_main.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ begin
396396
Scan_Arguments (First_Pass => True);
397397

398398
if Arg.Version.Get then
399-
Print_Tool_Version (2004);
399+
Print_Version_Info;
400400
OS_Exit (E_Success);
401401

402402
elsif Arg.Help.Get then

testsuite/drivers/gnatcheck_driver.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,12 @@ def output_refiners(self) -> list[OutputRefiner]:
697697
"gnatcheck <version> (<date>)",
698698
)
699699
)
700-
result.append(PatternSubstitute("Copyright [0-9-]+", "Copyright <date>"))
700+
result.append(
701+
PatternSubstitute(
702+
"Copyright \\(C\\) [0-9-]+",
703+
"Copyright (C) <date>"
704+
)
705+
)
701706

702707
# Remove project search path information
703708
result.append(PatternSubstitute(

testsuite/tests/gnatcheck/lkql_rules_merging/merge_sets/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rules1.lkql:7:20: info: register new instance sc1
1111
rules1.lkql:8:20: info: register new instance sc2
1212
rules2.lkql:6:13: warning: instance rule2b runs the same check than instance rule2 declared at rules1.lkql:6:5
1313
gnatcheck <version> (<date>)
14-
Copyright <date>, AdaCore.
14+
Copyright (C) <date>, AdaCore.
1515
test.adb:1:01: rule violation: rule2 [rule2]
1616
test.adb:1:01: rule violation: rule2 [rule2b|rule2]
1717
test.adb:1:11: rule violation: rule1 [name1d|rule1]

testsuite/tests/gnatcheck/lkql_rules_merging/merge_sets_error_1/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rules2.lkql:5:14: error: instance name1b has a different configuration than the
55
rules1.lkql:4:5: info: register new instance rule2
66
rules2.lkql:6:5: warning: ignore duplicate instance rule2, previous declaration at rules1.lkql:4:5
77
gnatcheck <version> (<date>)
8-
Copyright <date>, AdaCore.
8+
Copyright (C) <date>, AdaCore.
99
gnatcheck: error: no rule to check specified
1010
try "gnatcheck --help" for more information.
1111
>>>program returned status code 2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rules3.lkql:1:13: info: register new instance style_checks
22
rules3.lkql:1:13: error: cannot add instance style_checks twice using the shortcut argument format. Previous instance has been declared in the same set
33
gnatcheck <version> (<date>)
4-
Copyright <date>, AdaCore.
4+
Copyright (C) <date>, AdaCore.
55
gnatcheck: error: no rule to check specified
66
try "gnatcheck --help" for more information.
77
>>>program returned status code 2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
rules1.lkql:2:20: info: register new instance style_checks
22
rules2.lkql:3:13: error: cannot add instance style_checks twice using the shortcut argument format. Previous instance has been declared in: rules1.lkql:2:20
33
gnatcheck <version> (<date>)
4-
Copyright <date>, AdaCore.
4+
Copyright (C) <date>, AdaCore.
55
gnatcheck: error: no rule to check specified
66
try "gnatcheck --help" for more information.
77
>>>program returned status code 2

0 commit comments

Comments
 (0)