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.
SCOsin the compiler sources for details in files
Note: for compatibility with some Ada 95 compilers which support only the overriding keyword of Ada 2005, the `-gnatd.D' switch can be used along with `-gnat95' to achieve a similar effect with GNAT.
`-gnatd.D' instructs GNAT to consider overriding as a keyword and handle its associated semantic checks, even in Ada 95 mode.
gnat.adc. If a
gnat.adcfile is present, it will be ignored.
stderreven if verbose mode set.
.scilfiles). This switch is not compatible with code generation (it will, among other things, disable some switches such as -gnatn, and enable others such as -gnata).
debug.adbfor details of the implemented debug options. Certain debug options are relevant to applications programmers, and these are documented at appropriate points in this users guide.
type Rec_Typ is record Data : Integer := 0; end record; function Self (Val : Rec_Typ) return Rec_Typ is begin return Val; end Self; procedure Detect_Aliasing (Val_1 : in out Rec_Typ; Val_2 : Rec_Typ) is begin null; end Detect_Aliasing; Obj : Rec_Typ; Detect_Aliasing (Obj, Obj); Detect_Aliasing (Obj, Self (Obj));
In the example above, the first call to Detect_Aliasing fails with a Program_Error at runtime because the actuals for Val_1 and Val_2 denote the same object. The second call executes without raising an exception because Self(Obj) produces an anonymous object which does not share the memory location of Obj.
The -gnatc switch must always be specified before this switch, e.g. -gnatceg. Generate a C header from the Ada input file. See Generating C Headers for Ada Specifications for more information.
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:
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
Note that when -gnatct is used to generate trees for input into ASIS tools, these representation clauses are removed from the tree and ignored. This means that the tool will not see them.
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.
All intermediate overflows checked against base type (STRICT)
Minimize intermediate overflows (MINIMIZED)
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, pre/postconditions, and type invariants, and the second applies within assertions, pre/postconditions, and type invariants.
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) had 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 enabled.
Note that division by zero is a separate check that is not controlled by this switch (divide-by-zero checking is on by default).
See also Specifying the Desired Mode.
ALIand tree files even if illegalities. Note that code generation is still suppressed in the presence of any errors, so even with `-gnatQ' no object file is generated.
No optimization, the default setting if no `-O' appears
Normal optimization, the default if you specify `-O' without an operand. A good compromise between code quality and compilation time.
Extensive optimization, may improve execution time, possibly at the cost of substantially increased compilation time.
Same as `-O2', and also includes inline expansion for small subprograms in the same unit.
Optimize space usage
See also Optimization Levels.
.sas the extension, instead of the object file. This may be useful if you need to examine the generated assembly code.
You may combine a sequence of GNAT switches into a single switch. For example, the combined switch
is equivalent to specifying the following sequence of switches:
-gnato -gnatf -gnati3
The following restrictions apply to the combination of switches in this manner: