• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/cpp/
1<html lang="en">
2<head>
3<title>Diagnostics - The C Preprocessor</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="The C Preprocessor">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="prev" href="Conditionals.html#Conditionals" title="Conditionals">
9<link rel="next" href="Line-Control.html#Line-Control" title="Line Control">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
142008, 2009, 2010, 2011
15Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation.  A copy of
20the license is included in the
21section entitled ``GNU Free Documentation License''.
22
23This manual contains no Invariant Sections.  The Front-Cover Texts are
24(a) (see below), and the Back-Cover Texts are (b) (see below).
25
26(a) The FSF's Front-Cover Text is:
27
28     A GNU Manual
29
30(b) The FSF's Back-Cover Text is:
31
32     You have freedom to copy and modify this GNU Manual, like GNU
33     software.  Copies published by the Free Software Foundation raise
34     funds for GNU development.
35-->
36<meta http-equiv="Content-Style-Type" content="text/css">
37<style type="text/css"><!--
38  pre.display { font-family:inherit }
39  pre.format  { font-family:inherit }
40  pre.smalldisplay { font-family:inherit; font-size:smaller }
41  pre.smallformat  { font-family:inherit; font-size:smaller }
42  pre.smallexample { font-size:smaller }
43  pre.smalllisp    { font-size:smaller }
44  span.sc    { font-variant:small-caps }
45  span.roman { font-family:serif; font-weight:normal; } 
46  span.sansserif { font-family:sans-serif; font-weight:normal; } 
47--></style>
48<link rel="stylesheet" type="text/css" href="../cs.css">
49</head>
50<body>
51<div class="node">
52<a name="Diagnostics"></a>
53<p>
54Next:&nbsp;<a rel="next" accesskey="n" href="Line-Control.html#Line-Control">Line Control</a>,
55Previous:&nbsp;<a rel="previous" accesskey="p" href="Conditionals.html#Conditionals">Conditionals</a>,
56Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
57<hr>
58</div>
59
60<h2 class="chapter">5 Diagnostics</h2>
61
62<p><a name="index-diagnostic-93"></a><a name="index-reporting-errors-94"></a><a name="index-reporting-warnings-95"></a>
63<a name="index-g_t_0023error-96"></a>The directive &lsquo;<samp><span class="samp">#error</span></samp>&rsquo; causes the preprocessor to report a fatal
64error.  The tokens forming the rest of the line following &lsquo;<samp><span class="samp">#error</span></samp>&rsquo;
65are used as the error message.
66
67   <p>You would use &lsquo;<samp><span class="samp">#error</span></samp>&rsquo; inside of a conditional that detects a
68combination of parameters which you know the program does not properly
69support.  For example, if you know that the program will not run
70properly on a VAX, you might write
71
72<pre class="smallexample">     #ifdef __vax__
73     #error "Won't work on VAXen.  See comments at get_last_object."
74     #endif
75</pre>
76   <p>If you have several configuration parameters that must be set up by
77the installation in a consistent way, you can use conditionals to detect
78an inconsistency and report it with &lsquo;<samp><span class="samp">#error</span></samp>&rsquo;.  For example,
79
80<pre class="smallexample">     #if !defined(UNALIGNED_INT_ASM_OP) &amp;&amp; defined(DWARF2_DEBUGGING_INFO)
81     #error "DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP."
82     #endif
83</pre>
84   <p><a name="index-g_t_0023warning-97"></a>The directive &lsquo;<samp><span class="samp">#warning</span></samp>&rsquo; is like &lsquo;<samp><span class="samp">#error</span></samp>&rsquo;, but causes the
85preprocessor to issue a warning and continue preprocessing.  The tokens
86following &lsquo;<samp><span class="samp">#warning</span></samp>&rsquo; are used as the warning message.
87
88   <p>You might use &lsquo;<samp><span class="samp">#warning</span></samp>&rsquo; in obsolete header files, with a message
89directing the user to the header file which should be used instead.
90
91   <p>Neither &lsquo;<samp><span class="samp">#error</span></samp>&rsquo; nor &lsquo;<samp><span class="samp">#warning</span></samp>&rsquo; macro-expands its argument. 
92Internal whitespace sequences are each replaced with a single space. 
93The line must consist of complete tokens.  It is wisest to make the
94argument of these directives be a single string constant; this avoids
95problems with apostrophes and the like.
96
97   </body></html>
98
99