OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [style.ads] - Blame information for rev 707

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                                S T Y L E                                 --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
19
-- http://www.gnu.org/licenses for a complete copy of the license.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
--  This package collects all the routines used for style checking in the
27
--  compiler, as activated by the relevant command line option. These are
28
--  gathered in a separate package so that they can more easily be customized.
29
--  Calls to these subprograms are only made if Opt.Style_Check is set True.
30
 
31
with Errout;
32
with Styleg;
33
with Types;    use Types;
34
 
35
package Style is
36
 
37
   procedure Body_With_No_Spec (N : Node_Id);
38
   --  Called where N is a subprogram body node for a subprogram body
39
   --  for which no spec was given, i.e. a body acting as its own spec.
40
 
41
   procedure Check_Array_Attribute_Index
42
     (N  : Node_Id;
43
      E1 : Node_Id;
44
      D  : Int);
45
   --  Called for an array attribute specifying an index number. N is the
46
   --  node for the attribute, and E1 is the index expression (Empty if none
47
   --  present). If E1 is present, it is known to be a static integer. D is
48
   --  the number of dimensions of the array.
49
 
50
   procedure Check_Identifier
51
     (Ref : Node_Or_Entity_Id;
52
      Def : Node_Or_Entity_Id);
53
   --  Check style of identifier occurrence. Ref is an N_Identifier node whose
54
   --  spelling is to be checked against the Chars spelling in identifier node
55
   --  Def (which may be either an N_Identifier, or N_Defining_Identifier node)
56
 
57
   procedure Missing_Overriding (N : Node_Id; E : Entity_Id);
58
   --  Called where N is the declaration or body of an overriding operation,
59
   --  and the node does not have an overriding_indicator.
60
 
61
   procedure Subprogram_Not_In_Alpha_Order (Name : Node_Id);
62
   --  Called if Name is the name of a subprogram body in a package body
63
   --  that is not in alphabetical order.
64
 
65
   --  Remaining style routines come from instantiation of Styleg
66
 
67
   package Style_Inst is new Styleg
68
     (Errout.Error_Msg,
69
      Errout.Error_Msg_S,
70
      Errout.Error_Msg_SC,
71
      Errout.Error_Msg_SP);
72
   --  Instantiation of Styleg for compiler use
73
 
74
   procedure Check_Abs_Not
75
     renames Style_Inst.Check_Abs_Not;
76
   --  Called after scanning an ABS or NOT operator to check spacing
77
 
78
   procedure Check_Apostrophe
79
     renames Style_Inst.Check_Apostrophe;
80
   --  Called after scanning an apostrophe to check spacing
81
 
82
   procedure Check_Arrow
83
     renames Style_Inst.Check_Arrow;
84
   --  Called after scanning out an arrow to check spacing
85
 
86
   procedure Check_Attribute_Name (Reserved : Boolean)
87
     renames Style_Inst.Check_Attribute_Name;
88
   --  The current token is an attribute designator. Check that it is
89
   --  capitalized in an appropriate manner. Reserved is set if the attribute
90
   --  designator is a reserved word (access, digits, delta or range) to allow
91
   --  differing rules for the two cases.
92
 
93
   procedure Check_Boolean_Operator (Node : Node_Id)
94
     renames Style_Inst.Check_Boolean_Operator;
95
   --  Called after resolving AND or OR node to check short circuit rules
96
 
97
   procedure Check_Box
98
     renames Style_Inst.Check_Box;
99
   --  Called after scanning out a box to check spacing
100
 
101
   procedure Check_Binary_Operator
102
     renames Style_Inst.Check_Binary_Operator;
103
   --  Called after scanning out a binary operator other than a plus, minus
104
   --  or exponentiation operator. Intended for checking spacing rules.
105
 
106
   procedure Check_Exponentiation_Operator
107
     renames Style_Inst.Check_Exponentiation_Operator;
108
   --  Called after scanning out an exponentiation operator. Intended for
109
   --  checking spacing rules.
110
 
111
   procedure Check_Colon
112
     renames Style_Inst.Check_Colon;
113
   --  Called after scanning out colon to check spacing
114
 
115
   procedure Check_Colon_Equal
116
     renames Style_Inst.Check_Colon_Equal;
117
   --  Called after scanning out colon equal to check spacing
118
 
119
   procedure Check_Comma
120
     renames Style_Inst.Check_Comma;
121
   --  Called after scanning out comma to check spacing
122
 
123
   procedure Check_Comment
124
     renames Style_Inst.Check_Comment;
125
   --  Called with Scan_Ptr pointing to the first minus sign of a comment.
126
   --  Intended for checking any specific rules for comment placement/format.
127
 
128
   procedure Check_Dot_Dot
129
     renames Style_Inst.Check_Dot_Dot;
130
   --  Called after scanning out dot dot to check spacing
131
 
132
   procedure Check_EOF
133
     renames Style_Inst.Check_EOF;
134
   --  Called after scanning out end of file mark
135
 
136
   procedure Check_HT
137
     renames Style_Inst.Check_HT;
138
   --  Called with Scan_Ptr pointing to a horizontal tab character
139
 
140
   procedure Check_Indentation
141
     renames Style_Inst.Check_Indentation;
142
   --  Called at the start of a new statement or declaration, with Token_Ptr
143
   --  pointing to the first token of the statement or declaration. The check
144
   --  is that the starting column is appropriate to the indentation rules if
145
   --  Token_Ptr is the first token on the line.
146
 
147
   procedure Check_Left_Paren
148
     renames Style_Inst.Check_Left_Paren;
149
   --  Called after scanning out a left parenthesis to check spacing
150
 
151
   procedure Check_Line_Terminator (Len : Int)
152
     renames Style_Inst.Check_Line_Terminator;
153
   --  Called with Scan_Ptr pointing to the first line terminator terminating
154
   --  the current line, used to check for appropriate line terminator and to
155
   --  check the line length (Len is the length of the current line). Note that
156
   --  the terminator may be the EOF character.
157
 
158
   procedure Check_Pragma_Name
159
     renames Style_Inst.Check_Pragma_Name;
160
   --  The current token is a pragma identifier. Check that it is spelled
161
   --  properly (i.e. with an appropriate casing convention).
162
 
163
   procedure Check_Right_Paren
164
     renames Style_Inst.Check_Right_Paren;
165
   --  Called after scanning out a right parenthesis to check spacing
166
 
167
   procedure Check_Semicolon
168
     renames Style_Inst.Check_Semicolon;
169
   --  Called after scanning out a semicolon to check spacing
170
 
171
   procedure Check_Then (If_Loc : Source_Ptr)
172
     renames Style_Inst.Check_Then;
173
   --  Called to check that THEN and IF keywords are appropriately positioned.
174
   --  The parameters show the first characters of the two keywords. This
175
   --  procedure is called only if THEN appears at the start of a line with
176
   --  Token_Ptr pointing to the THEN keyword.
177
 
178
   procedure Check_Unary_Plus_Or_Minus
179
     renames Style_Inst.Check_Unary_Plus_Or_Minus;
180
   --  Called after scanning a unary plus or minus to check spacing
181
 
182
   procedure Check_Vertical_Bar
183
     renames Style_Inst.Check_Vertical_Bar;
184
   --  Called after scanning a vertical bar to check spacing
185
 
186
   procedure Check_Xtra_Parens (Loc : Source_Ptr)
187
     renames Style_Inst.Check_Xtra_Parens;
188
   --  Called after scanning a conditional expression that has at least one
189
   --  level of parentheses around the entire expression.
190
 
191
   function Mode_In_Check return Boolean
192
     renames Style_Inst.Mode_In_Check;
193
   --  Determines whether style checking is active and the Mode_In_Check is
194
   --  set, forbidding the explicit use of mode IN.
195
 
196
   procedure No_End_Name (Name : Node_Id)
197
     renames Style_Inst.No_End_Name;
198
   --  Called if an END is encountered where a name is allowed but not present.
199
   --  The parameter is the node whose name is the name that is permitted in
200
   --  the END line, and the scan pointer is positioned so that if an error
201
   --  message is to be generated in this situation, it should be generated
202
   --  using Error_Msg_SP.
203
 
204
   procedure No_Exit_Name (Name : Node_Id)
205
     renames Style_Inst.No_Exit_Name;
206
   --  Called when exiting a named loop, but a name is not present on the EXIT.
207
   --  The parameter is the node whose name should have followed EXIT, and the
208
   --  scan pointer is positioned so that if an error message is to be
209
   --  generated, it should be generated using Error_Msg_SP.
210
 
211
   procedure Non_Lower_Case_Keyword
212
     renames Style_Inst.Non_Lower_Case_Keyword;
213
   --  Called if a reserved keyword is scanned which is not spelled in all
214
   --  lower case letters. On entry Token_Ptr points to the keyword token.
215
   --  This is not used for keywords appearing as attribute designators,
216
   --  where instead Check_Attribute_Name (True) is called.
217
end Style;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.