Next: Search Paths and the Run-Time Library (RTL), Previous: Compiling Programs, Up: Compiling with gcc
The gcc command accepts switches that control the compilation process. These switches are fully described in this section. First we briefly list all the switches, in alphabetical order, then we describe the switches in more detail in functionally grouped sections.
More switches exist for GCC than those documented here, especially for specific targets. However, their use is not recommended as they may change code generation in ways that are incompatible with the Ada run-time library, or can cause inconsistencies between compilation units.
gnat1
, the Ada compiler)
from dir instead of the default location. Only use this switch
when multiple versions of the GNAT compiler are available.
See Options for Directory Search, for further details. You would normally
use the -b or -V switch instead.
Note: for some other languages when using gcc, notably in
the case of C and C++, it is possible to use
use gcc without a -c switch to
compile and link in one step. In the case of GNAT, you
cannot use this approach, because the binder must be run
and gcc cannot be used to run the GNAT binder.
Inline_Always
.
Any occurrences of pragma Inline
or Inline_Always
are ignored, and -gnatn and -gnatN have no
effects if this switch is present. Note that inlining can also
be suppressed on a finer-grained basis with pragma No_Inline
.
Pragma Assert
and pragma Debug
to be
activated. Note that these pragmas can also be controlled using the
configuration pragmas Assertion_Policy
and Debug_Policy
.
It also activates pragmas Check
, Precondition
, and
Postcondition
. Note that these pragmas can also be controlled
using the configuration pragma Check_Policy
. In Ada 2012, it
also activates all assertions defined in the RM as aspects: preconditions,
postconditions, type invariants and (sub)type predicates. In all Ada modes,
corresponding pragmas for type invariants and (sub)type predicates are
also activated.
-gnatR
switch has been given, since -gnatR
requires that the code generator
be called to complete determination of representation information.
Check_Float_Overflow
in GNAT RM.
pragma Elaborate
and pragma Elaborate_All
are generated. This is useful in diagnosing elaboration circularities
caused by these implicit pragmas when using the static elaboration
model. See See the section in this guide on elaboration checking for
further details. These messages are not generated by default, and are
intended only for temporary use when debugging circularity problems.
The following target dependent values should be defined,
where Nat
denotes a natural integer value, Pos
denotes a
positive integer value, and fields marked with a question mark are
boolean fields, where a value of 0 is False, and a value of 1 is True:
Bits_BE : Nat; -- Bits stored big-endian? Bits_Per_Unit : Pos; -- Bits in a storage unit Bits_Per_Word : Pos; -- Bits in a word Bytes_BE : Nat; -- Bytes stored big-endian? Char_Size : Pos; -- Standard.Character'Size Double_Float_Alignment : Nat; -- Alignment of double float Double_Scalar_Alignment : Nat; -- Alignment of double length scalar Double_Size : Pos; -- Standard.Long_Float'Size Float_Size : Pos; -- Standard.Float'Size Float_Words_BE : Nat; -- Float words stored big-endian? Int_Size : Pos; -- Standard.Integer'Size Long_Double_Size : Pos; -- Standard.Long_Long_Float'Size Long_Long_Size : Pos; -- Standard.Long_Long_Integer'Size Long_Size : Pos; -- Standard.Long_Integer'Size Maximum_Alignment : Pos; -- Maximum permitted alignment Max_Unaligned_Field : Pos; -- Maximum size for unaligned bit field Pointer_Size : Pos; -- System.Address'Size Short_Enums : Nat; -- Short foreign convention enums? Short_Size : Pos; -- Standard.Short_Integer'Size Strict_Alignment : Nat; -- Strict alignment? System_Allocator_Alignment : Nat; -- Alignment for malloc calls Wchar_T_Size : Pos; -- Interfaces.C.wchar_t'Size Words_BE : Nat; -- Words stored big-endian?
The format of the input file is as follows. First come the values of the variables defined above, with one line per value:
name value
where name
is the name of the parameter, spelled out in full,
and cased as in the above list, and value
is an unsigned decimal
integer. Two or more blanks separates the name from the value.
All the variables must be present, in alphabetical order (i.e. the same order as the list above).
Then there is a blank line to separate the two parts of the file. Then come the lines showing the floating-point types to be registered, with one line per registered mode:
name digs float_rep size alignment
where name
is the string name of the type (which can have
single spaces embedded in the name (e.g. long double), digs
is
the number of digits for the floating-point type, float_rep
is
the float representation (I/V/A for IEEE-754-Binary, Vax_Native,
AAMP), size
is the size in bits, alignment
is the
alignment in bits. The name is followed by at least two blanks, fields
are separated by at least one blank, and a LF character immediately
follows the alignment field.
Here is an example of a target parameterization file:
Bits_BE 0 Bits_Per_Unit 8 Bits_Per_Word 64 Bytes_BE 0 Char_Size 8 Double_Float_Alignment 0 Double_Scalar_Alignment 0 Double_Size 64 Float_Size 32 Float_Words_BE 0 Int_Size 64 Long_Double_Size 128 Long_Long_Size 64 Long_Size 64 Maximum_Alignment 16 Max_Unaligned_Field 64 Pointer_Size 64 Short_Size 16 Strict_Alignment 0 System_Allocator_Alignment 16 Wchar_T_Size 32 Words_BE 0 float 15 I 64 64 double 15 I 64 64 long double 18 I 80 128 TF 33 I 128 128
k
= krunch).
Inline
is
specified. This inlining is performed by the GCC back-end. An optional
digit sets the inlining level: 1 for moderate inlining across modules
or 2 for full inlining across modules. If no inlining level is specified,
the compiler will pick it based on the optimization level.
Inline
is specified. This inlining is performed
by the front end and will be visible in the
-gnatG output.
When using a gcc-based back end (in practice this means using any version
of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
-gnatN is deprecated, and the use of -gnatn is preferred.
Historically front end inlining was more extensive than the gcc back end
inlining, but that is no longer the case.
??
' is two digits, a
single digit, or nothing. Each digit is one of the digits `1
'
through `3
':
1
:
all intermediate overflows checked against base type (STRICT
)
2
:
minimize intermediate overflows (MINIMIZED
)
3
:
eliminate intermediate overflows (ELIMINATED
)
If only one digit appears then it applies to all cases; if two digits are given, then the first applies outside assertions, and the second within assertions.
If no digits follow the -gnato, then it is equivalent to -gnato11, causing all intermediate overflows to be handled in strict mode.
This switch also causes arithmetic overflow checking to be performed
(as though pragma Unsuppress (Overflow_Mode)
has been specified.
The default if no option -gnato is given is that overflow handling
is in STRICT
mode (computations done using the base type), and that
overflow checking is suppressed.
Note that division by zero is a separate check that is not controlled by this switch (division by zero checking is on by default).
See also Specifying the Desired Mode.
-gnatD
switch has
been given, since these two switches are not compatible. It is also not allowed
if a previous -gnatc
switch has been given, since we must be generating
code to be able to determine representation information.
-gnatc
.
case
statements.
This may result in less efficient code, but is sometimes necessary
(for example on HP-UX targets)
in order to compile large and/or nested case
statements.
See also Optimization Levels.
You may combine a sequence of GNAT switches into a single switch. For example, the combined switch
-gnatofi3
is equivalent to specifying the following sequence of switches:
-gnato -gnatf -gnati3
The following restrictions apply to the combination of switches in this manner:
-gnatzc and -gnatzr may not be combined with any other switches, and only one of them may appear in the command line.