control_flow_insn_p takes an insn
[official-gcc.git] / gcc / ada / errutil.ads
blobfa6ad53b19d5d5747ef627d46b8ab3ed013dc612
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E R R U T I L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2012, 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 ------------------------------------------------------------------------------
26 -- This package contains routines to output error messages and the
27 -- corresponding instantiation of Styleg, suitable to instantiate Scng.
29 -- It uses the same global variables as Errout, located in packages Atree and
30 -- Err_Vars. Like Errout, it also uses the common variables and routines
31 -- in package Erroutc.
33 -- This package is used by the preprocessor (gprep.adb) and the project
34 -- manager (prj-err.ads).
36 with Styleg;
37 with Types; use Types;
39 package Errutil is
41 ---------------------------------------------------------
42 -- Error Message Text and Message Insertion Characters --
43 ---------------------------------------------------------
45 -- Error message text strings are composed of lower case letters, digits
46 -- and the special characters space, comma, period, colon and semicolon,
47 -- apostrophe and parentheses. Special insertion characters can also
48 -- appear which cause the error message circuit to modify the given
49 -- string. For a full list of these, see the spec of errout.
51 -----------------------------------------------------
52 -- Format of Messages and Manual Quotation Control --
53 -----------------------------------------------------
55 -- Messages are generally all in lower case, except for inserted names
56 -- and appear in one of the following two forms:
58 -- error: text
59 -- warning: text
61 -- The prefixes error and warning are supplied automatically (depending
62 -- on the use of the ? insertion character), and the call to the error
63 -- message routine supplies the text. The "error: " prefix is omitted
64 -- in brief error message formats.
66 -- Reserved keywords in the message are in the default keyword case
67 -- (determined from the given source program), surrounded by quotation
68 -- marks. This is achieved by spelling the reserved word in upper case
69 -- letters, which is recognized as a request for insertion of quotation
70 -- marks by the error text processor. Thus for example:
72 -- Error_Msg_AP ("IS expected");
74 -- would result in the output of one of the following:
76 -- error: "is" expected
77 -- error: "IS" expected
78 -- error: "Is" expected
80 -- the choice between these being made by looking at the casing convention
81 -- used for keywords (actually the first compilation unit keyword) in the
82 -- source file.
84 -- In the case of names, the default mode for the error text processor
85 -- is to surround the name by quotation marks automatically. The case
86 -- used for the identifier names is taken from the source program where
87 -- possible, and otherwise is the default casing convention taken from
88 -- the source file usage.
90 -- In some cases, better control over the placement of quote marks is
91 -- required. This is achieved using manual quotation mode. In this mode,
92 -- one or more insertion sequences is surrounded by backquote characters.
93 -- The backquote characters are output as double quote marks, and normal
94 -- automatic insertion of quotes is suppressed between the double quotes.
95 -- For example:
97 -- Error_Msg_AP ("`END &;` expected");
99 -- generates a message like
101 -- error: "end Open_Scope;" expected
103 -- where the node specifying the name Open_Scope has been stored in
104 -- Error_Msg_Node_1 prior to the call. The great majority of error
105 -- messages operates in normal quotation mode.
107 -- Note: the normal automatic insertion of spaces before insertion
108 -- sequences (such as those that come from & and %) is suppressed in
109 -- manual quotation mode, so blanks, if needed as in the above example,
110 -- must be explicitly present.
112 ------------------------------
113 -- Error Output Subprograms --
114 ------------------------------
116 procedure Initialize;
117 -- Initializes for output of error messages. Must be called for each
118 -- file before using any of the other routines in the package.
120 procedure Finalize (Source_Type : String := "project");
121 -- Finalize processing of error messages for one file and output message
122 -- indicating the number of detected errors.
123 -- Source_Type is used in verbose mode to indicate the type of the source
124 -- being parsed (project file, definition file or input file for the
125 -- preprocessor).
127 procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
128 -- Output a message at specified location
130 procedure Error_Msg_S (Msg : String);
131 -- Output a message at current scan pointer location
133 procedure Error_Msg_SC (Msg : String);
134 -- Output a message at the start of the current token, unless we are at
135 -- the end of file, in which case we always output the message after the
136 -- last real token in the file.
138 procedure Error_Msg_SP (Msg : String);
139 -- Output a message at the start of the previous token
141 procedure Set_Ignore_Errors (To : Boolean);
142 -- Indicate, when To = True, that all reported errors should
143 -- be ignored. By default reported errors are not ignored.
145 package Style is new Styleg
146 (Error_Msg => Error_Msg,
147 Error_Msg_S => Error_Msg_S,
148 Error_Msg_SC => Error_Msg_SC,
149 Error_Msg_SP => Error_Msg_SP);
150 -- Instantiation of the generic style package, suitable for an
151 -- instantiation of Scng.
153 end Errutil;