Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – //branches/tendra4/doc/tcpplus/error.html – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
<!-- Crown Copyright (c) 1998 -->
2
<HTML>
3
<HEAD>
4
<TITLE>
5
C++ Producer Guide: Error catalogue 
6
</TITLE>
7
</HEAD>
8
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#400080" ALINK="#FF0000">
9
 
10
<H1>C++ Producer Guide</H1>
11
<H3>March 1998</H3>
12
<A HREF="parse.html"><IMG SRC="../images/next.gif" ALT="next section"></A>
13
<A HREF="alg.html"><IMG SRC="../images/prev.gif" ALT="previous section"></A>
14
<A HREF="index.html"><IMG SRC="../images/top.gif" ALT="current document"></A>
15
<A HREF="../index.html"><IMG SRC="../images/home.gif" ALT="TenDRA home page">
16
</A>
17
<IMG SRC="../images/no_index.gif" ALT="document index"><P>
18
<HR>
19
 
20
<H2>3.3. Error catalogue</H2>
21
<P>
22
This section describes the error catalogue which lies at the heart
23
of the C++ producer's error reporting routines.  The full 
24
<A HREF="error1.html">error catalogue syntax</A> is given as an annex.
25
A typical entry in the catalogue is as follows: 
26
<PRE>
27
	class_union_deriv ( CLASS_TYPE: ct )
28
	{
29
	    USAGE:              serious
30
	    PROPERTIES:         ansi
31
	    KEY (ISO)           &quot;9.5&quot;
32
	    KEY (STANDARD)      &quot;The union '&quot;ct&quot;' can't have base classes&quot;
33
	}
34
</PRE>
35
This defines an error, <CODE>class_union_deriv</CODE>, which takes
36
a single parameter <CODE>ct</CODE> of type <CODE>CLASS_TYPE</CODE>.
37
The severity of this error is <CODE>serious</CODE>; that is to say,
38
a constraint error.  The error property <CODE>ansi</CODE> indicates
39
that the error arises from the ISO C++ standard, the associated 
40
<CODE>ISO</CODE> key indicating section 9.5.  Finally the text to
41
be printed for this error, including a reference to <CODE>ct</CODE>,
42
is given.  Looking up section 9.5 in the ISO C++ standard reveals
43
the corresponding constraint in paragraph 1: 
44
<BLOCKQUOTE>
45
<I>A union shall not have base classes.</I>
46
</BLOCKQUOTE>
47
Each constraint within the ISO C++ standard has a corresponding error
48
in this way.  The errors are named in a systematic fashion using the
49
section names used in the draft standard.  For example, section 9.5
50
is called <CODE>class.union</CODE>, so all the constraint errors arising
51
from this section have names of the form <CODE>class_union_*</CODE>.
52
These error names can be used in the <A HREF="pragma.html#low">low
53
level directives</A> such as: 
54
<PRE>
55
	#pragma TenDRA++ error &quot;class_union_deriv&quot; <I>allow</I>
56
</PRE>
57
to modify the error severity.  The effect of reducing the severity
58
of a constraint error in this way is undefined. 
59
</P>
60
<P>
61
In addition to the obvious error severity levels, <CODE>serious</CODE>,
62
<CODE>warning</CODE> and <CODE>none</CODE>, the error catalogue specifies
63
a list of optional severity levels along with their default values.
64
For example, the entry: 
65
<PRE>
66
	link_incompat = serious
67
</PRE>
68
sets up an option named <CODE>link_incompat</CODE> which is a constraint
69
error by default.  Errors with this severity, such as: 
70
<PRE>
71
	dcl_stc_external ( LONG_ID: id, PTR_LOC: loc )
72
	{
73
	    USAGE:              link_incompat
74
	    PROPERTIES:         ansi
75
	    KEY (ISO)           &quot;7.1.1&quot;
76
	    KEY (STANDARD)      &quot;'&quot;id&quot;' previously declared with external
77
				 linkage (at &quot;loc&quot;)&quot;
78
	}
79
</PRE>
80
are therefore constraint errors.  The severity associated with 
81
<CODE>link_incompat</CODE> can be modified either 
82
<A HREF="pragma.html#low">directly</A>, using the directive: 
83
<PRE>
84
	#pragma TenDRA++ option &quot;link_incompat&quot; <I>allow</I>
85
</PRE>
86
or <A HREF="pragma.html#linkage">indirectly</A> using the directive:
87
<PRE>
88
	#pragma TenDRA incompatible linkage <I>allow</I>
89
</PRE>
90
the effect being to modify the severity of the associated error messages.
91
</P>
92
<P>
93
The error catalogue is processed by a simple tool, 
94
<CODE>make_err</CODE>, which generates C code which is compiled into
95
the C++ producer.  Each error in the catalogue is assigned a number
96
(there are currently 873 errors in the catalogue) which gives an index
97
into an automatically generated table of error information.  It is
98
this error number, together with a list of error arguments, which
99
forms the associated <A HREF="alg.html#err"><CODE>ERROR</CODE> object</A>.
100
<CODE>make_err</CODE> generates a macro for each error in the catalogue
101
which takes arguments of the appropriate types (which may be statically
102
checked) and creates an <CODE>ERROR</CODE> object.  For example, for
103
the entry above this macro takes the form: 
104
<PRE>
105
	ERROR ERR_class_union_deriv ( CLASS_TYPE ) ;
106
</PRE>
107
These macros hide the error catalogue numbers from the rest of the
108
C++ producer. 
109
</P>
110
<P>
111
It is also possible to join a number of simple <CODE>ERROR</CODE>
112
objects to form a single composite <CODE>ERROR</CODE>.  The severity
113
of the composite error is the maximum of the severities of the component
114
errors.  To this purpose a dummy error severity level <CODE>whatever</CODE>
115
is introduced which is less severe than any other level.  This is
116
intended for use with error messages which are only ever used to add
117
information to existing errors, and which inherit their severity level
118
from the main error. 
119
</P>
120
<P>
121
The text of a simple error message can be found in the table of error
122
information.  The text contains certain escape sequences indicating
123
where the error arguments are to be printed.  For example, 
124
<CODE>%1</CODE> indicates the second argument.  The error argument
125
sorts - what is referred to as the error signature - is also stored
126
in the table of error information as an array of characters, each
127
corresponding to an <CODE>ERR_KEY_</CODE><I>type</I> macro.  The producer
128
defines printing routines for each of the types given by these values,
129
and calls the appropriate routine to print the argument. 
130
</P>
131
<P>
132
There are several command-line options which can be used to modify
133
the form in which the error message is printed.  The default format
134
is as follows: 
135
<PRE>
136
	&quot;file.C&quot;, line 42: Error:
137
	    [ISO 9.5]: The union 'U' can't have base classes.
138
</PRE>
139
The ISO section number can be suppressed using <CODE>-m-s</CODE>.
140
The <CODE>-mc</CODE> option causes the source code line giving rise
141
to the error to be printed as part of the message, with <CODE>!!!!</CODE>
142
marking the position of the error within the line.  The <CODE>-me</CODE>
143
option causes the error name, <CODE>class_union_deriv</CODE>, to be
144
printed as part of the message.  The <CODE>-ml</CODE> option causes
145
the full file location, including the list of <CODE>#include</CODE>
146
directives used in reaching the file, to be printed.  The <CODE>-mt</CODE>
147
option causes <CODE>typedef</CODE> names to be used when printing
148
types, rather than expanding to the type definition. 
149
</P>
150
 
151
<HR>
152
<P><I>Part of the <A HREF="../index.html">TenDRA Web</A>.<BR>Crown
153
Copyright &copy; 1998.</I></P>
154
</BODY>
155
</HTML>