Skip to content

Commit 59b9cf9

Browse files
committed
Support of the --warnings switch
1 parent ebec118 commit 59b9cf9

File tree

6 files changed

+63
-5
lines changed

6 files changed

+63
-5
lines changed

source/gnatdoc/gnatdoc-command_line.adb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Documentation Generation Tool --
33
-- --
4-
-- Copyright (C) 2022, AdaCore --
4+
-- Copyright (C) 2022-2023, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -55,13 +55,19 @@ package body GNATdoc.Command_Line is
5555
Value_Name => "style",
5656
Description => "Use given style of documentation");
5757

58+
Warnings_Option : constant VSS.Command_Line.Binary_Option :=
59+
(Short_Name => <>,
60+
Long_Name => "warnings",
61+
Description => "Report warnings for undocumented entities");
62+
5863
Positional_Project_Option : constant VSS.Command_Line.Positional_Option :=
5964
(Name => "project_file",
6065
Description => "Project file to process");
6166

6267
Output_Dir_Argument : GNATCOLL.VFS.Virtual_File;
6368
Project_File_Argument : VSS.Strings.Virtual_String;
6469
Project_Context_Arguments : GPR2.Context.Object;
70+
Warnings_Argument : Boolean := False;
6571

6672
----------------
6773
-- Initialize --
@@ -77,6 +83,7 @@ package body GNATdoc.Command_Line is
7783
VSS.Command_Line.Add_Option (Output_Dir_Option);
7884
VSS.Command_Line.Add_Option (Project_Option);
7985
VSS.Command_Line.Add_Option (Style_Option);
86+
VSS.Command_Line.Add_Option (Warnings_Option);
8087
VSS.Command_Line.Add_Option (Scenario_Option);
8188
VSS.Command_Line.Add_Option (Positional_Project_Option);
8289

@@ -168,6 +175,12 @@ package body GNATdoc.Command_Line is
168175
(VSS.Command_Line.Value (Output_Dir_Option))),
169176
GNATCOLL.VFS.Get_Current_Dir.Full_Name);
170177
end if;
178+
179+
-- Process warnings command line switch.
180+
181+
if VSS.Command_Line.Is_Specified (Warnings_Option) then
182+
Warnings_Argument := True;
183+
end if;
171184
end Initialize;
172185

173186
----------------------
@@ -197,4 +210,13 @@ package body GNATdoc.Command_Line is
197210
return Project_File_Argument;
198211
end Project_File;
199212

213+
--------------
214+
-- Warnings --
215+
--------------
216+
217+
function Warnings return Boolean is
218+
begin
219+
return Warnings_Argument;
220+
end Warnings;
221+
200222
end GNATdoc.Command_Line;

source/gnatdoc/gnatdoc-command_line.ads

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Documentation Generation Tool --
33
-- --
4-
-- Copyright (C) 2022, AdaCore --
4+
-- Copyright (C) 2022-2023, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,4 +36,8 @@ package GNATdoc.Command_Line is
3636
function Project_Context return GPR2.Context.Object;
3737
-- Return prject context.
3838

39+
function Warnings return Boolean;
40+
-- Return True when report of the warnings is enabled by the command line
41+
-- switch.
42+
3943
end GNATdoc.Command_Line;

source/gnatdoc/gnatdoc-configuration-command_line.adb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Documentation Generation Tool --
33
-- --
4-
-- Copyright (C) 2022, AdaCore --
4+
-- Copyright (C) 2022-2023, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -44,4 +44,14 @@ package body GNATdoc.Configuration.Command_Line is
4444
end if;
4545
end Output_Directory;
4646

47+
----------------------
48+
-- Warnings_Enabled --
49+
----------------------
50+
51+
overriding function Warnings_Enabled
52+
(Self : Command_Line_Configuration_Provider) return Boolean is
53+
begin
54+
return GNATdoc.Command_Line.Warnings;
55+
end Warnings_Enabled;
56+
4757
end GNATdoc.Configuration.Command_Line;

source/gnatdoc/gnatdoc-configuration-command_line.ads

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ private
3333
return GNATCOLL.VFS.Virtual_File;
3434
-- Return output directory to generate documentation.
3535

36+
overriding function Warnings_Enabled
37+
(Self : Command_Line_Configuration_Provider) return Boolean;
38+
3639
end GNATdoc.Configuration.Command_Line;

source/gnatdoc/gnatdoc-configuration.adb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Documentation Generation Tool --
33
-- --
4-
-- Copyright (C) 2022, AdaCore --
4+
-- Copyright (C) 2022-2023, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -51,4 +51,19 @@ package body GNATdoc.Configuration is
5151
end if;
5252
end Output_Directory;
5353

54+
----------------------
55+
-- Warnings_Enabled --
56+
----------------------
57+
58+
not overriding function Warnings_Enabled
59+
(Self : Abstract_Configuration_Provider) return Boolean is
60+
begin
61+
if Self.Child /= null then
62+
return Self.Child.Warnings_Enabled;
63+
64+
else
65+
return False;
66+
end if;
67+
end Warnings_Enabled;
68+
5469
end GNATdoc.Configuration;

source/gnatdoc/gnatdoc-configuration.ads

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- GNAT Documentation Generation Tool --
33
-- --
4-
-- Copyright (C) 2022, AdaCore --
4+
-- Copyright (C) 2022-2023, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,6 +42,10 @@ package GNATdoc.Configuration is
4242
return GNATCOLL.VFS.Virtual_File;
4343
-- Return custom resources directory if specified.
4444

45+
not overriding function Warnings_Enabled
46+
(Self : Abstract_Configuration_Provider) return Boolean;
47+
-- Return True when warnings about undocumented entities are enabled.
48+
4549
Provider : Configuration_Provider_Access;
4650

4751
private

0 commit comments

Comments
 (0)