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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [doc/] [options.texi] - Blame information for rev 711

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 711 jeremybenn
@c Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
2
@c Free Software Foundation, Inc.
3
@c This is part of the GCC manual.
4
@c For copying conditions, see the file gcc.texi.
5
 
6
@node Options
7
@chapter Option specification files
8
@cindex option specification files
9
@cindex @samp{optc-gen.awk}
10
 
11
Most GCC command-line options are described by special option
12
definition files, the names of which conventionally end in
13
@code{.opt}.  This chapter describes the format of these files.
14
 
15
@menu
16
* Option file format::   The general layout of the files
17
* Option properties::    Supported option properties
18
@end menu
19
 
20
@node Option file format
21
@section Option file format
22
 
23
Option files are a simple list of records in which each field occupies
24
its own line and in which the records themselves are separated by
25
blank lines.  Comments may appear on their own line anywhere within
26
the file and are preceded by semicolons.  Whitespace is allowed before
27
the semicolon.
28
 
29
The files can contain the following types of record:
30
 
31
@itemize @bullet
32
@item
33
A language definition record.  These records have two fields: the
34
string @samp{Language} and the name of the language.  Once a language
35
has been declared in this way, it can be used as an option property.
36
@xref{Option properties}.
37
 
38
@item
39
A target specific save record to save additional information. These
40
records have two fields: the string @samp{TargetSave}, and a
41
declaration type to go in the @code{cl_target_option} structure.
42
 
43
@item
44
A variable record to define a variable used to store option
45
information.  These records have two fields: the string
46
@samp{Variable}, and a declaration of the type and name of the
47
variable, optionally with an initializer (but without any trailing
48
@samp{;}).  These records may be used for variables used for many
49
options where declaring the initializer in a single option definition
50
record, or duplicating it in many records, would be inappropriate, or
51
for variables set in option handlers rather than referenced by
52
@code{Var} properties.
53
 
54
@item
55
A variable record to define a variable used to store option
56
information.  These records have two fields: the string
57
@samp{TargetVariable}, and a declaration of the type and name of the
58
variable, optionally with an initializer (but without any trailing
59
@samp{;}).  @samp{TargetVariable} is a combination of @samp{Variable}
60
and @samp{TargetSave} records in that the variable is defined in the
61
@code{gcc_options} structure, but these variables are also stored in
62
the @code{cl_target_option} structure.  The variables are saved in the
63
target save code and restored in the target restore code.
64
 
65
@item
66
A variable record to record any additional files that the
67
@file{options.h} file should include.  This is useful to provide
68
enumeration or structure definitions needed for target variables.
69
These records have two fields: the string @samp{HeaderInclude} and the
70
name of the include file.
71
 
72
@item
73
A variable record to record any additional files that the
74
@file{options.c} or @file{options-save.c} file should include.  This
75
is useful to provide
76
inline functions needed for target variables and/or @code{#ifdef}
77
sequences to properly set up the initialization.  These records have
78
two fields: the string @samp{SourceInclude} and the name of the
79
include file.
80
 
81
@item
82
An enumeration record to define a set of strings that may be used as
83
arguments to an option or options.  These records have three fields:
84
the string @samp{Enum}, a space-separated list of properties and help
85
text used to describe the set of strings in @option{--help} output.
86
Properties use the same format as option properties; the following are
87
valid:
88
@table @code
89
@item Name(@var{name})
90
This property is required; @var{name} must be a name (suitable for use
91
in C identifiers) used to identify the set of strings in @code{Enum}
92
option properties.
93
 
94
@item Type(@var{type})
95
This property is required; @var{type} is the C type for variables set
96
by options using this enumeration together with @code{Var}.
97
 
98
@item UnknownError(@var{message})
99
The message @var{message} will be used as an error message if the
100
argument is invalid; for enumerations without @code{UnknownError}, a
101
generic error message is used.  @var{message} should contain a single
102
@samp{%qs} format, which will be used to format the invalid argument.
103
@end table
104
 
105
@item
106
An enumeration value record to define one of the strings in a set
107
given in an @samp{Enum} record.  These records have two fields: the
108
string @samp{EnumValue} and a space-separated list of properties.
109
Properties use the same format as option properties; the following are
110
valid:
111
@table @code
112
@item Enum(@var{name})
113
This property is required; @var{name} says which @samp{Enum} record
114
this @samp{EnumValue} record corresponds to.
115
 
116
@item String(@var{string})
117
This property is required; @var{string} is the string option argument
118
being described by this record.
119
 
120
@item Value(@var{value})
121
This property is required; it says what value (representable as
122
@code{int}) should be used for the given string.
123
 
124
@item Canonical
125
This property is optional.  If present, it says the present string is
126
the canonical one among all those with the given value.  Other strings
127
yielding that value will be mapped to this one so specs do not need to
128
handle them.
129
 
130
@item DriverOnly
131
This property is optional.  If present, the present string will only
132
be accepted by the driver.  This is used for cases such as
133
@option{-march=native} that are processed by the driver so that
134
@samp{gcc -v} shows how the options chosen depended on the system on
135
which the compiler was run.
136
@end table
137
 
138
@item
139
An option definition record.  These records have the following fields:
140
@enumerate
141
@item
142
the name of the option, with the leading ``-'' removed
143
@item
144
a space-separated list of option properties (@pxref{Option properties})
145
@item
146
the help text to use for @option{--help} (omitted if the second field
147
contains the @code{Undocumented} property).
148
@end enumerate
149
 
150
By default, all options beginning with ``f'', ``W'' or ``m'' are
151
implicitly assumed to take a ``no-'' form.  This form should not be
152
listed separately.  If an option beginning with one of these letters
153
does not have a ``no-'' form, you can use the @code{RejectNegative}
154
property to reject it.
155
 
156
The help text is automatically line-wrapped before being displayed.
157
Normally the name of the option is printed on the left-hand side of
158
the output and the help text is printed on the right.  However, if the
159
help text contains a tab character, the text to the left of the tab is
160
used instead of the option's name and the text to the right of the
161
tab forms the help text.  This allows you to elaborate on what type
162
of argument the option takes.
163
 
164
@item
165
A target mask record.  These records have one field of the form
166
@samp{Mask(@var{x})}.  The options-processing script will automatically
167
allocate a bit in @code{target_flags} (@pxref{Run-time Target}) for
168
each mask name @var{x} and set the macro @code{MASK_@var{x}} to the
169
appropriate bitmask.  It will also declare a @code{TARGET_@var{x}}
170
macro that has the value 1 when bit @code{MASK_@var{x}} is set and
171
 
172
 
173
They are primarily intended to declare target masks that are not
174
associated with user options, either because these masks represent
175
internal switches or because the options are not available on all
176
configurations and yet the masks always need to be defined.
177
@end itemize
178
 
179
@node Option properties
180
@section Option properties
181
 
182
The second field of an option record can specify any of the following
183
properties.  When an option takes an argument, it is enclosed in parentheses
184
following the option property name.  The parser that handles option files
185
is quite simplistic, and will be tricked by any nested parentheses within
186
the argument text itself; in this case, the entire option argument can
187
be wrapped in curly braces within the parentheses to demarcate it, e.g.:
188
 
189
@smallexample
190
Condition(@{defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)@})
191
@end smallexample
192
 
193
@table @code
194
@item Common
195
The option is available for all languages and targets.
196
 
197
@item Target
198
The option is available for all languages but is target-specific.
199
 
200
@item Driver
201
The option is handled by the compiler driver using code not shared
202
with the compilers proper (@file{cc1} etc.).
203
 
204
@item @var{language}
205
The option is available when compiling for the given language.
206
 
207
It is possible to specify several different languages for the same
208
option.  Each @var{language} must have been declared by an earlier
209
@code{Language} record.  @xref{Option file format}.
210
 
211
@item RejectDriver
212
The option is only handled by the compilers proper (@file{cc1} etc.)@:
213
and should not be accepted by the driver.
214
 
215
@item RejectNegative
216
The option does not have a ``no-'' form.  All options beginning with
217
``f'', ``W'' or ``m'' are assumed to have a ``no-'' form unless this
218
property is used.
219
 
220
@item Negative(@var{othername})
221
The option will turn off another option @var{othername}, which is
222
the option name with the leading ``-'' removed.  This chain action will
223
propagate through the @code{Negative} property of the option to be
224
turned off.
225
 
226
As a consequence, if you have a group of mutually-exclusive
227
options, their @code{Negative} properties should form a circular chain.
228
For example, if options @option{-@var{a}}, @option{-@var{b}} and
229
@option{-@var{c}} are mutually exclusive, their respective @code{Negative}
230
properties should be @samp{Negative(@var{b})}, @samp{Negative(@var{c})}
231
and @samp{Negative(@var{a})}.
232
 
233
@item Joined
234
@itemx Separate
235
The option takes a mandatory argument.  @code{Joined} indicates
236
that the option and argument can be included in the same @code{argv}
237
entry (as with @code{-mflush-func=@var{name}}, for example).
238
@code{Separate} indicates that the option and argument can be
239
separate @code{argv} entries (as with @code{-o}).  An option is
240
allowed to have both of these properties.
241
 
242
@item JoinedOrMissing
243
The option takes an optional argument.  If the argument is given,
244
it will be part of the same @code{argv} entry as the option itself.
245
 
246
This property cannot be used alongside @code{Joined} or @code{Separate}.
247
 
248
@item MissingArgError(@var{message})
249
For an option marked @code{Joined} or @code{Separate}, the message
250
@var{message} will be used as an error message if the mandatory
251
argument is missing; for options without @code{MissingArgError}, a
252
generic error message is used.  @var{message} should contain a single
253
@samp{%qs} format, which will be used to format the name of the option
254
passed.
255
 
256
@item Args(@var{n})
257
For an option marked @code{Separate}, indicate that it takes @var{n}
258
arguments.  The default is 1.
259
 
260
@item UInteger
261
The option's argument is a non-negative integer.  The option parser
262
will check and convert the argument before passing it to the relevant
263
option handler.  @code{UInteger} should also be used on options like
264
@code{-falign-loops} where both @code{-falign-loops} and
265
@code{-falign-loops}=@var{n} are supported to make sure the saved
266
options are given a full integer.
267
 
268
@item ToLower
269
The option's argument should be converted to lowercase as part of
270
putting it in canonical form, and before comparing with the strings
271
indicated by any @code{Enum} property.
272
 
273
@item NoDriverArg
274
For an option marked @code{Separate}, the option only takes an
275
argument in the compiler proper, not in the driver.  This is for
276
compatibility with existing options that are used both directly and
277
via @option{-Wp,}; new options should not have this property.
278
 
279
@item Var(@var{var})
280
The state of this option should be stored in variable @var{var}
281
(actually a macro for @code{global_options.x_@var{var}}).
282
The way that the state is stored depends on the type of option:
283
 
284
@itemize @bullet
285
@item
286
If the option uses the @code{Mask} or @code{InverseMask} properties,
287
@var{var} is the integer variable that contains the mask.
288
 
289
@item
290
If the option is a normal on/off switch, @var{var} is an integer
291
variable that is nonzero when the option is enabled.  The options
292
parser will set the variable to 1 when the positive form of the
293
option is used and 0 when the ``no-'' form is used.
294
 
295
@item
296
If the option takes an argument and has the @code{UInteger} property,
297
@var{var} is an integer variable that stores the value of the argument.
298
 
299
@item
300
If the option takes an argument and has the @code{Enum} property,
301
@var{var} is a variable (type given in the @code{Type} property of the
302
@samp{Enum} record whose @code{Name} property has the same argument as
303
the @code{Enum} property of this option) that stores the value of the
304
argument.
305
 
306
@item
307
If the option has the @code{Defer} property, @var{var} is a pointer to
308
a @code{VEC(cl_deferred_option,heap)} that stores the option for later
309
processing.  (@var{var} is declared with type @code{void *} and needs
310
to be cast to @code{VEC(cl_deferred_option,heap)} before use.)
311
 
312
@item
313
Otherwise, if the option takes an argument, @var{var} is a pointer to
314
the argument string.  The pointer will be null if the argument is optional
315
and wasn't given.
316
@end itemize
317
 
318
The option-processing script will usually zero-initialize @var{var}.
319
You can modify this behavior using @code{Init}.
320
 
321
@item Var(@var{var}, @var{set})
322
The option controls an integer variable @var{var} and is active when
323
@var{var} equals @var{set}.  The option parser will set @var{var} to
324
@var{set} when the positive form of the option is used and @code{!@var{set}}
325
when the ``no-'' form is used.
326
 
327
@var{var} is declared in the same way as for the single-argument form
328
described above.
329
 
330
@item Init(@var{value})
331
The variable specified by the @code{Var} property should be statically
332
initialized to @var{value}.  If more than one option using the same
333
variable specifies @code{Init}, all must specify the same initializer.
334
 
335
@item Mask(@var{name})
336
The option is associated with a bit in the @code{target_flags}
337
variable (@pxref{Run-time Target}) and is active when that bit is set.
338
You may also specify @code{Var} to select a variable other than
339
@code{target_flags}.
340
 
341
The options-processing script will automatically allocate a unique bit
342
for the option.  If the option is attached to @samp{target_flags},
343
the script will set the macro @code{MASK_@var{name}} to the appropriate
344
bitmask.  It will also declare a @code{TARGET_@var{name}} macro that has
345
the value 1 when the option is active and 0 otherwise.  If you use @code{Var}
346
to attach the option to a different variable, the associated macros are
347
called @code{OPTION_MASK_@var{name}} and @code{OPTION_@var{name}} respectively.
348
 
349
You can disable automatic bit allocation using @code{MaskExists}.
350
 
351
@item InverseMask(@var{othername})
352
@itemx InverseMask(@var{othername}, @var{thisname})
353
The option is the inverse of another option that has the
354
@code{Mask(@var{othername})} property.  If @var{thisname} is given,
355
the options-processing script will declare a @code{TARGET_@var{thisname}}
356
macro that is 1 when the option is active and 0 otherwise.
357
 
358
@item MaskExists
359
The mask specified by the @code{Mask} property already exists.
360
No @code{MASK} or @code{TARGET} definitions should be added to
361
@file{options.h} in response to this option record.
362
 
363
The main purpose of this property is to support synonymous options.
364
The first option should use @samp{Mask(@var{name})} and the others
365
should use @samp{Mask(@var{name}) MaskExists}.
366
 
367
@item Enum(@var{name})
368
The option's argument is a string from the set of strings associated
369
with the corresponding @samp{Enum} record.  The string is checked and
370
converted to the integer specified in the corresponding
371
@samp{EnumValue} record before being passed to option handlers.
372
 
373
@item Defer
374
The option should be stored in a vector, specified with @code{Var},
375
for later processing.
376
 
377
@item Alias(@var{opt})
378
@itemx Alias(@var{opt}, @var{arg})
379
@itemx Alias(@var{opt}, @var{posarg}, @var{negarg})
380
The option is an alias for @option{-@var{opt}} (or the negative form
381
of that option, depending on @code{NegativeAlias}).  In the first form,
382
any argument passed to the alias is considered to be passed to
383
@option{-@var{opt}}, and @option{-@var{opt}} is considered to be
384
negated if the alias is used in negated form.  In the second form, the
385
alias may not be negated or have an argument, and @var{posarg} is
386
considered to be passed as an argument to @option{-@var{opt}}.  In the
387
third form, the alias may not have an argument, if the alias is used
388
in the positive form then @var{posarg} is considered to be passed to
389
@option{-@var{opt}}, and if the alias is used in the negative form
390
then @var{negarg} is considered to be passed to @option{-@var{opt}}.
391
 
392
Aliases should not specify @code{Var} or @code{Mask} or
393
@code{UInteger}.  Aliases should normally specify the same languages
394
as the target of the alias; the flags on the target will be used to
395
determine any diagnostic for use of an option for the wrong language,
396
while those on the alias will be used to identify what command-line
397
text is the option and what text is any argument to that option.
398
 
399
When an @code{Alias} definition is used for an option, driver specs do
400
not need to handle it and no @samp{OPT_} enumeration value is defined
401
for it; only the canonical form of the option will be seen in those
402
places.
403
 
404
@item NegativeAlias
405
For an option marked with @code{Alias(@var{opt})}, the option is
406
considered to be an alias for the positive form of @option{-@var{opt}}
407
if negated and for the negative form of @option{-@var{opt}} if not
408
negated.  @code{NegativeAlias} may not be used with the forms of
409
@code{Alias} taking more than one argument.
410
 
411
@item Ignore
412
This option is ignored apart from printing any warning specified using
413
@code{Warn}.  The option will not be seen by specs and no @samp{OPT_}
414
enumeration value is defined for it.
415
 
416
@item SeparateAlias
417
For an option marked with @code{Joined}, @code{Separate} and
418
@code{Alias}, the option only acts as an alias when passed a separate
419
argument; with a joined argument it acts as a normal option, with an
420
@samp{OPT_} enumeration value.  This is for compatibility with the
421
Java @option{-d} option and should not be used for new options.
422
 
423
@item Warn(@var{message})
424
If this option is used, output the warning @var{message}.
425
@var{message} is a format string, either taking a single operand with
426
a @samp{%qs} format which is the option name, or not taking any
427
operands, which is passed to the @samp{warning} function.  If an alias
428
is marked @code{Warn}, the target of the alias must not also be marked
429
@code{Warn}.
430
 
431
@item Report
432
The state of the option should be printed by @option{-fverbose-asm}.
433
 
434
@item Warning
435
This is a warning option and should be shown as such in
436
@option{--help} output.  This flag does not currently affect anything
437
other than @option{--help}.
438
 
439
@item Optimization
440
This is an optimization option.  It should be shown as such in
441
@option{--help} output, and any associated variable named using
442
@code{Var} should be saved and restored when the optimization level is
443
changed with @code{optimize} attributes.
444
 
445
@item Undocumented
446
The option is deliberately missing documentation and should not
447
be included in the @option{--help} output.
448
 
449
@item Condition(@var{cond})
450
The option should only be accepted if preprocessor condition
451
@var{cond} is true.  Note that any C declarations associated with the
452
option will be present even if @var{cond} is false; @var{cond} simply
453
controls whether the option is accepted and whether it is printed in
454
the @option{--help} output.
455
 
456
@item Save
457
Build the @code{cl_target_option} structure to hold a copy of the
458
option, add the functions @code{cl_target_option_save} and
459
@code{cl_target_option_restore} to save and restore the options.
460
 
461
@item SetByCombined
462
The option may also be set by a combined option such as
463
@option{-ffast-math}.  This causes the @code{gcc_options} struct to
464
have a field @code{frontend_set_@var{name}}, where @code{@var{name}}
465
is the name of the field holding the value of this option (without the
466
leading @code{x_}).  This gives the front end a way to indicate that
467
the value has been set explicitly and should not be changed by the
468
combined option.  For example, some front ends use this to prevent
469
@option{-ffast-math} and @option{-fno-fast-math} from changing the
470
value of @option{-fmath-errno} for languages that do not use
471
@code{errno}.
472
 
473
@end table

powered by: WebSVN 2.1.0

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