www.delorie.com/gnu/docs/gcc/gnat_ug_40.html   search  
 
Buy the book!


Untitled Document

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Switches for 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.

3.2.1 Output and Error Message Control  
3.2.2 Debugging and Assertion Control  
3.2.5 Run-Time Checks  
3.2.6 Stack Overflow Checking  
3.2.7 Run-Time Control  
3.2.3 Validity Checking  
3.2.4 Style Checking  
3.2.8 Using gcc for Syntax Checking  
3.2.9 Using gcc for Semantic Checking  
3.2.10 Compiling Ada 83 Programs  
3.2.11 Character Set Control  
3.2.12 File Naming Control  
3.2.13 Subprogram Inlining Control  
3.2.14 Auxiliary Output Control  
3.2.15 Debugging Control  
3.2.16 Units to Sources Mapping Files  

-b target
Compile your program to run on target, which is the name of a system configuration. You must have a GNAT cross-compiler built if target is not the same as your host system.

-Bdir
Load compiler executables (for example, 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 the gcc manual page for further details. You would normally use the -b or -V switch instead.

-c
Compile. Always use this switch when compiling Ada programs.

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.

^-g^/DEBUG^
Generate debugging information. This information is stored in the object file and copied from there to the final executable file by the linker, where it can be read by the debugger. You must use the ^-g^/DEBUG^ switch if you plan on using the debugger.

^-I^/SEARCH=^dir
Direct GNAT to search the dir directory for source files needed by the current compilation (see section 3.3 Search Paths and the Run-Time Library (RTL)).

^-I-^/NOCURRENT_DIRECTORY^
Except for the source file named in the command line, do not look for source files in the directory containing the source file named in the command line (see section 3.3 Search Paths and the Run-Time Library (RTL)).

-o file
This switch is used in gcc to redirect the generated object file and its associated ALI file. Beware of this switch with GNAT, because it may cause the object file and ALI file to have different names which in turn may confuse the binder and the linker.

-O[n]
n controls the optimization level.

n = 0
No optimization, the default setting if no -O appears

n = 1
Normal optimization, the default if you specify -O without an operand.

n = 2
Extensive optimization

n = 3
Extensive optimization with automatic inlining. This applies only to inlining within a unit. For details on control of inter-unit inlining see See section 3.2.13 Subprogram Inlining Control.

--RTS=rts-path
Specifies the default location of the runtime library. Same meaning as the equivalent gnatmake flag (see 6.2 Switches for gnatmake).

^-S^/ASM^
^Used in place of -c to^Used to^ cause the assembler source file to be generated, using `^.s^.S^' as the extension, instead of the object file. This may be useful if you need to examine the generated assembly code.

^-v^/VERBOSE^
Show commands generated by the gcc driver. Normally used only for debugging purposes or if you need to be sure what version of the compiler you are executing.

-V ver
Execute ver version of the compiler. This is the gcc version, not the GNAT version.

-gnata
Assertions enabled. Pragma Assert and pragma Debug to be activated.

-gnatA
Avoid processing `gnat.adc'. If a gnat.adc file is present, it will be ignored.

-gnatb
Generate brief messages to `stderr' even if verbose mode set.

-gnatc
Check syntax and semantics only (no code generation attempted).

-gnatC
Compress debug information and external symbol name table entries.

-gnatD
Output expanded source files for source level debugging. This switch also suppress generation of cross-reference information (see -gnatx).

-gnatecpath
Specify a configuration pragma file. (see 8.2 The Configuration Pragmas Files)

-gnatempath
Specify a mapping file. (see 3.2.16 Units to Sources Mapping Files)

-gnatE
Full dynamic elaboration checks.

-gnatf
Full errors. Multiple errors per line, all undefined references.

-gnatF
Externals names are folded to all uppercase.

-gnatg
Internal GNAT implementation mode. This should not be used for applications programs, it is intended only for use by the compiler and its run-time library. For documentation, see the GNAT sources.

-gnatG
List generated expanded code in source form.

^-gnati^/IDENTIFIER_CHARACTER_SET=^c
Identifier character set (c=1/2/3/4/8/9/p/f/n/w).

^-gnath^/HELP^
Output usage information. The output is written to `stdout'.

^-gnatk^/FILE_NAME_MAX_LENGTH=^n
Limit file names to n (1-999) characters ^(k = krunch)^^.

-gnatl
Output full source listing with embedded error messages.

-gnatm^^=^n
Limit number of detected errors to n (1-999).

-gnatn
Activate inlining across unit boundaries for subprograms for which pragma inline is specified.

-gnatN
Activate front end inlining.

^-fno-inline^/INLINE=SUPPRESS^
Suppresses all inlining, even if other optimization or inlining switches are set.

-fstack-check
Activates stack checking. See separate section on stack checking for details of the use of this option.

-gnato
Enable numeric overflow checking (which is not normally enabled by default). Not that division by zero is a separate check that is not controlled by this switch (division by zero checking is on by default).

-gnatp
Suppress all checks.

-gnatq
Don't quit; try semantics, even if parse errors.

-gnatQ
Don't quit; generate `ali' and tree files even if illegalities.

-gnatP
Enable polling. This is required on some systems (notably Windows NT) to obtain asynchronous abort and asynchronous transfer of control capability. See the description of pragma Polling in the GNAT Reference Manual for full details.

-gnatR[0/1/2/3][s]
Output representation information for declared types and objects.

-gnats
Syntax check only.

-gnatt
Tree output file to be generated.

-gnatT nnn
Set time slice to specified number of microseconds

-gnatu
List units for this compilation.

-gnatU
Tag all error messages with the unique string "error:"

-gnatv
Verbose mode. Full error output with source lines to `stdout'.

-gnatV
Control level of validity checking. See separate section describing this feature.

^-gnatwxxx^/WARNINGS=^xxx
Warning mode where xxx is a string of options describing the exact warnings that are enabled or disabled. See separate section on warning control.

^-gnatW^/WIDE_CHARACTER_ENCODING=^e
Wide character encoding method (e=n/h/u/s/e/8).

-gnatx
Suppress generation of cross-reference information.

^-gnaty^/STYLE_CHECKS=(option,option..)^
Enable built-in style checks. See separate section describing this feature.

^-gnatz^/DISTRIBUTION_STUBS=^m
Distribution stub generation and compilation (m=r/c for receiver/caller stubs).

-gnat83
Enforce Ada 83 restrictions.

-pass-exit-codes
Catch exit codes from the compiler and use the most meaningful as exit status.

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:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003