1------------------------------------------------------------------------------
2--                                                                          --
3--                          GNATCHECK COMPONENTS                            --
4--                                                                          --
5--                    G N A T C H E C K. O P T I O N S                      --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--                     Copyright (C) 2004-2014, AdaCore                     --
10--                                                                          --
11-- GNATCHECK  is  free  software;  you can redistribute it and/or modify it --
12-- under terms of the  GNU  General Public License as published by the Free --
13-- Software Foundation;  either version 3, or ( at your option)  any  later --
14-- version.  GNATCHECK  is  distributed in the hope that it will be useful, --
15-- but  WITHOUT  ANY  WARRANTY;   without  even  the  implied  warranty  of --
16-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
17-- Public License for more details.  You should have received a copy of the --
18-- GNU General Public License distributed with GNAT; see file  COPYING3. If --
19-- not,  go  to  http://www.gnu.org/licenses  for  a  complete  copy of the --
20-- license.                                                                 --
21--                                                                          --
22-- GNATCHECK is maintained by AdaCore (http://www.adacore.com).             --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  This package defines options that are supposed to be of a common interest
27--  for all the tools.
28
29with GNAT.OS_Lib;
30
31with ASIS_UL.Debug;
32
33with Gnatcheck.Projects;
34
35package Gnatcheck.Options is
36
37   type Rule_Statuses is
38     (Not_A_Rule_Status,
39      Under_Construction,
40      --  rule is not fully implemented, so it cannot be used
41      Non_Documented,
42      --  the rule is implemented, but it is not described in GNAT UGN, so it
43      --  should not be shown when gnatcheck prints out a list of implemented
44      --  rules
45      Fully_Implemented);
46   --  Describes the current rule implementation status.
47
48   pragma Ordered (Rule_Statuses);
49
50   Generate_Rules_Help : Boolean := False;
51   --  '-h'
52   --  Generate the rules help information (note, that we can do it only after
53   --  registering the rules)
54
55   Generate_Category_Help : Boolean := False;
56   --  ''-hcr'
57   --  Generate the rule categories help information (note, that we can do it
58   --  only after registering the rules). Depending on the flag Recursive_Help,
59   --  help information may or may not contain full details for each category.
60
61   Recursive_Help : Boolean := False;
62   --  '-hcr'
63
64   Generate_Coding_Standard : Boolean := False;
65   --  '--write-rules=file' or else '--dump-code-standard'
66
67   type Coding_Standard_Kinds is
68     (Not_A_Coding_Standard,
69      Template_All_ON,
70      Template_All_OFF,
71      GNAT,
72      HIE);
73   --  Possible kind of the coding standard file gnatcheck can generate
74
75   subtype Template_Coding_Standard_Kinds is Coding_Standard_Kinds
76     range Template_All_ON .. Template_All_OFF;
77
78   Coding_Standard_Kind : Coding_Standard_Kinds := Not_A_Coding_Standard;
79   --  '--dump-code-standard=<kind>'
80
81   Default_Coding_Standard_Kind : Coding_Standard_Kinds := Template_All_OFF;
82   --  Used in case if '--write-rules option is set, but '--dump-code-standard'
83   --  is not
84
85   Rule_Report_Status : Rule_Statuses := Fully_Implemented;
86   --  '-hcr1', '-hcr2'
87   --  When generating recursive category help, report rules with the status
88   --  equal to or greater than Rule_Report_Status
89
90   Generate_Global_Structure_Warnings : Boolean := False;
91   --  ???
92   --  Generate warning messages in case if a problem that prevents the
93   --  complete analysis of the program global structure is detected
94
95   Active_Rule_Present : Boolean := False;
96   --  Flag indicating if the tool has an activated rule to check. It does not
97   --  take into account compiler check, use
98   --  Gnatcheck.Compiler.Analyze_Compiler_Output to see if any of the compiler
99   --  check is active.
100
101   Analyse_Expanded_Code : Boolean := False;
102   --  If this flag is ON, gnatcheck analyses expanded spec and expanded body
103   --  for generic instantiations
104
105   Analyse_Source_Text : Boolean := False;
106   --  If this flag is ON, gnatcheck applies enabled rules from the text rules
107   --  hierarchy to the source code of the analyzed compilation unit.
108
109   --------------------------------------
110   -- Controlling the gnatcheck report --
111   --------------------------------------
112
113   Qualification_Report : Boolean := True;
114   --  '--old-report-format'  (turns it OFF)
115   --  If this flag is ON, the qualification report file is created instead of
116   --  regular one
117
118   Short_Report : Boolean := False;
119   --  '-s'
120   --  Print the short version of the report file. For new format of the report
121   --  file - only diagnoses are included in the report file. For old format -
122   --  no header, no lists of enabled and disabled rules, no list of checked
123   --  sources, no introductory paragraph for the sections
124
125   Max_Diagnoses : Natural := 500;
126   --  '-m'
127   --  Maximum number of diagnoses to print out into Stdout. Zero means that
128   --  there is no limitation on the number of diagnoses to be printed out into
129   --  Stderr.
130
131   Mapping_Mode : Boolean := False;
132   --  If this flag is ON, a rule name is added to the text of each diagnosis.
133
134   User_Info_File           : Standard.GNAT.OS_Lib.String_Access;
135   User_Info_File_Full_Path : Standard.GNAT.OS_Lib.String_Access;
136   --  --include-file=<filename>
137   --  Name of the user-provided text file to be added as the last (???)
138   --  section of the report file. If this option is not set, this section is
139   --  not created in the report file.
140
141   Individual_Rules_Set        : Boolean := False;
142   More_Then_One_Rule_File_Set : Boolean := False;
143   --  Flags used to detect if all the rules specified for a given gnatcheck
144   --  call, should be set when parsing rule options
145
146   Rule_File_Name : Standard.GNAT.OS_Lib.String_Access;
147   --  If More_Then_One_Rule_File_Set is OFF and if a rule file has been
148   --  processed, keeps the name of this file, otherwise is null.
149
150   ---------------------
151   -- Project support --
152   ---------------------
153
154   Gnatcheck_Prj : Gnatcheck.Projects.Gnatcheck_Project_Type;
155
156   -----------------------------------------------------------
157   --  Options related to the old format of the report file --
158   -----------------------------------------------------------
159
160   Print_Exemption_Section : Boolean := False;
161   --  '--exemption'
162   --  !!! We should get rid of it!!!
163   --  If this flag is OFF, the generated report file does not contain the
164   --  section for exempted rules diagnosis.
165
166   Output_Section_1 : Boolean := True;
167   Output_Section_2 : Boolean := True;
168   Output_Section_3 : Boolean := True;
169   --  '-sn, n = 1, 2 or 3
170   --  Print only specified sections, if at least one '-sn' option is set. Does
171   --  not silently impose '-s'.
172
173   Full_Source_Locations : Boolean := False;
174   --  '-l'
175   --  If this flag is set ON, gnatcheck adds full source locations in the
176   --  report file. In case of an entity declared in the expanded generic
177   --  code the full location indicates the location of a construct in the
178   --  template and then - the location of the corresponding instantiation of
179   --  the template (long location chains are used in case of nested
180   --  instantiations). Short location shows only the location of the
181   --  corresponding construct in the instantiation.
182
183   No_Column_Num_In_Diagnoses : Boolean := False;
184   --  '--no-column'
185   --  If this flag is ON, the column number is cut off from the diagnostic
186   --  messages. Is needed for qualification tests.
187
188   ------------------------------------
189   -- gnatcheck-specific debug flags --
190   ------------------------------------
191
192   Debug_Diagnoses_Storage : Boolean renames ASIS_UL.Debug.Debug_Flag_1;
193
194end Gnatcheck.Options;
195