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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [doc/] [cpp.1] - Blame information for rev 20

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

Line No. Rev Author Line
1 12 jlechner
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2
.\"
3
.\" Standard preamble:
4
.\" ========================================================================
5
.de Sh \" Subsection heading
6
.br
7
.if t .Sp
8
.ne 5
9
.PP
10
\fB\\$1\fR
11
.PP
12
..
13
.de Sp \" Vertical space (when we can't use .PP)
14
.if t .sp .5v
15
.if n .sp
16
..
17
.de Vb \" Begin verbatim text
18
.ft CW
19
.nf
20
.ne \\$1
21
..
22
.de Ve \" End verbatim text
23
.ft R
24
.fi
25
..
26
.\" Set up some character translations and predefined strings.  \*(-- will
27
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28
.\" double quote, and \*(R" will give a right double quote.  | will give a
29
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31
.\" expand to `' in nroff, nothing in troff, for use with C<>.
32
.tr \(*W-|\(bv\*(Tr
33
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34
.ie n \{\
35
.    ds -- \(*W-
36
.    ds PI pi
37
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39
.    ds L" ""
40
.    ds R" ""
41
.    ds C` ""
42
.    ds C' ""
43
'br\}
44
.el\{\
45
.    ds -- \|\(em\|
46
.    ds PI \(*p
47
.    ds L" ``
48
.    ds R" ''
49
'br\}
50
.\"
51
.\" If the F register is turned on, we'll generate index entries on stderr for
52
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53
.\" entries marked with X<> in POD.  Of course, you'll have to process the
54
.\" output yourself in some meaningful fashion.
55
.if \nF \{\
56
.    de IX
57
.    tm Index:\\$1\t\\n%\t"\\$2"
58
..
59
.    nr % 0
60
.    rr F
61
.\}
62
.\"
63
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64
.\" way too many mistakes in technical documents.
65
.hy 0
66
.if n .na
67
.\"
68
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70
.    \" fudge factors for nroff and troff
71
.if n \{\
72
.    ds #H 0
73
.    ds #V .8m
74
.    ds #F .3m
75
.    ds #[ \f1
76
.    ds #] \fP
77
.\}
78
.if t \{\
79
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80
.    ds #V .6m
81
.    ds #F 0
82
.    ds #[ \&
83
.    ds #] \&
84
.\}
85
.    \" simple accents for nroff and troff
86
.if n \{\
87
.    ds ' \&
88
.    ds ` \&
89
.    ds ^ \&
90
.    ds , \&
91
.    ds ~ ~
92
.    ds /
93
.\}
94
.if t \{\
95
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101
.\}
102
.    \" troff and (daisy-wheel) nroff accents
103
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110
.ds ae a\h'-(\w'a'u*4/10)'e
111
.ds Ae A\h'-(\w'A'u*4/10)'E
112
.    \" corrections for vroff
113
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115
.    \" for low resolution devices (crt and lpr)
116
.if \n(.H>23 .if \n(.V>19 \
117
\{\
118
.    ds : e
119
.    ds 8 ss
120
.    ds o a
121
.    ds d- d\h'-1'\(ga
122
.    ds D- D\h'-1'\(hy
123
.    ds th \o'bp'
124
.    ds Th \o'LP'
125
.    ds ae ae
126
.    ds Ae AE
127
.\}
128
.rm #[ #] #H #V #F C
129
.\" ========================================================================
130
.\"
131
.IX Title "CPP 1"
132
.TH CPP 1 "2006-05-24" "gcc-4.1.1" "GNU"
133
.SH "NAME"
134
cpp \- The C Preprocessor
135
.SH "SYNOPSIS"
136
.IX Header "SYNOPSIS"
137
cpp [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
138
    [\fB\-I\fR\fIdir\fR...] [\fB\-iquote\fR\fIdir\fR...]
139
    [\fB\-W\fR\fIwarn\fR...]
140
    [\fB\-M\fR|\fB\-MM\fR] [\fB\-MG\fR] [\fB\-MF\fR \fIfilename\fR]
141
    [\fB\-MP\fR] [\fB\-MQ\fR \fItarget\fR...]
142
    [\fB\-MT\fR \fItarget\fR...]
143
    [\fB\-P\fR] [\fB\-fno\-working\-directory\fR]
144
    [\fB\-x\fR \fIlanguage\fR] [\fB\-std=\fR\fIstandard\fR]
145
    \fIinfile\fR \fIoutfile\fR
146
.PP
147
Only the most useful options are listed here; see below for the remainder.
148
.SH "DESCRIPTION"
149
.IX Header "DESCRIPTION"
150
The C preprocessor, often known as \fIcpp\fR, is a \fImacro processor\fR
151
that is used automatically by the C compiler to transform your program
152
before compilation.  It is called a macro processor because it allows
153
you to define \fImacros\fR, which are brief abbreviations for longer
154
constructs.
155
.PP
156
The C preprocessor is intended to be used only with C, \*(C+, and
157
Objective-C source code.  In the past, it has been abused as a general
158
text processor.  It will choke on input which does not obey C's lexical
159
rules.  For example, apostrophes will be interpreted as the beginning of
160
character constants, and cause errors.  Also, you cannot rely on it
161
preserving characteristics of the input which are not significant to
162
C\-family languages.  If a Makefile is preprocessed, all the hard tabs
163
will be removed, and the Makefile will not work.
164
.PP
165
Having said that, you can often get away with using cpp on things which
166
are not C.  Other Algol-ish programming languages are often safe
167
(Pascal, Ada, etc.) So is assembly, with caution.  \fB\-traditional\-cpp\fR
168
mode preserves more white space, and is otherwise more permissive.  Many
169
of the problems can be avoided by writing C or \*(C+ style comments
170
instead of native language comments, and keeping macros simple.
171
.PP
172
Wherever possible, you should use a preprocessor geared to the language
173
you are writing in.  Modern versions of the \s-1GNU\s0 assembler have macro
174
facilities.  Most high level programming languages have their own
175
conditional compilation and inclusion mechanism.  If all else fails,
176
try a true general text processor, such as \s-1GNU\s0 M4.
177
.PP
178
C preprocessors vary in some details.  This manual discusses the \s-1GNU\s0 C
179
preprocessor, which provides a small superset of the features of \s-1ISO\s0
180
Standard C.  In its default mode, the \s-1GNU\s0 C preprocessor does not do a
181
few things required by the standard.  These are features which are
182
rarely, if ever, used, and may cause surprising changes to the meaning
183
of a program which does not expect them.  To get strict \s-1ISO\s0 Standard C,
184
you should use the \fB\-std=c89\fR or \fB\-std=c99\fR options, depending
185
on which version of the standard you want.  To get all the mandatory
186
diagnostics, you must also use \fB\-pedantic\fR.
187
.PP
188
This manual describes the behavior of the \s-1ISO\s0 preprocessor.  To
189
minimize gratuitous differences, where the \s-1ISO\s0 preprocessor's
190
behavior does not conflict with traditional semantics, the
191
traditional preprocessor should behave the same way.  The various
192
differences that do exist are detailed in the section \fBTraditional
193
Mode\fR.
194
.PP
195
For clarity, unless noted otherwise, references to \fB\s-1CPP\s0\fR in this
196
manual refer to \s-1GNU\s0 \s-1CPP\s0.
197
.SH "OPTIONS"
198
.IX Header "OPTIONS"
199
The C preprocessor expects two file names as arguments, \fIinfile\fR and
200
\&\fIoutfile\fR.  The preprocessor reads \fIinfile\fR together with any
201
other files it specifies with \fB#include\fR.  All the output generated
202
by the combined input files is written in \fIoutfile\fR.
203
.PP
204
Either \fIinfile\fR or \fIoutfile\fR may be \fB\-\fR, which as
205
\&\fIinfile\fR means to read from standard input and as \fIoutfile\fR
206
means to write to standard output.  Also, if either file is omitted, it
207
means the same as if \fB\-\fR had been specified for that file.
208
.PP
209
Unless otherwise noted, or the option ends in \fB=\fR, all options
210
which take an argument may have that argument appear either immediately
211
after the option, or with a space between option and argument:
212
\&\fB\-Ifoo\fR and \fB\-I foo\fR have the same effect.
213
.PP
214
Many options have multi-letter names; therefore multiple single-letter
215
options may \fInot\fR be grouped: \fB\-dM\fR is very different from
216
\&\fB\-d\ \-M\fR.
217
.IP "\fB\-D\fR \fIname\fR" 4
218
.IX Item "-D name"
219
Predefine \fIname\fR as a macro, with definition \f(CW1\fR.
220
.IP "\fB\-D\fR \fIname\fR\fB=\fR\fIdefinition\fR" 4
221
.IX Item "-D name=definition"
222
The contents of \fIdefinition\fR are tokenized and processed as if
223
they appeared during translation phase three in a \fB#define\fR
224
directive.  In particular, the definition will be truncated by
225
embedded newline characters.
226
.Sp
227
If you are invoking the preprocessor from a shell or shell-like
228
program you may need to use the shell's quoting syntax to protect
229
characters such as spaces that have a meaning in the shell syntax.
230
.Sp
231
If you wish to define a function-like macro on the command line, write
232
its argument list with surrounding parentheses before the equals sign
233
(if any).  Parentheses are meaningful to most shells, so you will need
234
to quote the option.  With \fBsh\fR and \fBcsh\fR,
235
\&\fB\-D'\fR\fIname\fR\fB(\fR\fIargs...\fR\fB)=\fR\fIdefinition\fR\fB'\fR works.
236
.Sp
237
\&\fB\-D\fR and \fB\-U\fR options are processed in the order they
238
are given on the command line.  All \fB\-imacros\fR \fIfile\fR and
239
\&\fB\-include\fR \fIfile\fR options are processed after all
240
\&\fB\-D\fR and \fB\-U\fR options.
241
.IP "\fB\-U\fR \fIname\fR" 4
242
.IX Item "-U name"
243
Cancel any previous definition of \fIname\fR, either built in or
244
provided with a \fB\-D\fR option.
245
.IP "\fB\-undef\fR" 4
246
.IX Item "-undef"
247
Do not predefine any system-specific or GCC-specific macros.  The
248
standard predefined macros remain defined.
249
.IP "\fB\-I\fR \fIdir\fR" 4
250
.IX Item "-I dir"
251
Add the directory \fIdir\fR to the list of directories to be searched
252
for header files.
253
.Sp
254
Directories named by \fB\-I\fR are searched before the standard
255
system include directories.  If the directory \fIdir\fR is a standard
256
system include directory, the option is ignored to ensure that the
257
default search order for system directories and the special treatment
258
of system headers are not defeated
259
\&.
260
.IP "\fB\-o\fR \fIfile\fR" 4
261
.IX Item "-o file"
262
Write output to \fIfile\fR.  This is the same as specifying \fIfile\fR
263
as the second non-option argument to \fBcpp\fR.  \fBgcc\fR has a
264
different interpretation of a second non-option argument, so you must
265
use \fB\-o\fR to specify the output file.
266
.IP "\fB\-Wall\fR" 4
267
.IX Item "-Wall"
268
Turns on all optional warnings which are desirable for normal code.
269
At present this is \fB\-Wcomment\fR, \fB\-Wtrigraphs\fR,
270
\&\fB\-Wmultichar\fR and a warning about integer promotion causing a
271
change of sign in \f(CW\*(C`#if\*(C'\fR expressions.  Note that many of the
272
preprocessor's warnings are on by default and have no options to
273
control them.
274
.IP "\fB\-Wcomment\fR" 4
275
.IX Item "-Wcomment"
276
.PD 0
277
.IP "\fB\-Wcomments\fR" 4
278
.IX Item "-Wcomments"
279
.PD
280
Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
281
comment, or whenever a backslash-newline appears in a \fB//\fR comment.
282
(Both forms have the same effect.)
283
.IP "\fB\-Wtrigraphs\fR" 4
284
.IX Item "-Wtrigraphs"
285
@anchor{Wtrigraphs}
286
Most trigraphs in comments cannot affect the meaning of the program.
287
However, a trigraph that would form an escaped newline (\fB??/\fR at
288
the end of a line) can, by changing where the comment begins or ends.
289
Therefore, only trigraphs that would form escaped newlines produce
290
warnings inside a comment.
291
.Sp
292
This option is implied by \fB\-Wall\fR.  If \fB\-Wall\fR is not
293
given, this option is still enabled unless trigraphs are enabled.  To
294
get trigraph conversion without warnings, but get the other
295
\&\fB\-Wall\fR warnings, use \fB\-trigraphs \-Wall \-Wno\-trigraphs\fR.
296
.IP "\fB\-Wtraditional\fR" 4
297
.IX Item "-Wtraditional"
298
Warn about certain constructs that behave differently in traditional and
299
\&\s-1ISO\s0 C.  Also warn about \s-1ISO\s0 C constructs that have no traditional C
300
equivalent, and problematic constructs which should be avoided.
301
.IP "\fB\-Wimport\fR" 4
302
.IX Item "-Wimport"
303
Warn the first time \fB#import\fR is used.
304
.IP "\fB\-Wundef\fR" 4
305
.IX Item "-Wundef"
306
Warn whenever an identifier which is not a macro is encountered in an
307
\&\fB#if\fR directive, outside of \fBdefined\fR.  Such identifiers are
308
replaced with zero.
309
.IP "\fB\-Wunused\-macros\fR" 4
310
.IX Item "-Wunused-macros"
311
Warn about macros defined in the main file that are unused.  A macro
312
is \fIused\fR if it is expanded or tested for existence at least once.
313
The preprocessor will also warn if the macro has not been used at the
314
time it is redefined or undefined.
315
.Sp
316
Built-in macros, macros defined on the command line, and macros
317
defined in include files are not warned about.
318
.Sp
319
\&\fINote:\fR If a macro is actually used, but only used in skipped
320
conditional blocks, then \s-1CPP\s0 will report it as unused.  To avoid the
321
warning in such a case, you might improve the scope of the macro's
322
definition by, for example, moving it into the first skipped block.
323
Alternatively, you could provide a dummy use with something like:
324
.Sp
325
.Vb 2
326
\&        #if defined the_macro_causing_the_warning
327
\&        #endif
328
.Ve
329
.IP "\fB\-Wendif\-labels\fR" 4
330
.IX Item "-Wendif-labels"
331
Warn whenever an \fB#else\fR or an \fB#endif\fR are followed by text.
332
This usually happens in code of the form
333
.Sp
334
.Vb 5
335
\&        #if FOO
336
\&        ...
337
\&        #else FOO
338
\&        ...
339
\&        #endif FOO
340
.Ve
341
.Sp
342
The second and third \f(CW\*(C`FOO\*(C'\fR should be in comments, but often are not
343
in older programs.  This warning is on by default.
344
.IP "\fB\-Werror\fR" 4
345
.IX Item "-Werror"
346
Make all warnings into hard errors.  Source code which triggers warnings
347
will be rejected.
348
.IP "\fB\-Wsystem\-headers\fR" 4
349
.IX Item "-Wsystem-headers"
350
Issue warnings for code in system headers.  These are normally unhelpful
351
in finding bugs in your own code, therefore suppressed.  If you are
352
responsible for the system library, you may want to see them.
353
.IP "\fB\-w\fR" 4
354
.IX Item "-w"
355
Suppress all warnings, including those which \s-1GNU\s0 \s-1CPP\s0 issues by default.
356
.IP "\fB\-pedantic\fR" 4
357
.IX Item "-pedantic"
358
Issue all the mandatory diagnostics listed in the C standard.  Some of
359
them are left out by default, since they trigger frequently on harmless
360
code.
361
.IP "\fB\-pedantic\-errors\fR" 4
362
.IX Item "-pedantic-errors"
363
Issue all the mandatory diagnostics, and make all mandatory diagnostics
364
into errors.  This includes mandatory diagnostics that \s-1GCC\s0 issues
365
without \fB\-pedantic\fR but treats as warnings.
366
.IP "\fB\-M\fR" 4
367
.IX Item "-M"
368
Instead of outputting the result of preprocessing, output a rule
369
suitable for \fBmake\fR describing the dependencies of the main
370
source file.  The preprocessor outputs one \fBmake\fR rule containing
371
the object file name for that source file, a colon, and the names of all
372
the included files, including those coming from \fB\-include\fR or
373
\&\fB\-imacros\fR command line options.
374
.Sp
375
Unless specified explicitly (with \fB\-MT\fR or \fB\-MQ\fR), the
376
object file name consists of the basename of the source file with any
377
suffix replaced with object file suffix.  If there are many included
378
files then the rule is split into several lines using \fB\e\fR\-newline.
379
The rule has no commands.
380
.Sp
381
This option does not suppress the preprocessor's debug output, such as
382
\&\fB\-dM\fR.  To avoid mixing such debug output with the dependency
383
rules you should explicitly specify the dependency output file with
384
\&\fB\-MF\fR, or use an environment variable like
385
\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR.  Debug output
386
will still be sent to the regular output stream as normal.
387
.Sp
388
Passing \fB\-M\fR to the driver implies \fB\-E\fR, and suppresses
389
warnings with an implicit \fB\-w\fR.
390
.IP "\fB\-MM\fR" 4
391
.IX Item "-MM"
392
Like \fB\-M\fR but do not mention header files that are found in
393
system header directories, nor header files that are included,
394
directly or indirectly, from such a header.
395
.Sp
396
This implies that the choice of angle brackets or double quotes in an
397
\&\fB#include\fR directive does not in itself determine whether that
398
header will appear in \fB\-MM\fR dependency output.  This is a
399
slight change in semantics from \s-1GCC\s0 versions 3.0 and earlier.
400
.Sp
401
@anchor{dashMF}
402
.IP "\fB\-MF\fR \fIfile\fR" 4
403
.IX Item "-MF file"
404
When used with \fB\-M\fR or \fB\-MM\fR, specifies a
405
file to write the dependencies to.  If no \fB\-MF\fR switch is given
406
the preprocessor sends the rules to the same place it would have sent
407
preprocessed output.
408
.Sp
409
When used with the driver options \fB\-MD\fR or \fB\-MMD\fR,
410
\&\fB\-MF\fR overrides the default dependency output file.
411
.IP "\fB\-MG\fR" 4
412
.IX Item "-MG"
413
In conjunction with an option such as \fB\-M\fR requesting
414
dependency generation, \fB\-MG\fR assumes missing header files are
415
generated files and adds them to the dependency list without raising
416
an error.  The dependency filename is taken directly from the
417
\&\f(CW\*(C`#include\*(C'\fR directive without prepending any path.  \fB\-MG\fR
418
also suppresses preprocessed output, as a missing header file renders
419
this useless.
420
.Sp
421
This feature is used in automatic updating of makefiles.
422
.IP "\fB\-MP\fR" 4
423
.IX Item "-MP"
424
This option instructs \s-1CPP\s0 to add a phony target for each dependency
425
other than the main file, causing each to depend on nothing.  These
426
dummy rules work around errors \fBmake\fR gives if you remove header
427
files without updating the \fIMakefile\fR to match.
428
.Sp
429
This is typical output:
430
.Sp
431
.Vb 1
432
\&        test.o: test.c test.h
433
.Ve
434
.Sp
435
.Vb 1
436
\&        test.h:
437
.Ve
438
.IP "\fB\-MT\fR \fItarget\fR" 4
439
.IX Item "-MT target"
440
Change the target of the rule emitted by dependency generation.  By
441
default \s-1CPP\s0 takes the name of the main input file, including any path,
442
deletes any file suffix such as \fB.c\fR, and appends the platform's
443
usual object suffix.  The result is the target.
444
.Sp
445
An \fB\-MT\fR option will set the target to be exactly the string you
446
specify.  If you want multiple targets, you can specify them as a single
447
argument to \fB\-MT\fR, or use multiple \fB\-MT\fR options.
448
.Sp
449
For example, \fB\-MT\ '$(objpfx)foo.o'\fR might give
450
.Sp
451
.Vb 1
452
\&        $(objpfx)foo.o: foo.c
453
.Ve
454
.IP "\fB\-MQ\fR \fItarget\fR" 4
455
.IX Item "-MQ target"
456
Same as \fB\-MT\fR, but it quotes any characters which are special to
457
Make.  \fB\-MQ\ '$(objpfx)foo.o'\fR gives
458
.Sp
459
.Vb 1
460
\&        $$(objpfx)foo.o: foo.c
461
.Ve
462
.Sp
463
The default target is automatically quoted, as if it were given with
464
\&\fB\-MQ\fR.
465
.IP "\fB\-MD\fR" 4
466
.IX Item "-MD"
467
\&\fB\-MD\fR is equivalent to \fB\-M \-MF\fR \fIfile\fR, except that
468
\&\fB\-E\fR is not implied.  The driver determines \fIfile\fR based on
469
whether an \fB\-o\fR option is given.  If it is, the driver uses its
470
argument but with a suffix of \fI.d\fR, otherwise it take the
471
basename of the input file and applies a \fI.d\fR suffix.
472
.Sp
473
If \fB\-MD\fR is used in conjunction with \fB\-E\fR, any
474
\&\fB\-o\fR switch is understood to specify the dependency output file
475
(but \f(CW@pxref\fR{dashMF,,\-MF}), but if used without \fB\-E\fR, each \fB\-o\fR
476
is understood to specify a target object file.
477
.Sp
478
Since \fB\-E\fR is not implied, \fB\-MD\fR can be used to generate
479
a dependency output file as a side-effect of the compilation process.
480
.IP "\fB\-MMD\fR" 4
481
.IX Item "-MMD"
482
Like \fB\-MD\fR except mention only user header files, not system
483
header files.
484
.IP "\fB\-x c\fR" 4
485
.IX Item "-x c"
486
.PD 0
487
.IP "\fB\-x c++\fR" 4
488
.IX Item "-x c++"
489
.IP "\fB\-x objective-c\fR" 4
490
.IX Item "-x objective-c"
491
.IP "\fB\-x assembler-with-cpp\fR" 4
492
.IX Item "-x assembler-with-cpp"
493
.PD
494
Specify the source language: C, \*(C+, Objective\-C, or assembly.  This has
495
nothing to do with standards conformance or extensions; it merely
496
selects which base syntax to expect.  If you give none of these options,
497
cpp will deduce the language from the extension of the source file:
498
\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, or \fB.S\fR.  Some other common
499
extensions for \*(C+ and assembly are also recognized.  If cpp does not
500
recognize the extension, it will treat the file as C; this is the most
501
generic mode.
502
.Sp
503
\&\fINote:\fR Previous versions of cpp accepted a \fB\-lang\fR option
504
which selected both the language and the standards conformance level.
505
This option has been removed, because it conflicts with the \fB\-l\fR
506
option.
507
.IP "\fB\-std=\fR\fIstandard\fR" 4
508
.IX Item "-std=standard"
509
.PD 0
510
.IP "\fB\-ansi\fR" 4
511
.IX Item "-ansi"
512
.PD
513
Specify the standard to which the code should conform.  Currently \s-1CPP\s0
514
knows about C and \*(C+ standards; others may be added in the future.
515
.Sp
516
\&\fIstandard\fR
517
may be one of:
518
.RS 4
519
.ie n .IP """iso9899:1990""" 4
520
.el .IP "\f(CWiso9899:1990\fR" 4
521
.IX Item "iso9899:1990"
522
.PD 0
523
.ie n .IP """c89""" 4
524
.el .IP "\f(CWc89\fR" 4
525
.IX Item "c89"
526
.PD
527
The \s-1ISO\s0 C standard from 1990.  \fBc89\fR is the customary shorthand for
528
this version of the standard.
529
.Sp
530
The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR.
531
.ie n .IP """iso9899:199409""" 4
532
.el .IP "\f(CWiso9899:199409\fR" 4
533
.IX Item "iso9899:199409"
534
The 1990 C standard, as amended in 1994.
535
.ie n .IP """iso9899:1999""" 4
536
.el .IP "\f(CWiso9899:1999\fR" 4
537
.IX Item "iso9899:1999"
538
.PD 0
539
.ie n .IP """c99""" 4
540
.el .IP "\f(CWc99\fR" 4
541
.IX Item "c99"
542
.ie n .IP """iso9899:199x""" 4
543
.el .IP "\f(CWiso9899:199x\fR" 4
544
.IX Item "iso9899:199x"
545
.ie n .IP """c9x""" 4
546
.el .IP "\f(CWc9x\fR" 4
547
.IX Item "c9x"
548
.PD
549
The revised \s-1ISO\s0 C standard, published in December 1999.  Before
550
publication, this was known as C9X.
551
.ie n .IP """gnu89""" 4
552
.el .IP "\f(CWgnu89\fR" 4
553
.IX Item "gnu89"
554
The 1990 C standard plus \s-1GNU\s0 extensions.  This is the default.
555
.ie n .IP """gnu99""" 4
556
.el .IP "\f(CWgnu99\fR" 4
557
.IX Item "gnu99"
558
.PD 0
559
.ie n .IP """gnu9x""" 4
560
.el .IP "\f(CWgnu9x\fR" 4
561
.IX Item "gnu9x"
562
.PD
563
The 1999 C standard plus \s-1GNU\s0 extensions.
564
.ie n .IP """c++98""" 4
565
.el .IP "\f(CWc++98\fR" 4
566
.IX Item "c++98"
567
The 1998 \s-1ISO\s0 \*(C+ standard plus amendments.
568
.ie n .IP """gnu++98""" 4
569
.el .IP "\f(CWgnu++98\fR" 4
570
.IX Item "gnu++98"
571
The same as \fB\-std=c++98\fR plus \s-1GNU\s0 extensions.  This is the
572
default for \*(C+ code.
573
.RE
574
.RS 4
575
.RE
576
.IP "\fB\-I\-\fR" 4
577
.IX Item "-I-"
578
Split the include path.  Any directories specified with \fB\-I\fR
579
options before \fB\-I\-\fR are searched only for headers requested with
580
\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
581
\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR.  If additional directories are
582
specified with \fB\-I\fR options after the \fB\-I\-\fR, those
583
directories are searched for all \fB#include\fR directives.
584
.Sp
585
In addition, \fB\-I\-\fR inhibits the use of the directory of the current
586
file directory as the first search directory for \f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR.
587
.Sp
588
This option has been deprecated.
589
.IP "\fB\-nostdinc\fR" 4
590
.IX Item "-nostdinc"
591
Do not search the standard system directories for header files.
592
Only the directories you have specified with \fB\-I\fR options
593
(and the directory of the current file, if appropriate) are searched.
594
.IP "\fB\-nostdinc++\fR" 4
595
.IX Item "-nostdinc++"
596
Do not search for header files in the \*(C+\-specific standard directories,
597
but do still search the other standard directories.  (This option is
598
used when building the \*(C+ library.)
599
.IP "\fB\-include\fR \fIfile\fR" 4
600
.IX Item "-include file"
601
Process \fIfile\fR as if \f(CW\*(C`#include "file"\*(C'\fR appeared as the first
602
line of the primary source file.  However, the first directory searched
603
for \fIfile\fR is the preprocessor's working directory \fIinstead of\fR
604
the directory containing the main source file.  If not found there, it
605
is searched for in the remainder of the \f(CW\*(C`#include "..."\*(C'\fR search
606
chain as normal.
607
.Sp
608
If multiple \fB\-include\fR options are given, the files are included
609
in the order they appear on the command line.
610
.IP "\fB\-imacros\fR \fIfile\fR" 4
611
.IX Item "-imacros file"
612
Exactly like \fB\-include\fR, except that any output produced by
613
scanning \fIfile\fR is thrown away.  Macros it defines remain defined.
614
This allows you to acquire all the macros from a header without also
615
processing its declarations.
616
.Sp
617
All files specified by \fB\-imacros\fR are processed before all files
618
specified by \fB\-include\fR.
619
.IP "\fB\-idirafter\fR \fIdir\fR" 4
620
.IX Item "-idirafter dir"
621
Search \fIdir\fR for header files, but do it \fIafter\fR all
622
directories specified with \fB\-I\fR and the standard system directories
623
have been exhausted.  \fIdir\fR is treated as a system include directory.
624
.IP "\fB\-iprefix\fR \fIprefix\fR" 4
625
.IX Item "-iprefix prefix"
626
Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR
627
options.  If the prefix represents a directory, you should include the
628
final \fB/\fR.
629
.IP "\fB\-iwithprefix\fR \fIdir\fR" 4
630
.IX Item "-iwithprefix dir"
631
.PD 0
632
.IP "\fB\-iwithprefixbefore\fR \fIdir\fR" 4
633
.IX Item "-iwithprefixbefore dir"
634
.PD
635
Append \fIdir\fR to the prefix specified previously with
636
\&\fB\-iprefix\fR, and add the resulting directory to the include search
637
path.  \fB\-iwithprefixbefore\fR puts it in the same place \fB\-I\fR
638
would; \fB\-iwithprefix\fR puts it where \fB\-idirafter\fR would.
639
.IP "\fB\-isysroot\fR \fIdir\fR" 4
640
.IX Item "-isysroot dir"
641
This option is like the \fB\-\-sysroot\fR option, but applies only to
642
header files.  See the \fB\-\-sysroot\fR option for more information.
643
.IP "\fB\-isystem\fR \fIdir\fR" 4
644
.IX Item "-isystem dir"
645
Search \fIdir\fR for header files, after all directories specified by
646
\&\fB\-I\fR but before the standard system directories.  Mark it
647
as a system directory, so that it gets the same special treatment as
648
is applied to the standard system directories.
649
.IP "\fB\-iquote\fR \fIdir\fR" 4
650
.IX Item "-iquote dir"
651
Search \fIdir\fR only for header files requested with
652
\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
653
\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR, before all directories specified by
654
\&\fB\-I\fR and before the standard system directories.
655
.IP "\fB\-fdollars\-in\-identifiers\fR" 4
656
.IX Item "-fdollars-in-identifiers"
657
@anchor{fdollars\-in\-identifiers}
658
Accept \fB$\fR in identifiers.
659
.IP "\fB\-fextended\-identifiers\fR" 4
660
.IX Item "-fextended-identifiers"
661
Accept universal character names in identifiers.  This option is
662
experimental; in a future version of \s-1GCC\s0, it will be enabled by
663
default for C99 and \*(C+.
664
.IP "\fB\-fpreprocessed\fR" 4
665
.IX Item "-fpreprocessed"
666
Indicate to the preprocessor that the input file has already been
667
preprocessed.  This suppresses things like macro expansion, trigraph
668
conversion, escaped newline splicing, and processing of most directives.
669
The preprocessor still recognizes and removes comments, so that you can
670
pass a file preprocessed with \fB\-C\fR to the compiler without
671
problems.  In this mode the integrated preprocessor is little more than
672
a tokenizer for the front ends.
673
.Sp
674
\&\fB\-fpreprocessed\fR is implicit if the input file has one of the
675
extensions \fB.i\fR, \fB.ii\fR or \fB.mi\fR.  These are the
676
extensions that \s-1GCC\s0 uses for preprocessed files created by
677
\&\fB\-save\-temps\fR.
678
.IP "\fB\-ftabstop=\fR\fIwidth\fR" 4
679
.IX Item "-ftabstop=width"
680
Set the distance between tab stops.  This helps the preprocessor report
681
correct column numbers in warnings or errors, even if tabs appear on the
682
line.  If the value is less than 1 or greater than 100, the option is
683
ignored.  The default is 8.
684
.IP "\fB\-fexec\-charset=\fR\fIcharset\fR" 4
685
.IX Item "-fexec-charset=charset"
686
Set the execution character set, used for string and character
687
constants.  The default is \s-1UTF\-8\s0.  \fIcharset\fR can be any encoding
688
supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine.
689
.IP "\fB\-fwide\-exec\-charset=\fR\fIcharset\fR" 4
690
.IX Item "-fwide-exec-charset=charset"
691
Set the wide execution character set, used for wide string and
692
character constants.  The default is \s-1UTF\-32\s0 or \s-1UTF\-16\s0, whichever
693
corresponds to the width of \f(CW\*(C`wchar_t\*(C'\fR.  As with
694
\&\fB\-fexec\-charset\fR, \fIcharset\fR can be any encoding supported
695
by the system's \f(CW\*(C`iconv\*(C'\fR library routine; however, you will have
696
problems with encodings that do not fit exactly in \f(CW\*(C`wchar_t\*(C'\fR.
697
.IP "\fB\-finput\-charset=\fR\fIcharset\fR" 4
698
.IX Item "-finput-charset=charset"
699
Set the input character set, used for translation from the character
700
set of the input file to the source character set used by \s-1GCC\s0.  If the
701
locale does not specify, or \s-1GCC\s0 cannot get this information from the
702
locale, the default is \s-1UTF\-8\s0.  This can be overridden by either the locale
703
or this command line option.  Currently the command line option takes
704
precedence if there's a conflict.  \fIcharset\fR can be any encoding
705
supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine.
706
.IP "\fB\-fworking\-directory\fR" 4
707
.IX Item "-fworking-directory"
708
Enable generation of linemarkers in the preprocessor output that will
709
let the compiler know the current working directory at the time of
710
preprocessing.  When this option is enabled, the preprocessor will
711
emit, after the initial linemarker, a second linemarker with the
712
current working directory followed by two slashes.  \s-1GCC\s0 will use this
713
directory, when it's present in the preprocessed input, as the
714
directory emitted as the current working directory in some debugging
715
information formats.  This option is implicitly enabled if debugging
716
information is enabled, but this can be inhibited with the negated
717
form \fB\-fno\-working\-directory\fR.  If the \fB\-P\fR flag is
718
present in the command line, this option has no effect, since no
719
\&\f(CW\*(C`#line\*(C'\fR directives are emitted whatsoever.
720
.IP "\fB\-fno\-show\-column\fR" 4
721
.IX Item "-fno-show-column"
722
Do not print column numbers in diagnostics.  This may be necessary if
723
diagnostics are being scanned by a program that does not understand the
724
column numbers, such as \fBdejagnu\fR.
725
.IP "\fB\-A\fR \fIpredicate\fR\fB=\fR\fIanswer\fR" 4
726
.IX Item "-A predicate=answer"
727
Make an assertion with the predicate \fIpredicate\fR and answer
728
\&\fIanswer\fR.  This form is preferred to the older form \fB\-A\fR
729
\&\fIpredicate\fR\fB(\fR\fIanswer\fR\fB)\fR, which is still supported, because
730
it does not use shell special characters.
731
.IP "\fB\-A \-\fR\fIpredicate\fR\fB=\fR\fIanswer\fR" 4
732
.IX Item "-A -predicate=answer"
733
Cancel an assertion with the predicate \fIpredicate\fR and answer
734
\&\fIanswer\fR.
735
.IP "\fB\-dCHARS\fR" 4
736
.IX Item "-dCHARS"
737
\&\fI\s-1CHARS\s0\fR is a sequence of one or more of the following characters,
738
and must not be preceded by a space.  Other characters are interpreted
739
by the compiler proper, or reserved for future versions of \s-1GCC\s0, and so
740
are silently ignored.  If you specify characters whose behavior
741
conflicts, the result is undefined.
742
.RS 4
743
.IP "\fBM\fR" 4
744
.IX Item "M"
745
Instead of the normal output, generate a list of \fB#define\fR
746
directives for all the macros defined during the execution of the
747
preprocessor, including predefined macros.  This gives you a way of
748
finding out what is predefined in your version of the preprocessor.
749
Assuming you have no file \fIfoo.h\fR, the command
750
.Sp
751
.Vb 1
752
\&        touch foo.h; cpp -dM foo.h
753
.Ve
754
.Sp
755
will show all the predefined macros.
756
.IP "\fBD\fR" 4
757
.IX Item "D"
758
Like \fBM\fR except in two respects: it does \fInot\fR include the
759
predefined macros, and it outputs \fIboth\fR the \fB#define\fR
760
directives and the result of preprocessing.  Both kinds of output go to
761
the standard output file.
762
.IP "\fBN\fR" 4
763
.IX Item "N"
764
Like \fBD\fR, but emit only the macro names, not their expansions.
765
.IP "\fBI\fR" 4
766
.IX Item "I"
767
Output \fB#include\fR directives in addition to the result of
768
preprocessing.
769
.RE
770
.RS 4
771
.RE
772
.IP "\fB\-P\fR" 4
773
.IX Item "-P"
774
Inhibit generation of linemarkers in the output from the preprocessor.
775
This might be useful when running the preprocessor on something that is
776
not C code, and will be sent to a program which might be confused by the
777
linemarkers.
778
.IP "\fB\-C\fR" 4
779
.IX Item "-C"
780
Do not discard comments.  All comments are passed through to the output
781
file, except for comments in processed directives, which are deleted
782
along with the directive.
783
.Sp
784
You should be prepared for side effects when using \fB\-C\fR; it
785
causes the preprocessor to treat comments as tokens in their own right.
786
For example, comments appearing at the start of what would be a
787
directive line have the effect of turning that line into an ordinary
788
source line, since the first token on the line is no longer a \fB#\fR.
789
.IP "\fB\-CC\fR" 4
790
.IX Item "-CC"
791
Do not discard comments, including during macro expansion.  This is
792
like \fB\-C\fR, except that comments contained within macros are
793
also passed through to the output file where the macro is expanded.
794
.Sp
795
In addition to the side-effects of the \fB\-C\fR option, the
796
\&\fB\-CC\fR option causes all \*(C+\-style comments inside a macro
797
to be converted to C\-style comments.  This is to prevent later use
798
of that macro from inadvertently commenting out the remainder of
799
the source line.
800
.Sp
801
The \fB\-CC\fR option is generally used to support lint comments.
802
.IP "\fB\-traditional\-cpp\fR" 4
803
.IX Item "-traditional-cpp"
804
Try to imitate the behavior of old-fashioned C preprocessors, as
805
opposed to \s-1ISO\s0 C preprocessors.
806
.IP "\fB\-trigraphs\fR" 4
807
.IX Item "-trigraphs"
808
Process trigraph sequences.
809
.IP "\fB\-remap\fR" 4
810
.IX Item "-remap"
811
Enable special code to work around file systems which only permit very
812
short file names, such as \s-1MS\-DOS\s0.
813
.IP "\fB\-\-help\fR" 4
814
.IX Item "--help"
815
.PD 0
816
.IP "\fB\-\-target\-help\fR" 4
817
.IX Item "--target-help"
818
.PD
819
Print text describing all the command line options instead of
820
preprocessing anything.
821
.IP "\fB\-v\fR" 4
822
.IX Item "-v"
823
Verbose mode.  Print out \s-1GNU\s0 \s-1CPP\s0's version number at the beginning of
824
execution, and report the final form of the include path.
825
.IP "\fB\-H\fR" 4
826
.IX Item "-H"
827
Print the name of each header file used, in addition to other normal
828
activities.  Each name is indented to show how deep in the
829
\&\fB#include\fR stack it is.  Precompiled header files are also
830
printed, even if they are found to be invalid; an invalid precompiled
831
header file is printed with \fB...x\fR and a valid one with \fB...!\fR .
832
.IP "\fB\-version\fR" 4
833
.IX Item "-version"
834
.PD 0
835
.IP "\fB\-\-version\fR" 4
836
.IX Item "--version"
837
.PD
838
Print out \s-1GNU\s0 \s-1CPP\s0's version number.  With one dash, proceed to
839
preprocess as normal.  With two dashes, exit immediately.
840
.SH "ENVIRONMENT"
841
.IX Header "ENVIRONMENT"
842
This section describes the environment variables that affect how \s-1CPP\s0
843
operates.  You can use them to specify directories or prefixes to use
844
when searching for include files, or to control dependency output.
845
.PP
846
Note that you can also specify places to search using options such as
847
\&\fB\-I\fR, and control dependency output with options like
848
\&\fB\-M\fR.  These take precedence over
849
environment variables, which in turn take precedence over the
850
configuration of \s-1GCC\s0.
851
.IP "\fB\s-1CPATH\s0\fR" 4
852
.IX Item "CPATH"
853
.PD 0
854
.IP "\fBC_INCLUDE_PATH\fR" 4
855
.IX Item "C_INCLUDE_PATH"
856
.IP "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4
857
.IX Item "CPLUS_INCLUDE_PATH"
858
.IP "\fB\s-1OBJC_INCLUDE_PATH\s0\fR" 4
859
.IX Item "OBJC_INCLUDE_PATH"
860
.PD
861
Each variable's value is a list of directories separated by a special
862
character, much like \fB\s-1PATH\s0\fR, in which to look for header files.
863
The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and
864
determined at \s-1GCC\s0 build time.  For Microsoft Windows-based targets it is a
865
semicolon, and for almost all other targets it is a colon.
866
.Sp
867
\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if
868
specified with \fB\-I\fR, but after any paths given with \fB\-I\fR
869
options on the command line.  This environment variable is used
870
regardless of which language is being preprocessed.
871
.Sp
872
The remaining environment variables apply only when preprocessing the
873
particular language indicated.  Each specifies a list of directories
874
to be searched as if specified with \fB\-isystem\fR, but after any
875
paths given with \fB\-isystem\fR options on the command line.
876
.Sp
877
In all these variables, an empty element instructs the compiler to
878
search its current working directory.  Empty elements can appear at the
879
beginning or end of a path.  For instance, if the value of
880
\&\fB\s-1CPATH\s0\fR is \f(CW\*(C`:/special/include\*(C'\fR, that has the same
881
effect as \fB\-I.\ \-I/special/include\fR.
882
.IP "\fB\s-1DEPENDENCIES_OUTPUT\s0\fR" 4
883
.IX Item "DEPENDENCIES_OUTPUT"
884
If this variable is set, its value specifies how to output
885
dependencies for Make based on the non-system header files processed
886
by the compiler.  System header files are ignored in the dependency
887
output.
888
.Sp
889
The value of \fB\s-1DEPENDENCIES_OUTPUT\s0\fR can be just a file name, in
890
which case the Make rules are written to that file, guessing the target
891
name from the source file name.  Or the value can have the form
892
\&\fIfile\fR\fB \fR\fItarget\fR, in which case the rules are written to
893
file \fIfile\fR using \fItarget\fR as the target name.
894
.Sp
895
In other words, this environment variable is equivalent to combining
896
the options \fB\-MM\fR and \fB\-MF\fR,
897
with an optional \fB\-MT\fR switch too.
898
.IP "\fB\s-1SUNPRO_DEPENDENCIES\s0\fR" 4
899
.IX Item "SUNPRO_DEPENDENCIES"
900
This variable is the same as \fB\s-1DEPENDENCIES_OUTPUT\s0\fR (see above),
901
except that system header files are not ignored, so it implies
902
\&\fB\-M\fR rather than \fB\-MM\fR.  However, the dependence on the
903
main input file is omitted.
904
.SH "SEE ALSO"
905
.IX Header "SEE ALSO"
906
\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf\-funding\fR\|(7),
907
\&\fIgcc\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIcpp\fR, \fIgcc\fR, and
908
\&\fIbinutils\fR.
909
.SH "COPYRIGHT"
910
.IX Header "COPYRIGHT"
911
Copyright (c) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
912
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
913
Free Software Foundation, Inc.
914
.PP
915
Permission is granted to copy, distribute and/or modify this document
916
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or
917
any later version published by the Free Software Foundation.  A copy of
918
the license is included in the
919
man page \fIgfdl\fR\|(7).
920
This manual contains no Invariant Sections.  The Front-Cover Texts are
921
(a) (see below), and the Back-Cover Texts are (b) (see below).
922
.PP
923
(a) The \s-1FSF\s0's Front-Cover Text is:
924
.PP
925
.Vb 1
926
\&     A GNU Manual
927
.Ve
928
.PP
929
(b) The \s-1FSF\s0's Back-Cover Text is:
930
.PP
931
.Vb 3
932
\&     You have freedom to copy and modify this GNU Manual, like GNU
933
\&     software.  Copies published by the Free Software Foundation raise
934
\&     funds for GNU development.
935
.Ve

powered by: WebSVN 2.1.0

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