annotate gcc/ada/warnsw.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- W A R N S W --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1999-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This unit contains the routines used to handle setting of warning options
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 package Warnsw is
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 -------------------
kono
parents:
diff changeset
31 -- Warning Flags --
kono
parents:
diff changeset
32 -------------------
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- These flags are activated or deactivated by -gnatw switches and control
kono
parents:
diff changeset
35 -- whether warnings of a given class will be generated or not.
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 -- Note: most of these flags are still in opt, but the plan is to move them
kono
parents:
diff changeset
38 -- here as time goes by. And in fact a really nice idea would be to put
kono
parents:
diff changeset
39 -- them all in a Warn_Record so that they would be easy to save/restore.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 Warn_On_Late_Primitives : Boolean := False;
kono
parents:
diff changeset
42 -- Warn when tagged type public primitives are defined after its private
kono
parents:
diff changeset
43 -- extensions.
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 Warn_On_Overridden_Size : Boolean := False;
kono
parents:
diff changeset
46 -- Warn when explicit record component clause or array component_size
kono
parents:
diff changeset
47 -- clause specifies a size that overrides a size for the type which was
kono
parents:
diff changeset
48 -- set with an explicit size clause. Off by default, modified by use of
kono
parents:
diff changeset
49 -- -gnatw.s/.S (but not -gnatwa).
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 Warn_On_Questionable_Layout : Boolean := False;
kono
parents:
diff changeset
52 -- Warn when default layout of a record type is questionable for run-time
kono
parents:
diff changeset
53 -- efficiency reasons and would be improved by reordering the components.
kono
parents:
diff changeset
54 -- Off by default, modified by use of -gnatw.q/.Q (but not -gnatwa).
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 Warn_On_Record_Holes : Boolean := False;
kono
parents:
diff changeset
57 -- Warn when explicit record component clauses leave uncovered holes (gaps)
kono
parents:
diff changeset
58 -- in a record layout. Off by default, set by -gnatw.h (but not -gnatwa).
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 Warn_On_Size_Alignment : Boolean := True;
kono
parents:
diff changeset
61 -- Warn when explicit Size and Alignment clauses are given for a type, and
kono
parents:
diff changeset
62 -- the size is not a multiple of the alignment. Off by default, modified
kono
parents:
diff changeset
63 -- by use of -gnatw.z/.Z and set as part of -gnatwa.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 Warn_On_Standard_Redefinition : Boolean := False;
kono
parents:
diff changeset
66 -- Warn when a program defines an identifier that matches a name in
kono
parents:
diff changeset
67 -- Standard. Off by default, modified by use of -gnatw.k/.K (but not
kono
parents:
diff changeset
68 -- by -gnatwa).
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 -----------------------------------
kono
parents:
diff changeset
71 -- Saving and Restoring Warnings --
kono
parents:
diff changeset
72 -----------------------------------
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 -- Type used to save and restore warnings
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 type Warning_Record is record
kono
parents:
diff changeset
77 Address_Clause_Overlay_Warnings : Boolean;
kono
parents:
diff changeset
78 Check_Unreferenced : Boolean;
kono
parents:
diff changeset
79 Check_Unreferenced_Formals : Boolean;
kono
parents:
diff changeset
80 Check_Withs : Boolean;
kono
parents:
diff changeset
81 Constant_Condition_Warnings : Boolean;
kono
parents:
diff changeset
82 Elab_Info_Messages : Boolean;
kono
parents:
diff changeset
83 Elab_Warnings : Boolean;
kono
parents:
diff changeset
84 Implementation_Unit_Warnings : Boolean;
kono
parents:
diff changeset
85 Ineffective_Inline_Warnings : Boolean;
kono
parents:
diff changeset
86 List_Body_Required_Info : Boolean;
kono
parents:
diff changeset
87 List_Inherited_Aspects : Boolean;
kono
parents:
diff changeset
88 No_Warn_On_Non_Local_Exception : Boolean;
kono
parents:
diff changeset
89 Warning_Doc_Switch : Boolean;
kono
parents:
diff changeset
90 Warn_On_Ada_2005_Compatibility : Boolean;
kono
parents:
diff changeset
91 Warn_On_Ada_2012_Compatibility : Boolean;
kono
parents:
diff changeset
92 Warn_On_All_Unread_Out_Parameters : Boolean;
kono
parents:
diff changeset
93 Warn_On_Assertion_Failure : Boolean;
kono
parents:
diff changeset
94 Warn_On_Assumed_Low_Bound : Boolean;
kono
parents:
diff changeset
95 Warn_On_Atomic_Synchronization : Boolean;
kono
parents:
diff changeset
96 Warn_On_Bad_Fixed_Value : Boolean;
kono
parents:
diff changeset
97 Warn_On_Biased_Representation : Boolean;
kono
parents:
diff changeset
98 Warn_On_Constant : Boolean;
kono
parents:
diff changeset
99 Warn_On_Deleted_Code : Boolean;
kono
parents:
diff changeset
100 Warn_On_Dereference : Boolean;
kono
parents:
diff changeset
101 Warn_On_Export_Import : Boolean;
kono
parents:
diff changeset
102 Warn_On_Hiding : Boolean;
kono
parents:
diff changeset
103 Warn_On_Late_Primitives : Boolean;
kono
parents:
diff changeset
104 Warn_On_Modified_Unread : Boolean;
kono
parents:
diff changeset
105 Warn_On_No_Value_Assigned : Boolean;
kono
parents:
diff changeset
106 Warn_On_Non_Local_Exception : Boolean;
kono
parents:
diff changeset
107 Warn_On_Object_Renames_Function : Boolean;
kono
parents:
diff changeset
108 Warn_On_Obsolescent_Feature : Boolean;
kono
parents:
diff changeset
109 Warn_On_Overlap : Boolean;
kono
parents:
diff changeset
110 Warn_On_Overridden_Size : Boolean;
kono
parents:
diff changeset
111 Warn_On_Parameter_Order : Boolean;
kono
parents:
diff changeset
112 Warn_On_Questionable_Layout : Boolean;
kono
parents:
diff changeset
113 Warn_On_Questionable_Missing_Parens : Boolean;
kono
parents:
diff changeset
114 Warn_On_Record_Holes : Boolean;
kono
parents:
diff changeset
115 Warn_On_Redundant_Constructs : Boolean;
kono
parents:
diff changeset
116 Warn_On_Reverse_Bit_Order : Boolean;
kono
parents:
diff changeset
117 Warn_On_Size_Alignment : Boolean;
kono
parents:
diff changeset
118 Warn_On_Standard_Redefinition : Boolean;
kono
parents:
diff changeset
119 Warn_On_Suspicious_Contract : Boolean;
kono
parents:
diff changeset
120 Warn_On_Suspicious_Modulus_Value : Boolean;
kono
parents:
diff changeset
121 Warn_On_Unchecked_Conversion : Boolean;
kono
parents:
diff changeset
122 Warn_On_Unordered_Enumeration_Type : Boolean;
kono
parents:
diff changeset
123 Warn_On_Unrecognized_Pragma : Boolean;
kono
parents:
diff changeset
124 Warn_On_Unrepped_Components : Boolean;
kono
parents:
diff changeset
125 Warn_On_Warnings_Off : Boolean;
kono
parents:
diff changeset
126 end record;
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 function Save_Warnings return Warning_Record;
kono
parents:
diff changeset
129 -- Returns current settingh of warnings
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 procedure Restore_Warnings (W : Warning_Record);
kono
parents:
diff changeset
132 -- Restores current settings of warning flags from W
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 -----------------
kono
parents:
diff changeset
135 -- Subprograms --
kono
parents:
diff changeset
136 -----------------
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 function Set_Warning_Switch (C : Character) return Boolean;
kono
parents:
diff changeset
139 -- This function sets the warning switch or switches corresponding to the
kono
parents:
diff changeset
140 -- given character. It is used to process a -gnatw switch on the command
kono
parents:
diff changeset
141 -- line, or a character in a string literal in pragma Warnings. Returns
kono
parents:
diff changeset
142 -- True for valid warning character C, False for invalid character.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 function Set_Dot_Warning_Switch (C : Character) return Boolean;
kono
parents:
diff changeset
145 -- This function sets the warning switch or switches corresponding to the
kono
parents:
diff changeset
146 -- given character preceded by a dot. Used to process a -gnatw. switch on
kono
parents:
diff changeset
147 -- the command line or .C in a string literal in pragma Warnings. Returns
kono
parents:
diff changeset
148 -- True for valid warning character C, False for invalid character.
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 function Set_Underscore_Warning_Switch (C : Character) return Boolean;
kono
parents:
diff changeset
151 -- This function sets the warning switch or switches corresponding to the
kono
parents:
diff changeset
152 -- given character preceded by an underscore. Used to process a -gnatw_
kono
parents:
diff changeset
153 -- switch on the command line or _C in a string literal in pragma Warnings.
kono
parents:
diff changeset
154 -- Returns True for valid warnings character C, False for invalid
kono
parents:
diff changeset
155 -- character.
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 procedure Set_GNAT_Mode_Warnings;
kono
parents:
diff changeset
158 -- This is called in -gnatg mode to set the warnings for gnat mode. It is
kono
parents:
diff changeset
159 -- also used to set the proper warning statuses for -gnatw.g. Note that
kono
parents:
diff changeset
160 -- this set of warnings is neither a subset nor a superset of -gnatwa, it
kono
parents:
diff changeset
161 -- enables warnings that are not included in -gnatwa and disables warnings
kono
parents:
diff changeset
162 -- that are included in -gnatwa (such as Warn_On_Implementation_Units, that
kono
parents:
diff changeset
163 -- we clearly want to be False for units built with -gnatg).
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 end Warnsw;