2 |
7u83 |
1 |
<!-- Crown Copyright (c) 1998 -->
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<TITLE>C Checker Reference Manual</TITLE>
|
|
|
5 |
</HEAD>
|
|
|
6 |
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#400080" ALINK="#FF0000">
|
|
|
7 |
<H1>C Checker Reference Manual</H1>
|
|
|
8 |
<H3>January 1998</H3>
|
|
|
9 |
<A HREF="tdfc5.html"><IMG SRC="../images/next.gif" ALT="next section"></A>
|
|
|
10 |
<IMG SRC="../images/no_prev.gif" ALT="previous section">
|
|
|
11 |
<IMG SRC="../images/no_top.gif" ALT="current document">
|
|
|
12 |
<A HREF="../index.html"><IMG SRC="../images/home.gif" ALT="TenDRA home page">
|
|
|
13 |
</A>
|
|
|
14 |
<IMG SRC="../images/no_index.gif" ALT="document index"><P>
|
|
|
15 |
<HR>
|
|
|
16 |
<DL>
|
|
|
17 |
<DT><A HREF="#intro"><B>1 </B> - Introduction</A><DD>
|
|
|
18 |
<DL>
|
|
|
19 |
<DT><A HREF="#S4"><B>1.1 </B> - Background</A><DD>
|
|
|
20 |
<DT><A HREF="#S5"><B>1.2 </B> - The C static checker</A><DD>
|
|
|
21 |
<DT><A HREF="#S6"><B>1.3 </B> - About this document</A><DD>
|
|
|
22 |
</DL>
|
|
|
23 |
<DT><A HREF="tdfc5.html#S7"><B>2 </B> - Configuring the Checker</A><DD>
|
|
|
24 |
<DT><A HREF="tdfc6.html#S15"><B>3 </B> - Type Checking</A><DD>
|
|
|
25 |
<DT><A HREF="tdfc7.html#S31"><B>4 </B> - Integral Types</A><DD>
|
|
|
26 |
<DT><A HREF="tdfc8.html#S42"><B>5 </B> - Data Flow and Variable Analysis</A><DD>
|
|
|
27 |
<DT><A HREF="tdfc9.html#S70"><B>6 </B> - Preprocessing checks</A><DD>
|
|
|
28 |
<DT><A HREF="tdfc10.html#S81"><B>7 </B> - Dialect Features</A><DD>
|
|
|
29 |
<DT><A HREF="tdfc11.html#S108"><B>8 </B> - Common Errors</A><DD>
|
|
|
30 |
<DT><A HREF="tdfc12.html#S114"><B>9 </B> - Symbol Table Dump</A><DD>
|
|
|
31 |
<DT><A HREF="tdfc13.html#S120"><B>10 </B> - Conditional Compilation</A>
|
|
|
32 |
<DT><A HREF="tdfc14.html#S122"><B>11 </B> - References</A><DD>
|
|
|
33 |
<DT><A HREF="tdfc15.html#S123">Annexes</A><DD>
|
|
|
34 |
<DL>
|
|
|
35 |
<DT><A HREF="tdfc15.html#S123"><B>A </B> - Compilation Modes</A><DD>
|
|
|
36 |
<DT><A HREF="tdfc16.html#S126"><B>B </B> - Command Line Options for
|
|
|
37 |
Portability Checking</A><DD>
|
|
|
38 |
<DT><A HREF="tdfc17.html#S127"><B>C </B> - Integral Type Specification</A><DD>
|
|
|
39 |
<DT><A HREF="tdfc18.html#S130"><B>D </B> - Summary of the pragma statements</A>
|
|
|
40 |
<DD>
|
|
|
41 |
<DT><A HREF="tdfc19.html#S131"><B>E </B> - Dump format specification</A><DD>
|
|
|
42 |
<DT><A HREF="tdfc20.html#S144"><B>F </B> - The Token Syntax</A><DD>
|
|
|
43 |
<DT><A HREF="tdfc21.html#S164"><B>G </B> - API checking</A><DD>
|
|
|
44 |
<DT><A HREF="tdfc22.html#S173"><B>H </B> - Specifying conversions
|
|
|
45 |
using the token syntax</A><DD>
|
|
|
46 |
</DL>
|
|
|
47 |
</DL>
|
|
|
48 |
|
|
|
49 |
<HR>
|
|
|
50 |
<H1><A NAME="intro">1 Introduction</A></H1>
|
|
|
51 |
<A NAME=S4>
|
|
|
52 |
<HR><H2>1.1 Background</H2>
|
|
|
53 |
The C program static checker was originally developed as a programming
|
|
|
54 |
tool to aid the construction of portable programs using the Application
|
|
|
55 |
Programming Interface (API) model of software portability; the principle
|
|
|
56 |
underlying this approach being:
|
|
|
57 |
<BLOCKQUOTE>
|
|
|
58 |
<EM>If a program is written to conform to an abstract API specification,
|
|
|
59 |
then that program will be portable to any machine which implements
|
|
|
60 |
the API specification correctly.</EM>
|
|
|
61 |
</BLOCKQUOTE>
|
|
|
62 |
The tool was designed to address the problem of the lack of separation
|
|
|
63 |
between an API specification and an API implementation and as such
|
|
|
64 |
was considered as a compiler for an abstract machine.<P>
|
|
|
65 |
This approach gave the tool an unusually powerful basis for static
|
|
|
66 |
checking of C programs and a large amount of development work has
|
|
|
67 |
resulted in the production of the TenDRA C static checker (tchk).
|
|
|
68 |
The terms, TenDRA C checker and tchk are used interchangably in this
|
|
|
69 |
document.<P>
|
|
|
70 |
<A NAME=S5>
|
|
|
71 |
<HR><H2>1.2 The C static checker</H2>
|
|
|
72 |
The C static checker is a powerful and flexible tool which can perform
|
|
|
73 |
a number of static checks on C programs, including:<P>
|
|
|
74 |
<UL>
|
|
|
75 |
<LI>strict interface checking. In particular, the checker can analyse
|
|
|
76 |
programs against abstract APIs to check their conformance to the specification.
|
|
|
77 |
Abstract versions of most standard APIs are provided with the tool;
|
|
|
78 |
alternatively users can define their own abstract APIs using the syntax
|
|
|
79 |
described in Annex G;<P>
|
|
|
80 |
<LI>checking of integer sizes, overflows and implicit integer conversions
|
|
|
81 |
including potential 64-bit problems, against a 16 bit or 32 bit architecture
|
|
|
82 |
profile;<P>
|
|
|
83 |
<LI>strict ISO C standard checking, plus configurable support for
|
|
|
84 |
many non-ISO dialect features;<P>
|
|
|
85 |
<LI>extensive type checking, including prototype-style checking for
|
|
|
86 |
traditionally defined functions, conversion checking, type checking
|
|
|
87 |
on printf and scanf style argument strings and type checking between
|
|
|
88 |
translation units;<P>
|
|
|
89 |
<LI>variable analysis, including detection of unused variables, use
|
|
|
90 |
of uninitialised variables, dependencies on order of evaluation in
|
|
|
91 |
expressions and detection of unused function returns, computed values
|
|
|
92 |
and static variables;<P>
|
|
|
93 |
<LI>detection of unused header files;<P>
|
|
|
94 |
<LI>configurable tests for detecting many other common programming
|
|
|
95 |
errors;<P>
|
|
|
96 |
<LI>complete standard API usage analysis;<P>
|
|
|
97 |
<LI>several built-in checking environments plus support for user-defined
|
|
|
98 |
checking profiles.<P>
|
|
|
99 |
</UL>
|
|
|
100 |
<A NAME=S6>
|
|
|
101 |
<HR><H2>1.3 About this document</H2>
|
|
|
102 |
This document is designed as a reference manual detailing the features
|
|
|
103 |
of the C static checker. It contains eleven chapters (including this
|
|
|
104 |
introduction) and nine annexes.<P>
|
|
|
105 |
<UL>
|
|
|
106 |
<LI>Chapter 2: Configuring the Checker describes the built-in checking
|
|
|
107 |
modes and the design of customised environments;<P>
|
|
|
108 |
<LI>Chapters 3-8: Type Checking, Integral Types, Data Flow and Variable
|
|
|
109 |
Analysis , Preprocessing Checks, ISO C and Other Dialects and Common
|
|
|
110 |
Errors respectively;<P>
|
|
|
111 |
<LI>Chapter 9: The Symbol Table Dump deals with the detection of unused
|
|
|
112 |
header files, type checking across translation units and complete
|
|
|
113 |
standard API usage analysis;<P>
|
|
|
114 |
<LI>Chapter 10: Conditional Compilation describes the checker's approach
|
|
|
115 |
to conditional compilation;<P>
|
|
|
116 |
<LI>Chapter 11: References lists the references used in the production
|
|
|
117 |
of this document;<P>
|
|
|
118 |
<LI>Annex A: Checking Modes gives a description of the built-in environments;<P>
|
|
|
119 |
<LI>Annex B: Command Line Options lists the command line checking
|
|
|
120 |
options;<P>
|
|
|
121 |
<LI>Annex C: Specifying Integral Types describes the built-in integer
|
|
|
122 |
modes and the methods for customising them;<P>
|
|
|
123 |
<LI>Annex D: Pragma Syntax Specification;<P>
|
|
|
124 |
<LI>Annex E: Symbol Table Dump Specification;<P>
|
|
|
125 |
<LI>Annex F: Token Syntax describes the methods and syntax used to
|
|
|
126 |
produce abstract APIs;<P>
|
|
|
127 |
<LI>Annex G: Abstract API Manipulation gives details of the ways in
|
|
|
128 |
which TenDRA abstract APIs may be extended, combined or overriden
|
|
|
129 |
by local declarations;<P>
|
|
|
130 |
<LI>Annex H: Specifying Conversions with Tokens.
|
|
|
131 |
</UL>
|
|
|
132 |
<P>
|
|
|
133 |
<HR>
|
|
|
134 |
<P><I>Part of the <A HREF="../index.html">TenDRA Web</A>.<BR>Crown
|
|
|
135 |
Copyright © 1998.</I></P>
|
|
|
136 |
</BODY>
|
|
|
137 |
</HTML>
|