This part of the documentation is a modified version of the
Command-Line Options
section of the GCC Manual.
Therefore it is licensed under the
GNU Free Documentation License.
This section describes the options supported by gcc
,
the driver program of the GNU Compiler Collection, whose C compiler
and assembler are used here. This program is called either by
tigcc
or by the IDE. tigcc
simulates some of these options itself, namely '-E',
'-S', and '-c', and it also has some additional ones.
In the IDE, there is an item in the project settings where you can
set the options described here, with some exceptions, including the
switches mentioned above.
GCC4TI normally does preprocessing, compilation, assembly and linking
all in one step, and finally produces a file which is executable on
the calculator. The "overall options" allow you to stop this
process at an intermediate stage. For example, the '-c' option
says not to run the linker. Then the output consists of object files
output by the assembler.
Other options are passed on to one stage of processing. Some options
control the preprocessor and others the compiler itself. Yet other
options control the assembler and linker; most of these are not
documented here, since you rarely need to use any of them.
In fact, only those options which may be more or less useful with GCC4TI
are mentioned here (although we didn't check whether all of them are
really usable in GCC4TI). For more info about standard options that are
recognized by the compiler, read the
official manual.
We suggest that you use the '-O2' switch in all of your
compilations; it increases speed and decreases the program size at the
cost of compilation time.
tigcc
accepts options and file names as operands. Many
options have multi-letter names; therefore multiple single-letter options
may not be grouped: '-dr' is very different from '-d
-r'.
You can mix options and other arguments. For the most part, the order
you use doesn't matter. Order does matter when you use several options
of the same kind; for example, if you specify '-L' more than once,
the directories are searched in the order specified.
Many options have long names starting with '-f' or with
'-W' - for example, '-fforce-mem',
'-fstrength-reduce', '-Wformat' and so on. Most of
these have both positive and negative forms; the negative form of
'-ffoo' would be '-fno-foo'. This manual documents
only one of these two forms, whichever one is not the default.
Original author: Free Software Foundation, Inc.
Authors of the modifications: Zeljko Juric, Sebastian Reichelt, and Kevin Kofler.
Published by the TIGCC Team, and now the GCC4TI project.
See the History section for details and copyright information.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or any
later version published by the Free Software Foundation; with the Invariant
Sections being "GNU General Public License" and "Funding Free Software", the
Front-Cover texts being (a) (see below), and with the Back-Cover Texts being
(b) (see below). A copy of the license is included in the section entitled
"GNU Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software.
Copies published by the Free Software Foundation raise funds for GNU
development.
These options apply only to the command line compiler. If you want to use
the IDE instead, you do not need to worry about these topics.
tigcc
has an important difference to the standard program
gcc
: tigcc
always overwrites assembly or
object files. For example, if a file test.c
is compiled, the
files test.s
and test.o
will be created and
overwritten if necessary, but they will automatically be deleted again if
neither '-c' nor '-S' are specified.
Another important difference is that tigcc
always looks for
libraries in the 'Lib'
subfolder of the installation.
-pack varname
Compress the file generated during compilation.
varname is the name of the on-calc packed variable. Although
varname cannot have an extension, the variable on the calculator will
always have the extension ppg
. varname cannot be the
same as the on-calc name of the program itself. When you use this switch,
two files will be created; one with the extension .89y
or
.9xy
, and one .89z
or .9xz
file.
This option comes from
Thomas Nussbaumer's
TI-68k Developer Utilities (now built in GCC4TI), where this feature is called
"ExePack Technology." You can read about it on the official
TI-Chess Team site.
-q
Keep as quiet as possible while assembling and linking. This option is not needed by the compiler because it is always quiet, but the linker and especially the assembler output some information.
-v0
This switch is an addition to the '-v' switch. It tells GCC4TI to output only the commands that are run directly. This was the default in some previous releases.
-g
The '-g' switch in GCC turns on debugging information in the preferred format for the target. In GCC4TI, this is DWARF 2, which can be used with a GDB-enabled TiEmu.
-standalone
Do not link against tigcc.a
. All of GCC's internal
functions are implemented in this library, as well as all non-TIOS functions.
Using one of these will result in an error from the linker.
-ar
Create an archive (a static library) instead of a program. The resulting
file will have an .a
ending.
-bsr
This option is ignored for compatibility.
In addition to these options, the tigcc
program also accepts
most of the linker options.
Compilation can involve up to four stages: preprocessing, compilation
proper, assembly and linking, always in that order. The first three
stages apply to an individual source file, and end by producing an
object file; linking combines all the object files (those newly
compiled, and those specified as input) into an executable file.
For any given input file, the file name suffix determines what kind of
compilation is done (some of these apply only to TIGCC/GCC4TI):
file.c
C source code which must be preprocessed.
file.s
GNU Assembler code.
file.S
GNU Assembler code which must be preprocessed.
file.asm
A68k Assembler code.
file.o
COFF object file to be linked using ld
.
file.a
Static library (function archive) to be linked using ld
.
You can specify the input language explicitly with the '-x' option:
-x language
Specify explicitly the language for the following input files
(rather than letting the compiler choose a default based on the file
name suffix). This option applies to all following input files until
the next '-x' option. Possible values for language are:
c c-header cpp-output
c++ c++-cpp-output
objective-c objc-cpp-output
assembler assembler-with-cpp
ada
f77 f77-cpp-input ratfor
java
treelang
-x none
Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if '-x' has not been used at all).
-pass-exit-codes
Normally the gcc
program will exit with the code of 1 if any
phase of the compiler returns a non-success return code. If you specify
'-pass-exit-codes', the gcc
program will instead return with
numerically highest error produced by any phase that returned an error
indication.
If you only want some of the stages of compilation, you can use
'-x' (or filename suffixes) to tell gcc
where to start, and
one of the options '-c', '-S', or '-E' to say where
gcc
is to stop. Note that some combinations (for example,
'-x cpp-output -E') instruct gcc
to do nothing at all.
-c
Compile or assemble the source files, but do not link. The linking
stage simply is not done. The ultimate output is in the form of an
object file for each source file.
By default, the object file name for a source file is made by replacing
the suffix .c
, .i
, .s
, etc., with .o
.
Unrecognized input files, not requiring compilation or assembly, are
ignored.
-S
Stop after the stage of compilation proper; do not assemble. The output
is in the form of an assembler code file for each non-assembler input
file specified.
By default, the assembler file name for a source file is made by
replacing the suffix .c
, .i
, etc., with .s
.
Input files that don't require compilation are ignored.
-E
Stop after the preprocessing stage; do not run the compiler proper. The
output is in the form of preprocessed source code, which is sent to the
standard output.
Input files which don't require preprocessing are ignored.
-o file
Place output in file file. This applies regardless to whatever
sort of output is being produced, whether it be an executable file,
an object file, an assembler file or preprocessed C code.
Since only one output file can be specified, it does not make sense to
use '-o' when compiling more than one input file, unless you are
producing an executable file as output.
If '-o' is not specified, the default is to put an executable file
in a.out
, the object file for source.suffix
in
source.o
, its assembler file in source.s
, and
all preprocessed C source on standard output.
-v
Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper.
-###
Like '-v' except the commands are not executed and all command arguments are quoted. This is useful for shell scripts to capture the driver-generated command lines.
-pipe
Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble.
--help
Print (on the standard output) a description of the command line options
understood by gcc
. If the '-v' option is also specified
then '--help' will also be passed on to the various processes
invoked by gcc
, so that they can display the command line options
they accept. If the '-W' option is also specified then command
line options which have no documentation associated with them will also
be displayed.
--target-help
Print (on the standard output) a description of target specific command line options for each tool.
--version
Display the version number and copyrights of the invoked GCC.
The following options control the dialect of C that the compiler accepts:
-ansi
Support all ISO C89 programs.
This turns off certain features of GCC that are incompatible with ISO C89,
such as the asm
and typeof
keywords, and
some predefined macros that identify the
type of system you are using. It also enables the undesirable and
rarely used ISO trigraph feature, and disables recognition of C++ style
//
comments as well as the inline
keyword.
The alternate keywords __asm__
, __extension__
,
__inline__
and __typeof__
continue to work despite
'-ansi'. You would not want to use them in an ISO C program, of
course, but it is useful to put them in header files that might be included
in compilations done with '-ansi'. Alternate predefined macros
such as __unix__
are also available, with or
without '-ansi'.
The '-ansi' option does not cause non-ISO programs to be
rejected gratuitously. For that, '-pedantic' is required in
addition to '-ansi'. See Warning Options.
The macro __STRICT_ANSI__
is predefined when the '-ansi'
option is used. Some header files may notice this macro and refrain
from declaring certain functions or defining certain macros that the
ISO standard doesn't call for; this is to avoid interfering with any
programs that might use these names for other things.
Functions which would normally be built in but do not have semantics
defined by ISO C (such as alloca) are not built-in
functions with '-ansi' is used. See Other
built-in functions provided by GCC for details of the functions
affected.
Note: At the moment, the GCC4TI library depends heavily on GNU C extensions,
so you cannot use the '-ansi' switch in GCC4TI.
-std=standard
Determine the language standard. A value for standard must be provided; provided; possible values are
c89
iso9899:1990
ISO C90 (same as '-ansi').
iso9899:199409
ISO C90 as modified in amendment 1.
c99
c9x
iso9899:1999
iso9899:199x
ISO C99. Note that this standard is not yet fully supported; see
http://gcc.gnu.org/gcc-3.3/c99status.html for more information. The
names c9x
and iso9899:199x
are deprecated.
gnu89
Default, ISO C90 plus GNU extensions (including some C99 features).
gnu99
gnu9x
ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
this will become the default. The name gnu9x
is deprecated.
Even when this option is not specified, you can still use some of the
features of newer standards in so far as they do not conflict with
previous C standards. For example, you may use __restrict__
even
when '-std=c99' is not specified.
The '-std' options specifying some version of ISO C have the same
effects as '-ansi', except that features that were not in ISO C90
but are in the specified version (for example, //
comments and
the inline
keyword in ISO C99) are not disabled.
-aux-info filename
Output to the given filename prototyped declarations for all functions
declared and/or defined in a translation unit, including those in header
files. This option is silently ignored in any language other than C.
Besides declarations, the file indicates, in comments, the origin of
each declaration (source file and line), whether the declaration was
implicit, prototyped or unprototyped (I
, N
for new or
O
for old, respectively, in the first character after the line
number and the colon), and whether it came from a declaration or a
definition (C
or F
, respectively, in the following
character). In the case of function definitions, a K&R-style list of
arguments followed by their declarations is also provided, inside
comments, after the declaration.
-fno-asm
Do not recognize asm
, inline
or typeof
as a
keyword, so that code can use these words as identifiers. You can use
the keywords __asm__
, __inline__
and __typeof__
instead. '-ansi' implies '-fno-asm'.
-fno-builtin
-fno-builtin-function
Don't recognize built-in functions that do not begin with
__builtin_
as prefix. See Other built-in
functions provided by GCC for details of the functions affected,
including those which are not built-in functions when '-ansi' or
'-std' options for strict ISO C conformance are used because they
do not have an ISO standard meaning.
GCC normally generates special code to handle certain built-in functions
more efficiently; for instance, calls to alloca may become single
instructions that adjust the stack directly. The resulting code is often both smaller
and faster, but since the function calls no longer appear as such, you
cannot set a breakpoint on those calls, nor can you change the behavior
of the functions by linking with a different library.
With the '-fno-builtin-function' option,
only the built-in function function is
disabled. function must not begin with __builtin_
. If a
function is named this is not built-in in this version of GCC, this
option is ignored. There is no corresponding
'-fbuiltin-function' option; if you wish to enable
built-in functions selectively when using '-fno-builtin' or
'-ffreestanding', you may define macros such as:
#define abs(n) __builtin_abs ((n)) #define strcpy(d, s) __builtin_strcpy ((d), (s))
-fhosted
Assert that compilation takes place in a hosted environment. This implies
'-fbuiltin'. A hosted environment is one in which the
entire standard library is available, and in which main
has a return
type of int
. Examples are nearly everything except a kernel.
This is equivalent to '-fno-freestanding'.
Although TI calculators are not really hosted environments, '-fhosted'
is kept as the default.
-ffreestanding
Assert that compilation takes place in a freestanding environment. This
implies '-fno-builtin'. A freestanding environment
is one in which the standard library may not exist, and program startup may
not necessarily be at main
. The most obvious example is an OS kernel.
This is equivalent to '-fno-hosted'.
-fms-extensions
Accept some non-standard constructs used in Microsoft header files.
-trigraphs
Support ISO C trigraphs. The '-ansi' option (and '-std' options for strict ISO C conformance) implies '-trigraphs'. See Options Controlling the Preprocessor for more information.
-no-integrated-cpp
Performs a compilation in two passes: preprocessing and compiling. This
option allows a user supplied "cc1" via the
'-B' option. The user supplied compilation step can then add in
an additional preprocessing step after normal preprocessing but before
compiling. The default is to use the integrated preprocessor.
The semantics of this option will change if "cc1", "cc1plus", and
"cc1obj" are merged.
-traditional
-traditional-cpp
Formerly, these options caused GCC to attempt to emulate a pre-standard C compiler. They are now only supported with the '-E' switch. The preprocessor continues to support a pre-standard mode.
-fcond-mismatch
Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void.
-funsigned-char
Let the type char
be unsigned, like unsigned char
.
In GCC4TI, the default is signed char
.
Ideally, a portable program should always use signed char
or
unsigned char
when it depends on the signedness of an object.
But many programs have been written to use plain char
and
expect it to be signed, or expect it to be unsigned, depending on the
machines they were written for. This option, and its inverse, let you
make such a program work with the opposite default.
The type char
is always a distinct type from each of
signed char
or unsigned char
, even though its behavior
is always just like one of those two.
-fsigned-char
Let the type char
be signed, like signed char
.
Note that this is equivalent to '-fno-unsigned-char', which is
the negative form of '-funsigned-char'. Likewise, the option
'-fno-signed-char' is equivalent to '-funsigned-char'.
-fsigned-bitfields
-funsigned-bitfields
-fno-signed-bitfields
-fno-unsigned-bitfields
These options control whether a bit-field is signed or unsigned, when the
declaration does not use either signed
or unsigned
. By
default, such a bit-field is signed, because this is consistent: the
basic integer types such as int
are signed types.
-fwritable-strings
Store string constants in the writable data segment and don't uniquize
them. This is for compatibility with old programs which assume they can
write into string constants.
Writing into string constants is a very bad idea; "constants" should
be constant.
Warnings are diagnostic messages that report constructions which
are not inherently erroneous but which are risky or suggest there
may have been an error.
You can request many specific warnings with options beginning '-W',
for example '-Wimplicit' to request warnings on implicit
declarations. Each of these specific warning options also has a
negative form beginning '-Wno-' to turn off warnings;
for example, '-Wno-implicit'. This manual lists only one of the
two forms, whichever is not the default.
The following options control the amount and kinds of warnings produced
by GCC.
-fsyntax-only
Check the code for syntax errors, but don't do anything beyond that.
-pedantic
Issue all the warnings demanded by strict ISO C;
reject all programs that use forbidden extensions, and some other
programs that do not follow ISO C. This option follows the
version of the ISO C standard specified by any '-std' option used.
Valid ISO C programs should compile properly with or without
this option (though a rare few will require '-ansi' or a
'-std' option specifying the required version of ISO C). However,
without this option, certain GNU extensions and traditional C
features are supported as well. With this option, they are rejected.
'-pedantic' does not cause warning messages for use of the
alternate keywords whose names begin and end with __
. Pedantic
warnings are also disabled in the expression that follows
__extension__
. However, only system header files should use
these escape routes; application programs should avoid them.
See Alternate Keywords.
Some users try to use '-pedantic' to check programs for strict ISO
C conformance. They soon find that it does not do quite what they want:
it finds some non-ISO practices, but not all - only those for which
ISO C requires a diagnostic, and some others for which
diagnostics have been added.
A feature to report any failure to conform to ISO C might be useful in
some instances, but would require considerable additional work and would
be quite different from '-pedantic'. The GNU team doesn't have plans to
support such a feature in the near future.
Where the standard specified with '-std' represents a GNU
extended dialect of C, such as gnu89
or gnu99
, there is a
corresponding base standard, the version of ISO C on which the GNU
extended dialect is based. Warnings from '-pedantic' are given
where they are required by the base standard. (It would not make sense
for such warnings to be given only for features not in the specified GNU
C dialect, since by definition the GNU dialects of C include all
features the compiler supports with the given option, and there would be
nothing to warn about.)
-pedantic-errors
Like '-pedantic', except that errors are produced rather than warnings.
-w
Inhibit all warning messages.
-Wno-import
Inhibit warning messages about the use of #import
.
-Wchar-subscripts
Warn if an array subscript has type char
. This is a common cause
of error, as programmers often forget that this type is signed on some
machines.
-Wcomment
Warn whenever a comment-start sequence /*
appears in a /*
comment, or whenever a Backslash-Newline appears in a //
comment.
-Wformat
Check calls to printf and scanf, etc., to make sure that
the arguments supplied have types appropriate to the format string
specified, and that the conversions specified in the format string make
sense. This includes standard functions, and others specified by format
attributes (see format).
Since '-Wformat' also checks for null format arguments for
several functions, '-Wformat' also implies '-Wnonnull'.
'-Wformat' is included in '-Wall'. For more control over some
aspects of format checking, the options
'-Wno-format-extra-args', '-Wno-format-zero-length',
'-Wformat-nonliteral', '-Wformat-security', and
'-Wformat=2' are available, but are not included in '-Wall'.
-Wno-format-extra-args
If '-Wformat' is specified, do not warn about excess arguments to a printf or scanf format function. The C standard specifies that such arguments are ignored.
-Wno-format-zero-length
If '-Wformat' is specified, do not warn about zero-length formats. The C standard specifies that zero-length formats are allowed.
-Wformat-nonliteral
If '-Wformat' is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a va_list.
-Wformat-security
If '-Wformat' is specified, also warn about uses of format
functions that represent possible security problems. At present, this
warns about calls to printf and scanf functions where the
format string is not a string literal and there are no format arguments,
as in printf (foo);
. This may be a security hole if the format
string came from untrusted input and contains %n
. (This is
currently a subset of what '-Wformat-nonliteral' warns about, but
in future warnings may be added to '-Wformat-security' that are not
included in '-Wformat-nonliteral'.)
-Wformat=2
Enable '-Wformat' plus format checks not included in '-Wformat'. Currently equivalent to '-Wformat -Wformat-nonliteral -Wformat-security'.
-Wnonnull
Enable warning about passing a null pointer for arguments marked as
requiring a non-null value by the nonnull
function attribute.
'-Wnonnull' is included in '-Wall' and '-Wformat'. It
can be disabled with the '-Wno-nonnull' option.
-Wimplicit-int
Warn when a declaration does not specify a type.
-Wimplicit-function-declaration
-Werror-implicit-function-declaration
Give a warning (or error) whenever a function is used before being declared.
-Wimplicit
Same as '-Wimplicit-int -Wimplicit-function-declaration'.
-Wmissing-braces
Warn if an aggregate or union initializer is not fully bracketed. In
the following example, the initializer for a
is not fully
bracketed, but that for b
is fully bracketed.
int a[2][2] = { 0, 1, 2, 3 }; int b[2][2] = { { 0, 1 }, { 2, 3 } };
-Wparentheses
Warn if parentheses are omitted in certain contexts, such
as when there is an assignment in a context where a truth value
is expected, or when operators are nested whose precedence people
often get confused about.
Also warn about constructions where there may be confusion to which
if
statement an else
branch belongs. Here is an example of
such a case:
{ if (a) if (b) foo (); else bar (); }
In C, every else
branch belongs to the innermost possible if
statement, which in this example is if (b)
. This is often not
what the programmer expected, as illustrated in the above example by the
indentation the programmer chose. When there is the potential for this
confusion, GCC will issue a warning when this flag is specified.
To eliminate the warning, add explicit braces around the innermost
if
statement so there is no way the else
could belong to
the enclosing if
. The resulting code would look like this:
{ if (a) { if (b) foo (); else bar (); } }
-Wsequence-point
Warn about code that may have undefined semantics because of violations
of sequence point rules in the C standard.
The C standard defines the order in which expressions in a C program are
evaluated in terms of sequence points, which represent a partial
ordering between the execution of parts of the program: those executed
before the sequence point, and those executed after it. These occur
after the evaluation of a full expression (one which is not part of a
larger expression), after the evaluation of the first operand of a
&&
, ||
, ? :
or ,
(comma) operator, before a
function is called (but after the evaluation of its arguments and the
expression denoting the called function), and in certain other places.
Other than as expressed by the sequence point rules, the order of
evaluation of subexpressions of an expression is not specified. All
these rules describe only a partial order rather than a total order,
since, for example, if two functions are called within one expression
with no sequence point between them, the order in which the functions
are called is not specified. However, the standards committee have
ruled that function calls do not overlap.
It is not specified when between sequence points modifications to the
values of objects take effect. Programs whose behavior depends on this
have undefined behavior; the C standard specifies that "Between the
previous and next sequence point an object shall have its stored value
modified at most once by the evaluation of an expression. Furthermore,
the prior value shall be read only to determine the value to be
stored.". If a program breaks these rules, the results on any
particular implementation are entirely unpredictable.
Examples of code with undefined behavior are a = a++;
, a[n]
= b[n++]
and a[i++] = i;
. Some more complicated cases are not
diagnosed by this option, and it may give an occasional false positive
result, but in general it has been found fairly effective at detecting
this sort of problem in programs.
The C standard is worded confusingly, therefore there is some debate
over the precise meaning of the sequence point rules in subtle cases.
Links to discussions of the problem, including proposed formal
definitions, may be found on the GCC readings page, at
http://gcc.gnu.org/readings.html.
-Wreturn-type
Warn whenever a function is defined with a return-type that defaults to
int
. Also warn about any return
statement with no
return-value in a function whose return-type is not void
.
-Wswitch
Warn whenever a switch
statement has an index of enumeral type
and lacks a case
for one or more of the named codes of that
enumeration. (The presence of a default
label prevents this
warning.) case
labels outside the enumeration range also
provoke warnings when this option is used.
-Wswitch-default
Warn whenever a switch
statement does not have a default
case.
-Wswitch-enum
Warn whenever a switch
statement has an index of enumeral type
and lacks a case
for one or more of the named codes of that
enumeration. case
labels outside the enumeration range also
provoke warnings when this option is used.
-Wtrigraphs
Warn if any trigraphs are encountered that might change the meaning of the program (trigraphs within comments are not warned about). For more information about trigraphs, see Options Controlling the Preprocessor.
-Wunused-function
Warn whenever a static function is declared but not defined or a
non\-inline static function is unused.
To suppress this warning, use the unused
attribute.
-Wunused-label
Warn whenever a label is declared but not used.
To suppress this warning, use the unused
attribute.
-Wunused-parameter
Warn whenever a function parameter is unused aside from its declaration.
To suppress this warning, use the unused
attribute.
-Wunused-variable
Warn whenever a local variable or non-constant static variable is unused
aside from its declaration
To suppress this warning, use the unused
attribute.
-Wunused-value
Warn whenever a statement computes a result that is explicitly not used.
To suppress this warning, cast the expression to void
.
-Wunused
All the above '-Wunused' options combined.
In order to get a warning about an unused function parameter, you must
either specify '-W -Wunused' or separately specify
'-Wunused-parameter'.
-Wuninitialized
Warn if an automatic variable is used without first being initialized or
if a variable may be clobbered by a setjmp call
(I am not sure whether setjmp problems may be detected in GCC4TI).
These warnings are possible only in optimizing compilation,
because they require data flow information that is computed only
when optimizing. If you don't specify '-O', you simply won't
get these warnings.
These warnings occur only for variables that are candidates for
register allocation. Therefore, they do not occur for a variable that
is declared volatile
, or whose address is taken, or whose size
is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
structures, unions or arrays, even when they are in registers.
Note that there may be no warning about a variable that is used only
to compute a value that itself is never used, because such
computations may be deleted by data flow analysis before the warnings
are printed.
These warnings are made optional because GCC is not smart
enough to see all the reasons why the code might be correct
despite appearing to have an error. Here is one example of how
this can happen:
{ int x; switch (y) { case 1: x = 1; break; case 2: x = 4; break; case 3: x = 5; } foo (x); }
If the value of y is always 1, 2 or 3, then x is always initialized, but GCC doesn't know this. Here is another common case:
{ int save_y; if (change_y) save_y = y, y = new_y; ... if (change_y) y = save_y; }
This has no bug because save_y is used only if it is set.
This option also warns when a non-volatile automatic variable might be
changed by a call to longjmp. These warnings as well are possible
only in optimizing compilation
(although I am not sure whether they can be caught at all in GCC4TI).
The compiler sees only the calls to setjmp. It cannot know
where longjmp will be called; in fact, an interrupt handler could
call it at any point in the code. As a result, you may get a warning
even when there is in fact no problem because longjmp cannot
in fact be called at the place which would cause a problem.
Some spurious warnings can be avoided if you declare all the functions
you use that never return as noreturn.
-Wunknown-pragmas
Warn when a #pragma
directive is encountered which is not understood by
GCC. If this command line option is used, warnings will even be issued
for unknown pragmas in system header files. This is not the case if
the warnings were only enabled by the '-Wall' command line option.
-Wstrict-aliasing
This option is only active when '-fstrict-aliasing' is active. It warns about code which might break the strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in '-Wall'.
-Wall
All of the above '-W' options combined. This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros.
The following '-W...' options are not implied by '-Wall'. Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning.
-W
Print extra warning messages for these events:
A function can return either with or without a value. (Falling off the end of the function body is considered returning without a value.) For example, this function would evoke such a warning:
foo (a) { if (a > 0) return a; }
An expression-statement or the left-hand side of a comma expression
contains no side effects.
To suppress the warning, cast the unused expression to void.
For example, an expression such as x[i,j]
will cause a warning,
but x[(void)i,j]
will not.
An unsigned value is compared against zero with <
or <=
.
A comparison like x<=y<=z
appears; this is equivalent to
(x<=y ? 1 : 0) <= z
, which is a different interpretation from
that of ordinary mathematical notation.
Storage-class specifiers like static
are not the first things in
a declaration. According to the C Standard, this usage is obsolescent.
The return type of a function has a type qualifier such as const
.
Such a type qualifier has no effect, since the value returned by a
function is not an lvalue. (But don't warn about the GNU extension of
volatile void
return types. That extension will be warned about
if '-pedantic' is specified.)
If '-Wall' or '-Wunused' is also specified, warn about unused arguments.
A comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. (But don't warn if '-Wno-sign-compare' is also specified.)
An aggregate has a partly bracketed initializer. For example, the following code would evoke such a warning, because braces are missing around the initializer for x.h:
struct s { int f, g; }; struct t { struct s h; int i; }; struct t x = { 1, 2, 3 };
An aggregate has an initializer which does not initialize all members. For example, the following code would cause such a warning, because x.h would be implicitly initialized to zero:
struct s { int f, g, h; }; struct s x = { 3, 4 };
-Wno-div-by-zero
Do not warn about compile-time integer division by zero. Floating point division by zero is not warned about, as it can be a legitimate way of obtaining infinities and NaNs.
-Wsystem-headers
Print warning messages for constructs found in system header files.
Warnings from system headers are normally suppressed, on the assumption
that they usually do not indicate real problems and would only make the
compiler output harder to read. Using this command line option tells
GCC to emit warnings from system headers as if they occurred in user
code. However, note that using '-Wall' in conjunction with this
option will not warn about unknown pragmas in system
headers - for that, '-Wunknown-pragmas' must also be used.
Note that the GCC4TI Library header files are not included as system header
files.
-Wfloat-equal
Warn if floating point values are used in equality comparisons.
The idea behind this is that sometimes it is convenient (for the
programmer) to consider floating-point values as approximations to
infinitely precise real numbers. If you are doing this, then you need
to compute (by analyzing the code, or in some other way) the maximum or
likely maximum error that the computation introduces, and allow for it
when performing comparisons (and when producing output, but that's a
different problem). In particular, instead of testing for equality, you
would check to see whether the two values have ranges that overlap; and
this is done with the relational operators, so equality comparisons are
probably mistaken.
-Wtraditional
Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C constructs that have no traditional C equivalent, and/or problematic constructs which should be avoided.
Macro parameters that appear within string literals in the macro body. In traditional C macro replacement takes place within string literals, but does not in ISO C.
In traditional C, some preprocessor directives did not exist.
Traditional preprocessors would only consider a line to be a directive
if the #
appeared in column 1 on the line. Therefore
'-Wtraditional' warns about directives that traditional C
understands but would ignore because the #
does not appear as the
first character on the line. It also suggests you hide directives like
#pragma
not understood by traditional C by indenting them. Some
traditional implementations would not recognize #elif
, so it
suggests avoiding it altogether.
A function-like macro that appears without arguments.
The unary plus operator.
The U
integer constant suffix, or the F
or L
floating point
constant suffixes. (Traditional C does support the L
suffix on integer
constants.) Note, these suffixes appear in macros defined in limits.h,
for example.
A function declared external in one block and then used after the end of the block.
A non-static
function declaration follows a static
one.
This construct is not accepted by some traditional C compilers.
The ISO type of an integer constant has a different width or signedness from its traditional type. This warning is only issued if the base of the constant is 10, i.e. hexadecimal or octal values, which typically represent bit patterns, are not warned about.
Usage of ISO string concatenation is detected.
Initialization of automatic aggregates.
Identifier conflicts with labels. Traditional C lacks a separate namespace for labels.
Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the assumption that the zero initializer in user code appears conditioned on e.g. __STDC__ to avoid missing initializer warnings and relies on default initialization to zero in the traditional C case.
Conversions by prototypes between fixed/floating point values and vice versa. The absence of these prototypes when compiling with traditional C would cause serious problems. This is a subset of the possible conversion warnings, for the full set use '-Wconversion'.
Use of ISO C style function definitions. This warning intentionally is
not issued for prototype declarations or variadic functions
because these ISO C features will appear in your code when using
libiberty's traditional C compatibility macros, PARAMS
and
VPARAMS
. This warning is also bypassed for nested functions
because that feature is already a gcc extension and thus not relevant to
traditional C compatibility.
-Wundef
Warn if an undefined identifier is evaluated in an #if
directive.
-Wendif-labels
Warn whenever an #else
or an #endif
are followed by text.
-Wshadow
Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed.
-Wlarger-than-len
Warn whenever an object of larger than len bytes is defined.
-Wpointer-arith
Warn about anything that depends on the "size of" a function type or
of void
. GNU C assigns these types a size of 1, for
convenience in calculations with void*
pointers and pointers
to functions.
-Wbad-function-cast
Warn whenever a function call is cast to a non-matching type.
For example, warn if int malloc()
is cast to anything *
.
-Wcast-qual
Warn whenever a pointer is cast so as to remove a type qualifier from
the target type. For example, warn if a const char *
is cast
to an ordinary char *
.
-Wcast-align
Warn whenever a pointer is cast such that the required alignment of the
target is increased. For example, warn if a char *
is cast to
an int *
on machines where integers can only be accessed at
two- or four-byte boundaries.
-Wwrite-strings
When compiling C, give string constants the type const
char[length]
so that
copying the address of one into a non-const
char *
pointer will get a warning; when compiling C++, warn about the
deprecated conversion from string constants to char *
.
These warnings will help you find at
compile time code that can try to write into a string constant, but
only if you have been very careful about using const
in
declarations and prototypes. Otherwise, it will just be a nuisance;
this is why we did not make '-Wall' request these warnings.
-Wconversion
Warn if a prototype causes a type conversion that is different from what
would happen to the same argument in the absence of a prototype. This
includes conversions of fixed point to floating and vice versa, and
conversions changing the width or signedness of a fixed point argument
except when the same as the default promotion.
Also, warn if a negative integer constant expression is implicitly
converted to an unsigned type. For example, warn about the assignment
x = -1
if x
is unsigned. But do not warn about explicit
casts like (unsigned) -1
.
-Wsign-compare
Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. This warning is enabled by '-W', and by '-Wall' in C++ only.
-Waggregate-return
Warn if any functions that return structures or unions are defined or called.
-Wstrict-prototypes
Warn if a function is declared or defined without specifying the argument types. (An old-style function definition is permitted without a warning if preceded by a declaration which specifies the argument types.)
-Wmissing-prototypes
Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. The aim is to detect global functions that fail to be declared in header files.
-Wmissing-declarations (C only)
Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files.
-Wmissing-noreturn
Warn about functions which might be candidates for attribute noreturn. Note these are only possible candidates, not absolute ones. Care should be taken to manually verify functions actually do not ever return before adding the noreturn attribute, otherwise subtle code generation bugs could be introduced.
-Wmissing-format-attribute
If '-Wformat' is enabled, also warn about functions which might be candidates for format attributes. Note these are only possible candidates, not absolute ones. GCC will guess that format attributes might be appropriate for any function that calls a function like vprintf or vscanf, but this might not always be the case, and some functions for which format attributes are appropriate may not be detected. This option has no effect unless '-Wformat' is enabled (possibly by '-Wall').
-Wno-multichar
Do not warn if a multicharacter constant ('FOOF'
) is used.
Usually they indicate a typo in the user's code, as they have
implementation-defined values, and should not be used in portable code.
-Wno-deprecated-declarations
Do not warn about uses of functions, variables, and types marked as deprecated by using the deprecated attribute.
-Wpacked
Warn if a structure is given the packed attribute, but the packed
attribute has no effect on the layout or size of the structure.
Such structures may be mis-aligned for little benefit. For
instance, in this code, the variable f.x in struct bar
will be misaligned even though struct bar
does not itself
have the packed attribute:
struct foo { int x; char a, b, c, d; } __attribute__((packed)); struct bar { char z; struct foo f; };
-Wpadded
Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make the structure smaller.
-Wredundant-decls
Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing.
-Wnested-externs
Warn if an extern
declaration is encountered within a function.
-Wunreachable-code
Warn if the compiler detects that code will never be executed.
This option is intended to warn when the compiler detects that at
least a whole line of source code will never be executed, because
some condition is never satisfied or because it is after a
procedure that never returns.
It is possible for this option to produce a warning even though there
are circumstances under which part of the affected line can be executed,
so care should be taken when removing apparently-unreachable code.
For instance, when a function is inlined, a warning may mean that the
line is unreachable in only one inlined copy of the function.
This option is not made part of '-Wall' because in a debugging
version of a program there is often substantial code which checks
correct functioning of the program and is, hopefully, unreachable
because the program does work. Another common use of unreachable
code is to provide behavior which is selectable at compile-time.
-Winline
Warn if a function can not be inlined and it was declared as inline.
Even with this option, the compiler will not warn about failures to
inline functions declared in system headers.
The compiler uses a variety of heuristics to determine whether or not
to inline a function. For example, the compiler takes into account
the size of the function being inlined and the the amount of inlining
that has already been done in the current function. Therefore,
seemingly insignificant changes in the source program can cause the
warnings produced by '-Winline' to appear or disappear.
-Wlong-long
Warn if long long
type is used. This is default. To inhibit
the warning messages, use '-Wno-long-long'. Flags
'-Wlong-long' and '-Wno-long-long' are taken into account
only when '-pedantic' flag is used.
-Wdisabled-optimization
Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is anything wrong with your code; it merely indicates that GCC's optimizers were unable to handle the code effectively. Often, the problem is that your code is too big or too complex; GCC will refuse to optimize programs when the optimization itself is likely to take inordinate amounts of time.
-Werror
Make all warnings into errors.
GCC has various special options that are used for debugging
either your program or GCC.
However, this manual is not meant to explain anything about the internals of
GCC, so you will have to go to the
official version
of this page on the internet if you want to debug GCC itself.
In order to debug GCC4TI C programs at a source level, you need a GDB-enabled
version of the TiEmu emulator.
-g
Produce debugging information in the operating system's native format
(stabs is the default for the MC68000). GDB can work with this debugging
information.
Note that the tigcc
frontend defaults to DWARF 2 debugging
information instead, see Options Available in the
Command Line Compiler.
Unlike most other C compilers, GCC allows you to use '-g' with
'-O'. The shortcuts taken by optimized code may occasionally
produce surprising results: some variables you declared may not exist
at all; flow of control may briefly move where you did not expect it;
some statements may not be executed because they compute constant
results or their values were already at hand; some statements may
execute in different places because they were moved out of loops.
Nevertheless it proves possible to debug optimized output. This makes
it reasonable to use the optimizer for programs that might have bugs.
The following options are useful when GCC is generated with the
capability for more than one debugging format.
-ggdb
Produce debugging information for use by GDB. This means to use the most expressive format available, including GDB extensions if at all possible.
-gstabs
Produce debugging information in stabs format.
-gstabs+
Produce debugging information in stabs format, using GNU extensions understood only by the GNU debugger (GDB).
-gcoff
Produce debugging information in COFF format.
-glevel
-ggdblevel
-gstabslevel
-gcofflevel
Request debugging information and also use level to specify how
much information. The default level is 2.
Level 1 produces minimal information, enough for making backtraces in
parts of the program that you don't plan to debug. This includes
descriptions of functions and external variables, but no information
about local variables and no line numbers.
Level 3 includes extra information, such as all the macro definitions
present in the program. Some debuggers support macro expansion when
you use '-g3'.
-p
Generate extra code to write profile information suitable for the
analysis program prof
. You must use this option when compiling
the source files you want data about, and you must also use it when
linking.
This option is probably useless in GCC4TI.
-pg
Generate extra code to write profile information suitable for the
analysis program gprof
. You must use this option when compiling
the source files you want data about, and you must also use it when
linking.
This option is probably useless in GCC4TI.
-Q
Makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes.
-save-temps
Store the usual "temporary" intermediate files permanently; place them
in the current directory and name them based on the source file. Thus,
compiling foo.c
with '-c -save-temps' would produce files
foo.i
and foo.s
, as well as foo.o
. This creates a
preprocessed foo.i
output file even though the compiler now
normally uses an integrated preprocessor.
These options control various sorts of optimizations.
Without any optimization option, the compiler's goal is to reduce the
cost of compilation and to make debugging produce the expected
results. Statements are independent: if you stop the program with a
breakpoint between statements, you can then assign a new value to any
variable or change the program counter to any other statement in the
function and get exactly the results you would expect from the source
code.
Turning on optimization flags makes the compiler attempt to improve
the performance and/or code size at the expense of compilation time
and possibly the ability to debug the program.
Not all optimizations are controlled directly by a flag. Only
optimizations that have a flag are listed.
-O
-O1
Optimize. Optimizing compilation takes somewhat more time, and a lot
more memory for a large function.
With '-O', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal of
compilation time.
'-O' turns on the following optimization flags:
-fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fcrossjumping -fif-conversion -fif-conversion2 -fdelayed-branch -fguess-branch-probability -fcprop-registers
'-O' also turns on '-fomit-frame-pointer' on machines
where doing so does not interfere with debugging.
-O2
Optimize even more. GCC performs nearly all supported optimizations
that do not involve a space-speed tradeoff. The compiler does not
perform loop unrolling or function inlining when you specify '-O2'.
As compared to '-O', this option increases both compilation time
and the performance of the generated code.
'-O2' turns on all optimization flags specified by '-O'. It
also turns on the following optimization flags:
-fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fdelete-null-pointer-checks -fexpensive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks -freorder-functions -fstrict-aliasing -falign-functions -falign-jumps -falign-loops -falign-labels
Please note the warning under '-fgcse' about
invoking '-O2' on programs that use computed gotos.
-O3
Optimize yet more. '-O3' turns on all optimizations specified by '-O2' and also turns on the '-finline-functions' and '-frename-registers' options.
-O0
Do not optimize. This is the default.
-Os
Optimize for size. '-Os' enables all '-O2' optimizations that
do not typically increase code size. It also performs further
optimizations designed to reduce code size.
'-Os' disables the following optimization flags:
-falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -fprefetch-loop-arrays
If you use multiple '-O' options, with or without level numbers,
the last such option is the one that is effective.
Options of the form '-fflag' specify machine-independent
flags. Most flags have both positive and negative forms; the negative
form of '-ffoo' would be '-fno-foo'. In the table
below, only one of the forms is listed: the one you typically will
use. You can figure out the other form by either removing 'no-'
or adding it.
The following options control specific optimizations. They are either
activated by '-O' options or are related to ones that are. You
can use the following flags in the rare cases when "fine-tuning" of
optimizations to be performed is desired.
-fno-defer-pop
Always pop the arguments to each function call as soon as that function
returns. For machines which must pop arguments after a function call,
the compiler normally lets arguments accumulate on the stack for several
function calls and pops them all at once.
Disabled at levels '-O', '-O2', '-O3', '-Os'.
-fforce-mem
Force memory operands to be copied into registers before doing
arithmetic on them. This produces better code by making all memory
references potential common subexpressions. When they are not common
subexpressions, instruction combination should eliminate the separate
register-load.
Enabled at levels '-O2', '-O3', '-Os'.
-fforce-addr
Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as '-fforce-mem' may.
-fomit-frame-pointer
Don't keep the frame pointer in a register for functions that
don't need one. This avoids the instructions to save, set up and
restore frame pointers; it also makes an extra register available
in many functions. It also makes debugging impossible on
some machines (not on GCC4TI though, thanks to unwinding tables).
This option now works with floating point arithmetic.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-foptimize-sibling-calls
Optimize sibling and tail recursive calls.
Enabled at levels '-O2', '-O3', '-Os'.
-fno-inline
Don't pay attention to the inline
keyword. Normally this option
is used to keep the compiler from expanding any functions inline.
Note that if you are not optimizing, no functions can be expanded inline.
-finline-functions
Integrate all simple functions into their callers. The compiler
heuristically decides which functions are simple enough to be worth
integrating in this way.
If all calls to a given function are integrated, and the function is
declared static
, then the function is normally not output as
assembler code in its own right.
Enabled at level '-O3'.
-finline-limit=n
By default, gcc limits the size of functions that can be inlined. This flag
allows the control of this limit for functions that are explicitly marked as
inline (i.e., marked with the inline keyword).
n is the size of functions that can be inlined in
number of pseudo instructions (not counting parameter handling). The default
value of n is 600.
Increasing this value can result in more inlined code at
the cost of compilation time and memory consumption. Decreasing usually makes
the compilation faster and less code will be inlined (which presumably
means slower programs). This option is particularly useful for programs that
use inlining heavily.
Inlining is actually controlled by a number of parameters, which may be
specified individually by using '--param name=value'.
The '-finline-limit=n' option sets some of these parameters
as follows:
max-inline-insns
is set to n.
max-inline-insns-single
is set to n/2.
max-inline-insns-auto
is set to n/2.
min-inline-insns
is set to 130 or n/4, whichever is smaller.
max-inline-insns-rtl
is set to n.
Using '-finline-limit=600' thus results in the default settings
for these parameters. See below for a documentation of the individual
parameters controlling inlining.
Note: pseudo instruction represents, in this particular context, an
abstract measurement of function's size. In no way, it represents a count
of assembly instructions and as such its exact meaning might change from one
release to an another.
-fkeep-inline-functions
Even if all calls to a given function are integrated, and the function
is declared static
, nevertheless output a separate run-time
callable version of the function. This switch does not affect
extern inline
functions.
-fkeep-static-consts
Emit variables declared static const
when optimization isn't turned
on, even if the variables aren't referenced.
GCC enables this option by default. If you want to force the compiler to
check if the variable was referenced, regardless of whether or not
optimization is turned on, use the '-fno-keep-static-consts' option.
-fmerge-constants
Attempt to merge identical constants (string constants and floating point
constants) across compilation units.
This option is the default for optimized compilation if the assembler and
linker support it. Use '-fno-merge-constants' to inhibit this
behavior.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fmerge-all-constants
Attempt to merge identical constants and identical variables.
This option implies '-fmerge-constants'. In addition to
'-fmerge-constants' this considers e.g. even constant initialized
arrays or initialized constant variables with integral or floating point
types. C requires each non-automatic variable to have a distinct location,
so using this option will result in non-conforming behavior.
-fno-branch-count-reg
Do not use "decrement and branch" instructions on a count register,
but instead generate a sequence of instructions that decrement a
register, compare it against zero, then branch based upon the result.
This option is only meaningful on architectures that support such
instructions, which include x86, PowerPC, IA-64 and S/390.
The default is '-fbranch-count-reg', enabled when
'-fstrength-reduce' is enabled.
-fno-function-cse
Do not put function addresses in registers; make each instruction that
calls a constant function contain the function's address explicitly.
This option results in less efficient code, but some strange hacks
that alter the assembler output may be confused by the optimizations
performed when this option is not used.
The default is '-ffunction-cse'
-fno-zero-initialized-in-bss
If the target supports a BSS section
(which is always the case for GCC4TI now), GCC by default puts variables that
are initialized to zero into BSS. This can save space in the resulting
code.
This option turns off this behavior because some programs explicitly
rely on variables going to the data section. E.g., so that the
resulting executable can find the beginning of that section and/or make
assumptions based on that.
The default is '-fzero-initialized-in-bss'.
-fstrength-reduce
Perform the optimizations of loop strength reduction and
elimination of iteration variables.
Enabled at levels '-O2', '-O3', '-Os'.
-fthread-jumps
Perform optimizations where we check to see if a jump branches to a
location where another comparison subsumed by the first is found. If
so, the first branch is redirected to either the destination of the
second branch or a point immediately following it, depending on whether
the condition is known to be true or false.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fcse-follow-jumps
In common subexpression elimination, scan through jump instructions
when the target of the jump is not reached by any other path. For
example, when CSE encounters an if
statement with an
else
clause, CSE will follow the jump when the condition
tested is false.
Enabled at levels '-O2', '-O3', '-Os'.
-fcse-skip-blocks
This is similar to '-fcse-follow-jumps', but causes CSE to
follow jumps which conditionally skip over blocks. When CSE
encounters a simple if
statement with no else clause,
'-fcse-skip-blocks' causes CSE to follow the jump around the
body of the if
.
Enabled at levels '-O2', '-O3', '-Os'.
-frerun-cse-after-loop
Re-run common subexpression elimination after loop optimizations have been
performed.
Enabled at levels '-O2', '-O3', '-Os'.
-frerun-loop-opt
Run the loop optimizer twice.
Enabled at levels '-O2', '-O3', '-Os'.
-fgcse
Perform a global common subexpression elimination pass.
This pass also performs global constant and copy propagation.
Note: When compiling a program using computed gotos, a GCC
extension, you may get better runtime performance if you disable
the global common subexpression elimination pass by adding
'-fno-gcse' to the command line.
Enabled at levels '-O2', '-O3', '-Os'.
-fgcse-lm
When '-fgcse-lm' is enabled, global common subexpression elimination will
attempt to move loads which are only killed by stores into themselves. This
allows a loop containing a load/store sequence to be changed to a load outside
the loop, and a copy/store within the loop.
Enabled by default when gcse is enabled.
-fgcse-sm
When '-fgcse-sm' is enabled, A store motion pass is run after global common
subexpression elimination. This pass will attempt to move stores out of loops.
When used in conjunction with '-fgcse-lm', loops containing a load/store sequence
can be changed to a load before the loop and a store after the loop.
Enabled by default when gcse is enabled.
-floop-optimize
Perform loop optimizations: move constant expressions out of loops, simplify
exit test conditions and optionally do strength-reduction and loop unrolling as
well.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fcrossjumping
Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
resulting code may or may not perform better than without cross-jumping.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fif-conversion
Attempt to transform conditional jumps into branch-less equivalents. This
include use of conditional moves, min, max, set flags and abs instructions, and
some tricks doable by standard arithmetics. The use of conditional execution
on chips where it is available is controlled by if-conversion2
.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fif-conversion2
Use conditional execution (where available) to transform conditional jumps into
branch-less equivalents.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fdelete-null-pointer-checks
Use global dataflow analysis to identify and eliminate useless checks
for null pointers. The compiler assumes that dereferencing a null
pointer would have halted the program. If a pointer is checked after
it has already been dereferenced, it cannot be null.
In some environments, this assumption is not true, and programs can
safely dereference null pointers. Use
'-fno-delete-null-pointer-checks' to disable this optimization
for programs which depend on that behavior.
Enabled at levels '-O2', '-O3', '-Os'.
-fexpensive-optimizations
Perform a number of minor optimizations that are relatively expensive.
Enabled at levels '-O2', '-O3', '-Os'.
-foptimize-register-move
-fregmove
Attempt to reassign register numbers in move instructions and as
operands of other simple instructions in order to maximize the amount of
register tying. This is especially helpful on machines with two-operand
instructions.
Note '-fregmove' and '-foptimize-register-move' are the same
optimization.
Enabled at levels '-O2', '-O3', '-Os'.
-fdelayed-branch
If supported for the target machine, attempt to reorder instructions
to exploit instruction slots available after delayed branch
instructions.
Enabled at levels '-O', '-O2', '-O3', '-Os'.
-fschedule-insns
If supported for the target machine, attempt to reorder instructions to
eliminate execution stalls due to required data being unavailable. This
helps machines that have slow floating point or memory load instructions
by allowing other instructions to be issued until the result of the load
or floating point instruction is required.
Enabled at levels '-O2', '-O3', '-Os'.
-fschedule-insns2
Similar to '-fschedule-insns', but requests an additional pass of
instruction scheduling after register allocation has been done. This is
especially useful on machines with a relatively small number of
registers and where memory load instructions take more than one cycle.
Enabled at levels '-O2', '-O3', '-Os'.
-fno-sched-interblock
Don't schedule instructions across basic blocks. This is normally enabled by default when scheduling before register allocation, i.e. with '-fschedule-insns' or at '-O2' or higher.
-fno-sched-spec
Don't allow speculative motion of non-load instructions. This is normally enabled by default when scheduling before register allocation, i.e. with '-fschedule-insns' or at '-O2' or higher.
-fsched-spec-load
Allow speculative motion of some load instructions. This only makes sense when scheduling before register allocation, i.e. with '-fschedule-insns' or at '-O2' or higher.
-fsched-spec-load-dangerous
Allow speculative motion of more load instructions. This only makes sense when scheduling before register allocation, i.e. with '-fschedule-insns' or at '-O2' or higher.
-fcaller-saves
Enable values to be allocated in registers that will be clobbered by
function calls, by emitting extra instructions to save and restore the
registers around such calls. Such allocation is done only when it
seems to result in better code than would otherwise be produced.
This option is always enabled by default on certain machines, usually
those which have no call-preserved registers to use instead.
Enabled at levels '-O2', '-O3', '-Os'.
-fmove-all-movables
Forces all invariant computations in loops to be moved outside the loop.
-freduce-all-givs
Forces all general-induction variables in loops to be
strength-reduced.
These options may generate better or worse code; results are highly
dependent on the structure of loops within the source code.
These two options are intended to be removed someday, once
they have helped determine the efficacy of various
approaches to improving loop optimizations.
-fno-peephole
-fno-peephole2
Disable any machine-specific peephole optimizations. The difference
between '-fno-peephole' and '-fno-peephole2' is in how they
are implemented in the compiler; some targets use one, some use the
other, a few use both.
'-fpeephole' is enabled by default.
'-fpeephole2' enabled at levels '-O2', '-O3', '-Os'.
-fbranch-probabilities
-fno-guess-branch-probability
Do not guess branch probabilities using a randomized model.
Sometimes gcc will opt to use a randomized model to guess branch
probabilities, when none are available from either profiling feedback
('-fprofile-arcs') or __builtin_expect
. This means that
different runs of the compiler on the same program may produce different
object code.
In a hard real-time system, people don't want different runs of the
compiler to produce code that has different behavior; minimizing
non-determinism is of paramount importance. This switch allows users to
reduce non-determinism, possibly at the expense of inferior
optimization.
The default is '-fguess-branch-probability' at levels
'-O', '-O2', '-O3', '-Os'.
-freorder-blocks
Reorder basic blocks in the compiled function in order to reduce number of
taken branches and improve code locality.
Enabled at levels '-O2', '-O3'.
-freorder-functions
Reorder basic blocks in the compiled function in order to reduce number of
taken branches and improve code locality. This is implemented by using special
subsections text.hot
for most frequently executed functions and
text.unlikely
for unlikely executed functions. Reordering is done by
the linker so object file format must support named sections and linker must
place them in a reasonable way.
Also profile feedback must be available in to make this option effective. See
'-fprofile-arcs' for details.
Enabled at levels '-O2', '-O3', '-Os'.
-fstrict-aliasing
Allows the compiler to assume the strictest aliasing rules applicable to
the language being compiled. For C, this activates
optimizations based on the type of expressions. In particular, an
object of one type is assumed never to reside at the same address as an
object of a different type, unless the types are almost the same. For
example, an unsigned int
can alias an int
, but not a
void*
or a double
. A character type may alias any other
type.
Pay special attention to code like this:
union a_union { int i; double d; }; int f() { a_union t; t.d = 3.0; return t.i; }
The practice of reading from a different union member than the one most recently written to (called "type-punning") is common. Even with '-fstrict-aliasing', type-punning is allowed, provided the memory is accessed through the union type. So, the code above will work as expected. However, this code might not:
int f() { a_union t; int* ip; t.d = 3.0; ip = &t.i; return *ip; }
Enabled at levels '-O2', '-O3', '-Os'.
-falign-functions
-falign-functions=n
Align the start of functions to the next power-of-two greater than
n, skipping up to n bytes. For instance,
'-falign-functions=32' aligns functions to the next 32-byte
boundary, but '-falign-functions=24' would align to the next
32-byte boundary only if this can be done by skipping 23 bytes or less.
'-fno-align-functions' and '-falign-functions=1' are
equivalent and mean that functions will not be aligned.
Some assemblers only support this flag when n is a power of two;
in that case, it is rounded up.
If n is not specified, use a machine-dependent default.
Enabled at levels '-O2', '-O3'.
-falign-labels
-falign-labels=n
Align all branch targets to a power-of-two boundary, skipping up to
n bytes like '-falign-functions'. This option can easily
make code slower, because it must insert dummy operations for when the
branch target is reached in the usual flow of the code.
If '-falign-loops' or '-falign-jumps' are applicable and
are greater than this value, then their values are used instead.
If n is not specified, use a machine-dependent default which is
very likely to be 1
, meaning no alignment.
Enabled at levels '-O2', '-O3'.
-falign-loops
-falign-loops=n
Align loops to a power-of-two boundary, skipping up to n bytes
like '-falign-functions'. The hope is that the loop will be
executed many times, which will make up for any execution of the dummy
operations.
If n is not specified, use a machine-dependent default.
Enabled at levels '-O2', '-O3'.
-falign-jumps
-falign-jumps=n
Align branch targets to a power-of-two boundary, for branch targets
where the targets can only be reached by jumping, skipping up to n
bytes like '-falign-functions'. In this case, no dummy operations
need be executed.
If n is not specified, use a machine-dependent default.
Enabled at levels '-O2', '-O3'.
-frename-registers
Attempt to avoid false dependencies in scheduled code by making use
of registers left over after register allocation. This optimization
will most benefit processors with lots of registers. It can, however,
make debugging impossible, since variables will no longer stay in
a "home register".
Enabled at levels '-O3'.
-fno-cprop-registers
After register allocation and post-register allocation instruction splitting,
we perform a copy-propagation pass to try to reduce scheduling dependencies
and occasionally eliminate the copy.
Disabled at levels '-O', '-O2', '-O3', '-Os'.
The following options control compiler behavior regarding floating point arithmetic. These options trade off between speed and correctness. All must be specifically enabled.
-ffloat-store
Do not store floating point variables in registers, and inhibit other
options that might change whether a floating point value is taken from a
register or memory.
This option prevents undesirable excess precision on machines such as
the 68000 where the floating registers (of the 68881) keep more
precision than a double
is supposed to have. Similarly for the
x86 architecture. For most programs, the excess precision does only
good, but a few programs rely on the precise definition of IEEE floating
point. Use '-ffloat-store' for such programs, after modifying
them to store all pertinent intermediate computations into variables.
This option is probably useless in GCC4TI, except as a workaround for floating
point arithmetic errors.
-ffast-math
Sets '-fno-math-errno', '-funsafe-math-optimizations',
'-fno-trapping-math', '-ffinite-math-only' and
'-fno-signaling-nans'.
This option causes the preprocessor macro __FAST_MATH__
to be defined.
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications for
math functions.
This option is probably useless in GCC4TI.
-fno-math-errno
Do not set ERRNO after calling math functions that are executed
with a single instruction, e.g., sqrt. A program that relies on
IEEE exceptions for math error handling may want to use this flag
for speed while maintaining IEEE arithmetic compatibility.
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications for
math functions.
This option is probably useless in GCC4TI.
The default is '-fmath-errno'.
-funsafe-math-optimizations
Allow optimizations for floating-point arithmetic that (a) assume
that arguments and results are valid and (b) may violate IEEE or
ANSI standards. When used at link-time, it may include libraries
or startup files that change the default FPU control word or other
similar optimizations.
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications for
math functions.
This option is probably useless in GCC4TI.
The default is '-fno-unsafe-math-optimizations'.
-ffinite-math-only
Allow optimizations for floating-point arithmetic that assume
that arguments and results are not NaNs or +-Infs.
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications.
The default is '-fno-finite-math-only'.
-fno-trapping-math
Compile code assuming that floating-point operations cannot generate
user-visible traps. These traps include division by zero, overflow,
underflow, inexact result and invalid operation. This option implies
'-fno-signaling-nans'. Setting this option may allow faster
code if one relies on "non-stop" IEEE arithmetic, for example.
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ISO rules/specifications for
math functions.
This option is probably useless in GCC4TI.
The default is '-ftrapping-math'.
-fsignaling-nans
Compile code assuming that IEEE signaling NaNs may generate user-visible
traps during floating-point operations. Setting this option disables
optimizations that may change the number of exceptions visible with
signaling NaNs. This option implies '-ftrapping-math'.
This option causes the preprocessor macro __SUPPORT_SNAN__
to
be defined.
The default is '-fno-signaling-nans'.
This option is experimental and does not currently guarantee to
disable all GCC optimizations that affect signaling NaN behavior.
-fsingle-precision-constant
Treat floating point constant as single precision constant instead of implicitly converting it to double precision constant.
The following options control optimizations that may improve performance, but are not enabled by any '-O' options. This section includes experimental options that may produce broken code.
-fbranch-probabilities
After running a program compiled with '-fprofile-arcs'
(see Options for Debugging Your Program or GCC),
you can compile it a second time using
'-fbranch-probabilities', to improve optimizations based on
the number of times each branch was taken. When the program
compiled with '-fprofile-arcs' exits, it saves arc execution
counts to a file called sourcename.da
for each source
file. The information in this data file is very dependent on the
structure of the generated code, so you must use the same source code
and the same optimization options for both compilations.
With '-fbranch-probabilities', GCC puts a
REG_BR_PROB
note on each JUMP_INSN
and CALL_INSN
.
These can be used to improve optimization. Currently, they are only
used in one place: in reorg.c
, instead of guessing which path a
branch is mostly to take, the REG_BR_PROB
values are used to
exactly determine which path is taken more often.
-fnew-ra
Use a graph coloring register allocator. Currently this option is meant for testing, so we are interested to hear about miscompilations with '-fnew-ra'.
-ftracer
Perform tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowing other optimizations to do better job.
-funroll-loops
Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. '-funroll-loops' implies both '-fstrength-reduce' and '-frerun-cse-after-loop'. This option makes code larger, and may or may not make it run faster.
-funroll-all-loops
Unroll all loops, even if their number of iterations is uncertain when the loop is entered. This usually makes programs run more slowly. '-funroll-all-loops' implies the same options as '-funroll-loops',
-fprefetch-loop-arrays
If supported by the target machine, generate instructions to prefetch
memory to improve the performance of loops that access large arrays.
Disabled at level '-Os'.
-ffunction-sections
-fdata-sections
Place each function or data item into its own section in the output
file if the target supports arbitrary sections. The name of the
function or the name of the data item determines the section's name
in the output file.
Use these options on systems where the linker can perform optimizations
to improve locality of reference in the instruction space. Most systems
using the ELF object format and SPARC processors running Solaris 2 have
linkers with such optimizations. AIX may have these optimizations in
the future.
Only use these options when there are significant benefits from doing
so. When you specify these options, the assembler and linker will
create larger object and executable files and will also be slower.
You will not be able to use gprof
on all systems if you
specify this option and you may have problems with debugging if
you specify both this option and '-g'.
-fssa
Perform optimizations in static single assignment form. Each function's flow graph is translated into SSA form, optimizations are performed, and the flow graph is translated back from SSA form. Users should not specify this option, since it is not yet ready for production use.
-fssa-ccp
Perform Sparse Conditional Constant Propagation in SSA form. Requires '-fssa'. Like '-fssa', this is an experimental feature.
-fssa-dce
Perform aggressive dead-code elimination in SSA form. Requires '-fssa'. Like '-fssa', this is an experimental feature.
--param name=value
In some places, GCC uses various constants to control the amount of
optimization that is done. For example, GCC will not inline functions
that contain more that a certain number of instructions. You can
control some of these constants on the command-line using the
'--param' option.
In each case, the value is an integer. The allowable choices for
name are given in the following table:
max-crossjump-edges
The maximum number of incoming edges to consider for crossjumping.
The algorithm used by '-fcrossjumping' is O(N^2)
in
the number of edges incoming to each block. Increasing values mean
more aggressive optimization, making the compile time increase with
probably small improvement in executable size.
max-delay-slot-insn-search
The maximum number of instructions to consider when looking for an instruction to fill a delay slot. If more than this arbitrary number of instructions is searched, the time savings from filling the delay slot will be minimal so stop searching. Increasing values mean more aggressive optimization, making the compile time increase with probably small improvement in executable run time.
max-delay-slot-live-search
When trying to fill delay slots, the maximum number of instructions to consider when searching for a block with valid live register information. Increasing this arbitrarily chosen value means more aggressive optimization, increasing the compile time. This parameter should be removed when the delay slot code is rewritten to maintain the control-flow graph.
max-gcse-memory
The approximate maximum amount of memory that will be allocated in order to perform the global common subexpression elimination optimization. If more memory than specified is required, the optimization will not be done.
max-gcse-passes
The maximum number of passes of GCSE to run.
max-pending-list-length
The maximum number of pending dependencies scheduling will allow before flushing the current state and starting over. Large functions with few branches or calls can create excessively large lists which needlessly consume memory and resources.
max-inline-insns-single
Several parameters control the tree inliner used in gcc. This number sets the maximum number of instructions (counted in gcc's internal representation) in a single function that the tree inliner will consider for inlining. This only affects functions declared inline. The default value is 300.
max-inline-insns-auto
When you use '-finline-functions' (included in '-O3'), a lot of functions that would otherwise not be considered for inlining by the compiler will be investigated. To those functions, a different (more restrictive) limit compared to functions declared inline can be applied. The default value is 300.
max-inline-insns
The tree inliner does decrease the allowable size for single functions to be inlined after we already inlined the number of instructions given here by repeated inlining. This number should be a factor of two or more larger than the single function limit. Higher numbers result in better runtime performance, but incur higher compile-time resource (CPU time, memory) requirements and result in larger binaries. Very high values are not advisable, as too large binaries may adversely affect runtime performance. The default value is 600.
max-inline-slope
After exceeding the maximum number of inlined instructions by repeated inlining, a linear function is used to decrease the allowable size for single functions. The slope of that function is the negative reciprocal of the number specified here. The default value is 32.
min-inline-insns
The repeated inlining is throttled more and more by the linear function after exceeding the limit. To avoid too much throttling, a minimum for this function is specified here to allow repeated inlining for very small functions even when a lot of repeated inlining already has been done. The default value is 130.
max-inline-insns-rtl
For languages that use the RTL inliner (this happens at a later stage than tree inlining), you can set the maximum allowable size (counted in RTL instructions) for the RTL inliner with this parameter. The default value is 600.
max-unrolled-insns
The maximum number of instructions that a loop should have if that loop is unrolled, and if the loop is unrolled, it determines how many times the loop code is unrolled.
hot-bb-count-fraction
Select fraction of the maximal count of repetitions of basic block in program given basic block needs to have to be considered hot.
hot-bb-frequency-fraction
Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot
tracer-dynamic-coverage
tracer-dynamic-coverage-feedback
This value is used to limit superblock formation once the given percentage of
executed instructions is covered. This limits unnecessary code size
expansion.
The 'tracer-dynamic-coverage-feedback' is used only when profile
feedback is available. The real profiles (as opposed to statically estimated
ones) are much less balanced allowing the threshold to be larger value.
tracer-max-code-growth
Stop tail duplication once code growth has reached given percentage. This is rather hokey argument, as most of the duplicates will be eliminated later in cross jumping, so it may be set to much higher values than is the desired code growth.
tracer-min-branch-ratio
Stop reverse growth when the reverse probability of best edge is less than this threshold (in percent).
tracer-min-branch-ratio
tracer-min-branch-ratio-feedback
Stop forward growth if the best edge do have probability lower than this
threshold.
Similarly to 'tracer-dynamic-coverage' two values are present, one for
compilation for profile feedback and one for compilation without. The value
for compilation with profile feedback needs to be more conservative (higher) in
order to make tracer effective.
ggc-min-expand
GCC uses a garbage collector to manage its own memory allocation. This
parameter specifies the minimum percentage by which the garbage
collector's heap should be allowed to expand between collections.
Tuning this may improve compilation speed; it has no effect on code
generation.
The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
RAM >= 1GB. If getrlimit
is available, the notion of "RAM" is
the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS. If
GCC is not able to calculate RAM on a particular platform, the lower
bound of 30% is used. Setting this parameter and
'ggc-min-heapsize' to zero causes a full collection to occur at
every opportunity. This is extremely slow, but can be useful for
debugging.
ggc-min-heapsize
Minimum size of the garbage collector's heap before it begins bothering
to collect garbage. The first collection occurs after the heap expands
by 'ggc-min-expand'% beyond 'ggc-min-heapsize'. Again,
tuning this may improve compilation speed, and has no effect on code
generation.
The default is RAM/8, with a lower bound of 4096 (four megabytes) and an
upper bound of 131072 (128 megabytes). If getrlimit
is
available, the notion of "RAM" is the smallest of actual RAM,
RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS. If GCC is not able to calculate
RAM on a particular platform, the lower bound is used. Setting this
parameter very large effectively disables garbage collection. Setting
this parameter and 'ggc-min-expand' to zero causes a full
collection to occur at every opportunity.
These options control the C preprocessor, which is run on each C source
file before actual compilation.
If you use the '-E' option, nothing is done except preprocessing.
Some of these options make sense only together with '-E' because
they cause the preprocessor output to be unsuitable for actual
compilation.
You can use '-Wp,option' to bypass the compiler driver
and pass option directly through to the preprocessor. If
option contains commas, it is split into multiple options at the
commas. However, many options are modified, translated or interpreted
by the compiler driver before being passed to the preprocessor, and
'-Wp' forcibly bypasses this phase. The preprocessor's direct
interface is undocumented and subject to change, so whenever possible
you should avoid using '-Wp' and let the driver handle the
options instead.
-D name
Predefine name as a macro, with definition 1
.
-D name=definition
Predefine name as a macro, with definition definition.
There are no restrictions on the contents of definition, but if
you are invoking the preprocessor from a shell or shell-like program you
may need to use the shell's quoting syntax to protect characters such as
spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line, write
its argument list with surrounding parentheses before the equals sign
(if any). Parentheses are meaningful to most shells, so you will need
to quote the option. With sh
and csh
,
'-D'name(args...)=definition'' works.
'-D' and '-U' options are processed in the order they
are given on the command line. All '-imacros file' and
'-include file' options are processed after all
'-D' and '-U' options.
-U name
Cancel any previous definition of name, either built in or provided with a '-D' option.
-undef
Do not predefine any system-specific macros. The common predefined macros remain defined.
-I dir
Add the directory dir to the list of directories to be searched for header files. Directories named by '-I' are searched before the standard system include directories. If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated (see System Headers).
-o file
Write output to file. This is the same as specifying file
as the second non-option argument to cpp
. gcc
has a
different interpretation of a second non-option argument, so you must
use '-o' to specify the output file.
-Wall
Turns on all optional warnings which are desirable for normal code. At present this is '-Wcomment' and '-Wtrigraphs'. Note that many of the preprocessor's warnings are on by default and have no options to control them.
-Wcomment
-Wcomments
Warn whenever a comment-start sequence /*
appears in a /*
comment, or whenever a backslash-newline appears in a //
comment.
(Both forms have the same effect.)
-Wtrigraphs
Warn if any trigraphs are encountered. This option used to take effect only if '-trigraphs' was also specified, but now works independently. Warnings are not given for trigraphs within comments, as they do not affect the meaning of the program.
-Wtraditional
Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C constructs that have no traditional C equivalent, and problematic constructs which should be avoided. See Traditional Mode.
-Wimport
Warn the first time #import
is used.
-Wundef
Warn whenever an identifier which is not a macro is encountered in an
#if
directive, outside of defined
. Such identifiers are
replaced with zero.
-Wunused-macros
Warn about macros defined in the main file that are unused. A macro
is used if it is expanded or tested for existence at least once.
The preprocessor will also warn if the macro has not been used at the
time it is redefined or undefined.
Built-in macros, macros defined on the command line, and macros
defined in include files are not warned about.
Note: If a macro is actually used, but only used in skipped
conditional blocks, then CPP will report it as unused. To avoid the
warning in such a case, you might improve the scope of the macro's
definition by, for example, moving it into the first skipped block.
Alternatively, you could provide a dummy use with something like:
#if defined the_macro_causing_the_warning #endif
-Wendif-labels
Warn whenever an #else
or an #endif
are followed by text.
This usually happens in code of the form
#if FOO ... #else FOO ... #endif FOO
The second and third FOO
should be in comments, but often are not
in older programs. This warning is on by default.
-Werror
Make all warnings into hard errors. Source code which triggers warnings will be rejected.
-Wsystem-headers
Issue warnings for code in system headers. These are normally unhelpful in finding bugs in your own code, therefore suppressed. If you are responsible for the system library, you may want to see them.
-w
Suppress all warnings, including those which GNU CPP issues by default.
-pedantic
Issue all the mandatory diagnostics listed in the C standard. Some of them are left out by default, since they trigger frequently on harmless code.
-pedantic-errors
Issue all the mandatory diagnostics, and make all mandatory diagnostics into errors. This includes mandatory diagnostics that GCC issues without '-pedantic' but treats as warnings.
-M
Instead of outputting the result of preprocessing, output a rule
suitable for make
describing the dependencies of the main
source file. The preprocessor outputs one make
rule containing
the object file name for that source file, a colon, and the names of all
the included files, including those coming from '-include' or
'-imacros' command line options.
Unless specified explicitly (with '-MT' or '-MQ'), the
object file name consists of the basename of the source file with any
suffix replaced with object file suffix. If there are many included
files then the rule is split into several lines using \
-newline.
The rule has no commands.
This option does not suppress the preprocessor's debug output, such as
'-dM'. To avoid mixing such debug output with the dependency
rules you should explicitly specify the dependency output file with
'-MF', or use an environment variable like
DEPENDENCIES_OUTPUT
(see Environment Variables). Debug output
will still be sent to the regular output stream as normal.
Passing '-M' to the driver implies '-E', and suppresses
warnings with an implicit '-w'.
-MM
Like '-M' but do not mention header files that are found in
system header directories, nor header files that are included,
directly or indirectly, from such a header.
This implies that the choice of angle brackets or double quotes in an
#include
directive does not in itself determine whether that
header will appear in '-MM' dependency output. This is a
slight change in semantics from GCC versions 3.0 and earlier.
-MF file
When used with '-M' or '-MM', specifies a
file to write the dependencies to. If no '-MF' switch is given
the preprocessor sends the rules to the same place it would have sent
preprocessed output.
When used with the driver options '-MD' or '-MMD',
'-MF' overrides the default dependency output file.
-MG
In conjunction with an option such as '-M' requesting
dependency generation, '-MG' assumes missing header files are
generated files and adds them to the dependency list without raising
an error. The dependency filename is taken directly from the
#include
directive without prepending any path. '-MG'
also suppresses preprocessed output, as a missing header file renders
this useless.
This feature is used in automatic updating of makefiles.
-MP
This option instructs CPP to add a phony target for each dependency
other than the main file, causing each to depend on nothing. These
dummy rules work around errors make
gives if you remove header
files without updating the Makefile
to match.
This is typical output:
test.o: test.c test.h test.h:
-MT target
Change the target of the rule emitted by dependency generation. By
default CPP takes the name of the main input file, including any path,
deletes any file suffix such as .c
, and appends the platform's
usual object suffix. The result is the target.
An '-MT' option will set the target to be exactly the string you
specify. If you want multiple targets, you can specify them as a single
argument to '-MT', or use multiple '-MT' options.
For example, '-MT '$(objpfx)foo.o'' might give
$(objpfx)foo.o: foo.c
-MQ target
Same as '-MT', but it quotes any characters which are special to Make. The default target is automatically quoted, as if it were given with '-MQ'.
-MD
'-MD' is equivalent to '-M -MF file', except that
'-E' is not implied. The driver determines file based on
whether an '-o' option is given. If it is, the driver uses its
argument but with a suffix of .d
, otherwise it take the
basename of the input file and applies a .d
suffix.
If '-MD' is used in conjunction with '-E', any
'-o' switch is understood to specify the dependency output file, but
if used without '-E', each '-o'
is understood to specify a target object file.
Since '-E' is not implied, '-MD' can be used to generate
a dependency output file as a side-effect of the compilation process.
-MMD
Like '-MD' except mention only user header files, not system -header files.
-x c
-x c++
-x objective-c
-x assembler-with-cpp
Specify the source language: C, C++, Objective-C, or assembly. This has
nothing to do with standards conformance or extensions; it merely
selects which base syntax to expect. If you give none of these options,
cpp will deduce the language from the extension of the source file:
.c
, .cc
, .m
, or .S
. Some other common
extensions for C++ and assembly are also recognized. If cpp does not
recognize the extension, it will treat the file as C; this is the most
generic mode. Note that C++ and Objective-C are not supported in GCC4TI.
Note: Previous versions of cpp accepted a '-lang' option
which selected both the language and the standards conformance level.
This option has been removed, because it conflicts with the '-l'
option.
-std=standard
-ansi
Specify the standard to which the code should conform. Currently CPP
knows about C and C++ standards; others may be added in the future
(although it will not be important for GCC4TI).
standard
may be one of:
iso9899:1990
c89
The ISO C standard from 1990. c89
is the customary shorthand for
this version of the standard.
The '-ansi' option is equivalent to '-std=c89'.
iso9899:199409
The 1990 C standard, as amended in 1994.
iso9899:1999
c99
iso9899:199x
c9x
The revised ISO C standard, published in December 1999. Before publication, this was known as C9X.
gnu89
The 1990 C standard plus GNU extensions. This is the default.
gnu99
gnu9x
The 1999 C standard plus GNU extensions.
c++98
The 1998 ISO C++ standard plus amendments.
gnu++98
The same as '-std=c++98' plus GNU extensions. This is the default for C++ code.
-I-
Split the include path. Any directories specified with '-I'
options before '-I-' are searched only for headers requested with
#include "file"
; they are not searched for
#include <file>
. If additional directories are
specified with '-I' options after the '-I-', those
directories are searched for all #include
directives.
In addition, '-I-' inhibits the use of the directory of the current
file directory as the first search directory for #include
"file"
.
-nostdinc
Do not search the standard system directories for header files. Only the directories you have specified with '-I' options (and the directory of the current file, if appropriate) are searched.
-nostdinc++
Do not search for header files in the C++-specific standard directories, but do still search the other standard directories (not applicable to GCC4TI, because it does not support C++).
-include file
Process file as if #include "file"
appeared as the first
line of the primary source file. However, the first directory searched
for file is the preprocessor's working directory instead of
the directory containing the main source file. If not found there, it
is searched for in the remainder of the #include "..."
search
chain as normal.
If multiple '-include' options are given, the files are included
in the order they appear on the command line.
-imacros file
Exactly like '-include', except that any output produced by
scanning file is thrown away. Macros it defines remain defined.
This allows you to acquire all the macros from a header without also
processing its declarations.
All files specified by '-imacros' are processed before all files
specified by '-include'.
-idirafter dir
Search dir for header files, but do it after all directories specified with '-I' and the standard system directories have been exhausted. dir is treated as a system include directory.
-iprefix prefix
Specify prefix as the prefix for subsequent '-iwithprefix'
options. If the prefix represents a directory, you should include the
final /
.
-iwithprefix dir
-iwithprefixbefore dir
Append dir to the prefix specified previously with
'-iprefix', and add the resulting directory to the include search
path. '-iwithprefixbefore' puts it in the same place '-I'
would; '-iwithprefix' puts it where '-idirafter' would.
Use of these options is discouraged.
-isystem dir
Search dir for header files, after all directories specified by '-I' but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. See System Headers.
-fpreprocessed
Indicate to the preprocessor that the input file has already been
preprocessed. This suppresses things like macro expansion, trigraph
conversion, escaped newline splicing, and processing of most directives.
The preprocessor still recognizes and removes comments, so that you can
pass a file preprocessed with '-C' to the compiler without
problems. In this mode the integrated preprocessor is little more than
a tokenizer for the front ends.
'-fpreprocessed' is implicit if the input file has one of the
extensions .i
, .ii
or .mi
. These are the
extensions that GCC uses for preprocessed files created by
'-save-temps'.
-ftabstop=width
Set the distance between tab stops. This helps the preprocessor report correct column numbers in warnings or errors, even if tabs appear on the line. If the value is less than 1 or greater than 100, the option is ignored. The default is 8.
-fno-show-column
Do not print column numbers in diagnostics. This may be necessary if
diagnostics are being scanned by a program that does not understand the
column numbers, such as dejagnu
.
-A predicate=answer
Make an assertion with the predicate predicate and answer answer. This form is preferred to the older form '-A predicate(answer)', which is still supported, because it does not use shell special characters. See Assertions.
-A -predicate=answer
Cancel an assertion with the predicate predicate and answer answer.
-dCHARS
CHARS is a sequence of one or more of the following characters, and must not be preceded by a space. Other characters are interpreted by the compiler proper, or reserved for future versions of GCC, and so are silently ignored. If you specify characters whose behavior conflicts, the result is undefined.
M
Instead of the normal output, generate a list of #define
directives for all the macros defined during the execution of the
preprocessor, including predefined macros. This gives you a way of
finding out what is predefined in your version of the preprocessor.
Assuming you have no file foo.h
, the command
touch foo.h; cpp -dM foo.h
will show all the predefined macros.
D
Like M
except in two respects: it does not include the
predefined macros, and it outputs both the #define
directives and the result of preprocessing. Both kinds of output go to
the standard output file.
N
Like D
, but emit only the macro names, not their expansions.
I
Output #include
directives in addition to the result of
preprocessing.
-P
Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers. See Preprocessor Output.
-C
Do not discard comments. All comments are passed through to the output
file, except for comments in processed directives, which are deleted
along with the directive.
You should be prepared for side effects when using '-C'; it
causes the preprocessor to treat comments as tokens in their own right.
For example, comments appearing at the start of what would be a
directive line have the effect of turning that line into an ordinary
source line, since the first token on the line is no longer a #
.
-CC
Do not discard comments, including during macro expansion. This is
like '-C', except that comments contained within macros are
also passed through to the output file where the macro is expanded.
In addition to the side-effects of the '-C' option, the
'-CC' option causes all C++-style comments inside a macro
to be converted to C-style comments. This is to prevent later use
of that macro from inadvertently commenting out the remainder of
the source line.
The '-CC' option is generally used to support lint comments.
-gcc
Define the macros __GNUC__, __GNUC_MINOR__ and
__GNUC_PATCHLEVEL__. These are defined automatically when you use
gcc -E
; you can turn them off in that case with
'-no-gcc'.
-traditional-cpp
Try to imitate the behavior of old-fashioned C preprocessors, as opposed to ISO C preprocessors. See Traditional Mode.
-trigraphs
Process trigraph sequences.
See Initial processing.
These are three-character sequences, all starting with ??
, that
are defined by ISO C to stand for single characters. For example,
??/
stands for \
, so '??/n'
is a character
constant for a newline. By default, GCC ignores trigraphs, but in
standard-conforming modes it converts them. See the '-std' and
'-ansi' options.
The nine trigraphs and their replacements are
Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- Replacement: [ ] { } # \ ^ | ~
-remap
Enable special code to work around file systems which only permit very short file names, such as MS-DOS.
--help
--target-help
Print text describing all the command line options instead of preprocessing anything.
-v
Verbose mode. Print out GNU CPP's version number at the beginning of execution, and report the final form of the include path.
-H
Print the name of each header file used, in addition to other normal
activities. Each name is indented to show how deep in the
#include
stack it is.
-version
--version
Print out GNU CPP's version number. With one dash, proceed to preprocess as normal. With two dashes, exit immediately.
You can pass options to the GNU assembler, to the
A68k assembler, and to the GNU linker.
However, this is only possible this way if you are using the command line compiler.
In the IDE, you have to use the appropriate edit boxes in the project options.
-Wa,option
Pass option as an option to the GNU assembler. If option contains commas, it is split into multiple options at the commas.
-WA,option
Pass option as an option to the A68k assembler. If option contains commas, it is split into multiple options at the commas. This is a TIGCC/GCC4TI-only switch.
-Wl,option
Pass option as an option to the GNU linker. If option contains commas, it is split into multiple options at the commas.
These options specify directories to search for header files, for libraries and for parts of the compiler:
-Idir
Add the directory dir to the head of the list of directories to be
searched for header files. This can be used to override a system header
file, substituting your own version, since these directories are
searched before the system header file directories. However, you should
not use this option to add directories that contain vendor-supplied
system header files (use '-isystem' for that). If you use more than
one '-I' option, the directories are scanned in left-to-right
order; the standard system directories come after.
If a standard system include directory, or a directory specified with
'-isystem', is also specified with '-I', the '-I'
option will be ignored. The directory will still be searched but as a
system directory at its normal position in the system include chain.
This is to ensure that GCC's procedure to fix buggy system headers and
the ordering for the include_next directive are not inadvertently changed.
If you really need to change the search order for system directories,
use the '-nostdinc' and/or '-isystem' options.
-I-
Any directories you specify with '-I' options before the '-I-'
option are searched only for the case of #include "file"
;
they are not searched for #include <file>
.
If additional directories are specified with '-I' options after
the '-I-', these directories are searched for all #include
directives. (Ordinarily all '-I' directories are used
this way.)
In addition, the '-I-' option inhibits the use of the current
directory (where the current input file came from) as the first search
directory for #include "file"
. There is no way to
override this effect of '-I-'. With '-I.' you can specify
searching the directory which was current when the compiler was
invoked. That is not exactly the same as what the preprocessor does
by default, but it is often satisfactory.
'-I-' does not inhibit the use of the standard system directories
for header files. Thus, '-I-' and '-nostdinc' are
independent.
-Ldir
Add directory dir to the list of directories to be searched for '-l'.
-Bprefix
This option specifies where to find the executables, libraries,
include files, and data files of the compiler itself.
The compiler will check to see if the path provided by the '-B'
refers to a directory, and if necessary it will add a directory
separator character at the end of the path.
Another way to specify a prefix much like the '-B' prefix is to use
the environment variable GCC_EXEC_PREFIX
. See Environment
Variables.
-specs=file
Process file after the compiler reads in the standard specs
file, in order to override the defaults that the gcc
driver
program uses when determining what switches to pass to the individual programs.
This does not work in GCC4TI.
gcc
is a driver program. It performs its job by invoking a
sequence of other programs to do the work of compiling, assembling and
linking. GCC interprets its command-line parameters and uses these to
deduce which programs it should invoke, and which command-line options
it ought to place on their command lines. This behavior is controlled
by spec strings. In most cases there is one spec string for each
program that GCC can invoke, but a few programs have multiple spec
strings to control their behavior. The spec strings built into GCC can
be overridden by using the '-specs=' command-line switch to specify
a spec file.
Spec files are plaintext files that are used to construct spec
strings. They consist of a sequence of directives separated by blank
lines.
Since gcc
only performs a small part of the tasks in GCC4TI, spec
strings are more or less irrelevant. For details on specs, see the
original documentation on the net.
The GCC compiler used in GCC4TI is configured for just one target family: the Motorola M680x0 (M68k) family. In the TI-89, TI-92+, and V200 calculators, an MC68000 processor is used, therefore GCC4TI creates code for such a processor by default. However, switches specifying the processor model, such as '-m68020', still exist, although they are not useful. However, there are also options that control the code that is generated specifically for TI calculators; they also start with '-m':
-mno-bss
Output all uninitialized global or static variables as normal data with
zero content. Note that this leads to different semantics if the program is
not compressed or archived: The variables will keep their values even after
program termination, instead of being initialized to zero every time the
program is run. For a better alternative, see
MERGE_BSS
.
-mlong
Consider type int
to be 32 bits wide, like long int
.
The '-mshort' option is enabled by default in GCC4TI; the negative is
actually '-mnoshort', but '-mno-short' and '-mlong' have
been added as aliases. Constants such as INT_MAX
are set to the
appropriate values, and __INT_SHORT__
will be defined if short
integers are used (i.e. if this switch is not used). This option may be
useful if you need to port code from a system which uses long integers.
-mno-tios
Again, this is the negative form of a switch called '-mtios',
which changes the convention for returning pointers from functions, and which
also implies '-fcall-used-d2'. This is necessary to make GCC work
with the TIOS calling conventions, therefore '-mno-tios' may only be
used if no interaction with the operating system is required. Since library
calls also use the TIOS calling convention, they cannot be used either; you
should disable linking against tigcc.a
. Only use this option if
you know exactly what you are doing.
-mmlink
Assume that uninitialized global variables can be handled smartly through BSS blocks even in kernel-less mode.
-mpcrel
Use the pc-relative addressing mode of the 68000 directly, instead of using a global offset table (also known as the relocation table). Therefore, this option produces position-independent code.
-mregparm[=regcount]
Use register passing for all user-defined functions. regcount
data registers plus regcount address registers are used to pass
arguments to functions. If regcount is not specified, a default value
of 2 is used. You should not specify a value higher than 6, or 5 if you use
OPTIMIZE_ROM_CALLS
.
Note that you have to be careful with callback functions if you use this
switch, although you will be warned about incompatiblities.
-mbitfield
Use bit-field instructions.
-malign-int
Aligns int
, long
, long long
,
float
, double
, and long double
variables on a 32-bit
boundary.
-mno-strict-align
-mstrict-align
Do not or do assume that unaligned memory references will be handled by the system.
-mno-merge-sections
Do not merge the .text
and .data
sections,
as GCC4TI normally does (to save space used by relocation).
-mmerge-to-data
When merging sections, merge to .data
rather than to
.text
.
-mrodata-to-text
When not merging sections, put read-only data into .text
rather than .data
.
These machine-independent options control the interface conventions
used in code generation.
Most of them have both positive and negative forms; the negative form
of '-ffoo' would be '-fno-foo'. In the table below, only
one of the forms is listed: the one which is not the default. You
can figure out the other form by either removing 'no-' or adding
it.
-fbounds-check
For front-ends that support it, generate additional code to check that indices used to access arrays are within the declared range. This is currently only supported by the Java and Fortran 77 front-ends, where this option defaults to true and false respectively.
-ftrapv
This option generates traps for signed overflow on addition, subtraction, multiplication operations.
-fexceptions
Enable exception handling. Generates extra code needed to propagate exceptions. In principle, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers, but this is useless in GCC4TI, as the standard OS uses its own exception handling mechanism (see error.h).
-fnon-call-exceptions
Generate code that allows trapping instructions to throw exceptions. Probably useless in GCC4TI.
-funwind-tables
Similar to '-fexceptions', except that it will just generate any needed static data, but will not affect the generated code in any other way. Probably useless in GCC4TI.
-fasynchronous-unwind-tables
Generate unwind table in dwarf2 format, if supported by target machine. The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector).
-fpcc-struct-return
Return "short" struct
and union
values in memory like
longer ones, rather than in registers. This convention is less
efficient, but it has the advantage of allowing intercallability between
GCC-compiled files and files compiled with other compilers, particularly
the Portable C Compiler (pcc).
The precise convention for returning structures in memory depends
on the target configuration macros.
Short structures and unions are those whose size and alignment match
that of some integer type.
Warning: code compiled with the '-fpcc-struct-return'
switch is not binary compatible with code compiled with the
'-freg-struct-return' switch.
Use it to conform to a non-default application binary interface.
-freg-struct-return
Return struct
and union
values in registers when possible.
This is more efficient for small structures than
'-fpcc-struct-return'.
If you specify neither '-fpcc-struct-return' nor
'-freg-struct-return', GCC4TI defaults to '-freg-struct-return'.
Warning: code compiled with the '-freg-struct-return'
switch is not binary compatible with code compiled with the
'-fpcc-struct-return' switch.
Use it to conform to a non-default application binary interface.
-fshort-enums
Allocate to an enum
type only as many bytes as it needs for the
declared range of possible values. Specifically, the enum
type
will be equivalent to the smallest integer type which has enough room.
Warning: the '-fshort-enums' switch causes GCC to generate
code that is not binary compatible with code generated without that switch.
Use it to conform to a non-default application binary interface.
-fshort-double
Use the same size for double
as for float
.
This is always true in GCC4TI, regardless of this switch.
Warning: the '-fshort-double' switch causes GCC to generate
code that is not binary compatible with code generated without that switch.
Use it to conform to a non-default application binary interface.
-fshort-wchar
Override the underlying type for wchar_t
to be short
unsigned int
instead of the default for the target. This option is
useful for building programs to run under WINE.
Warning: the '-fshort-wchar' switch causes GCC to generate
code that is not binary compatible with code generated without that switch.
Use it to conform to a non-default application binary interface.
-fshared-data
Requests that the data and non-const
variables of this
compilation be shared data rather than private data. The distinction
makes sense only on certain operating systems, where shared data is
shared between processes running the same program, while private data
exists in one copy per process.
-fno-common
Allocate even uninitialized global variables in the data section of the
object file, rather than generating them as common blocks. This has the
effect that if the same variable is declared (without extern
) in
two different compilations, you will get an error when you link them.
The only reason this might be useful is if you wish to verify that the
program will work on other systems which always work this way. Currently,
GCC4TI does not support this option, since it needs common symbols to
communicate with the linker.
-fno-ident
Ignore the #ident
directive.
-fno-gnu-linker
Do not output global initializations in the form used by the GNU linker Useless in GCC4TI, because global initializations are not implemented.
-finhibit-size-directive
Don't output a .size
assembler directive, or anything else that
would cause trouble if the function is split in the middle, and the
two halves are placed at locations far apart in memory. This option is
used when compiling crtstuff.c
; you should not need to use it
for anything else.
-fverbose-asm
Put extra commentary information in the generated assembly code to
make it more readable. This option is generally only of use to those
who actually need to read the generated assembly code (perhaps while
debugging the compiler itself).
'-fno-verbose-asm', the default, causes the
extra information to be omitted and is useful when comparing two assembler
files.
-fvolatile
Consider all memory references through pointers to be volatile.
-fvolatile-global
Consider all memory references to extern and global data items to be volatile. GCC does not consider static data items to be volatile because of this switch.
-fvolatile-static
Consider all memory references to static data to be volatile.
-fpic
Generate position-independent code (PIC) suitable for use in a shared library. However, it requires special support of the operating system (like dynamic loaders, etc.). So forget it with the TIOS; maybe some future ASM shells will support this. At the moment, forget this nice option.
-fPIC
If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table.
-ffixed-reg
Treat the register named reg as a fixed register; generated code
should never refer to it (except perhaps as a stack pointer, frame
pointer or in some other fixed role).
This flag does not have a negative form, because it specifies a
three-way choice.
-fcall-used-reg
Treat the register named reg as an allocable register that is
clobbered by function calls. It may be allocated for temporaries or
variables that do not live across a call. Functions compiled this way
will not save and restore the register reg.
It is an error to used this flag with the frame pointer or stack pointer.
Use of this flag for other registers that have fixed pervasive roles in
the machine's execution model will produce disastrous results.
This flag does not have a negative form, because it specifies a
three-way choice.
-fcall-saved-reg
Treat the register named reg as an allocable register saved by
functions. It may be allocated even for temporaries or variables that
live across a call. Functions compiled this way will save and restore
the register reg if they use it.
It is an error to used this flag with the frame pointer or stack pointer.
Use of this flag for other registers that have fixed pervasive roles in
the machine's execution model will produce disastrous results.
A different sort of disaster will result from the use of this flag for
a register in which function values may be returned.
This flag does not have a negative form, because it specifies a
three-way choice.
-freg-relative-reg
Refer to all labels only in relation to the register specified in reg. This can make the code somewhat smaller, but you should use this option with care as it is not fully supported. This option is implemented only in TIGCC/GCC4TI.
-fpack-struct
Pack all structure members together without holes.
Warning: the '-fpack-struct' switch causes GCC to generate
code that is not binary compatible with code generated without that switch.
Additionally, it makes the code suboptimal.
Use it to conform to a non-default application binary interface.
-finstrument-functions
Generate instrumentation calls for entry and exit to functions. Just
after function entry and just before function exit, the following
profiling functions will be called with the address of the current
function and its call site. (On some platforms,
__builtin_return_address
does not work beyond the current
function, so the call site information may not be available to the
profiling functions otherwise.)
void __cyg_profile_func_enter (void *this_fn, void *call_site); void __cyg_profile_func_exit (void *this_fn, void *call_site);
The first argument is the address of the start of the current function,
which may be looked up exactly in the symbol table.
This instrumentation is also done for functions expanded inline in other
functions. The profiling calls will indicate where, conceptually, the
inline function is entered and exited. This means that addressable
versions of such functions must be available. If all your uses of a
function are expanded inline, this may mean an additional expansion of
code size. If you use extern inline
in your C code, an
addressable version of such functions must be provided. (This is
normally the case anyways, but if you get lucky and the optimizer always
expands the functions inline, you might have gotten away without
providing static copies.)
A function may be given the attribute no_instrument_function
, in
which case this instrumentation will not be done. This can be used, for
example, for the profiling functions listed above, high-priority
interrupt routines, and any functions from which the profiling functions
cannot safely be called (perhaps signal handlers, if the profiling
routines generate output or allocate memory).
-fstack-check
Generate code to verify that you do not go beyond the boundary of the stack. As this requires support from the operating system, it probably does not work in GCC4TI.
-fstack-limit-register=reg
-fstack-limit-symbol=sym
-fno-stack-limit
Generate code to ensure that the stack does not grow beyond a certain value,
either the value of a register or the address of a symbol. If the stack
would grow beyond the value, a signal is raised. For most targets,
the signal is raised before the stack overruns the boundary, so
it is possible to catch the signal without taking special precautions.
For instance, if the stack starts at absolute address 0x80000000
and grows downwards, you can use the flags
'-fstack-limit-symbol=__stack_limit' and
'-Wl,--defsym,__stack_limit=0x7ffe0000' to enforce a stack limit
of 128KB. Note that this may only work with the GNU linker.
-fargument-alias
-fargument-noalias
-fargument-noalias-global
Specify the possible relationships among parameters and between parameters and global data.
'-fargument-alias' specifies that arguments (parameters) may alias each other and may alias global storage.
'-fargument-noalias' specifies that arguments do not alias each other, but may alias global storage.
'-fargument-noalias-global' specifies that arguments do not alias each other and do not alias global storage.
Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself.
-fleading-underscore
This option and its counterpart, '-fno-leading-underscore', forcibly
change the way C symbols are represented in the object file. One use
is to help link with legacy assembly code.
Warning: the '-fleading-underscore' switch causes GCC to
generate code that is not binary compatible with code generated without that
switch. Use it to conform to a non-default application binary interface.
-ftls-model=model
Alter the thread-local storage model to be used.
The model argument should be one of global-dynamic
,
local-dynamic
, initial-exec
or local-exec
.
The default without '-fpic' is initial-exec
; with
'-fpic' the default is global-dynamic
.
Useless in TIGCC/GCC4TI, as threads are not supported.
This section describes several environment variables that affect how GCC
operates. Some of them work by specifying directories or prefixes to use
when searching for various kinds of files. Some are used to specify other
aspects of the compilation environment.
Note that you can also specify places to search using options such as
'-B', '-I' and '-L' (see Options for Directory Search).
LANG
LC_CTYPE
LC_MESSAGES
LC_ALL
These environment variables control the way that GCC uses
localization information that allow GCC to work with different
national conventions. GCC inspects the locale categories
LC_CTYPE
and LC_MESSAGES
if it has been configured to do
so. These locale categories can be set to any value supported by your
installation. A typical value is en_UK
for English in the United
Kingdom.
The LC_CTYPE
environment variable specifies character
classification. GCC uses it to determine the character boundaries in
a string; this is needed for some multibyte encodings that contain quote
and escape characters that would otherwise be interpreted as a string
end or escape.
The LC_MESSAGES
environment variable specifies the language to
use in diagnostic messages.
If the LC_ALL
environment variable is set, it overrides the value
of LC_CTYPE
and LC_MESSAGES
; otherwise, LC_CTYPE
and LC_MESSAGES
default to the value of the LANG
environment variable. If none of these variables are set, GCC
defaults to traditional C English behavior.
TMPDIR
If TMPDIR
is set, it specifies the directory to use for temporary
files. GCC uses temporary files to hold the output of one stage of
compilation which is to be used as input to the next stage: for example,
the output of the preprocessor, which is the input to the compiler
proper.
GCC_EXEC_PREFIX
If GCC_EXEC_PREFIX
is set, it specifies a prefix to use in the
names of the subprograms executed by the compiler. No slash is added
when this prefix is combined with the name of a subprogram, but you can
specify a prefix that ends with a slash if you wish.
If GCC_EXEC_PREFIX
is not set, GCC will attempt to figure out
an appropriate prefix to use based on the pathname it was invoked with.
If GCC cannot find the subprogram using the specified prefix, it
tries looking in the usual places for the subprogram.
The default value of GCC_EXEC_PREFIX
is
prefix/lib/gcc-lib/
where prefix is the value
of prefix
when you ran the configure
script.
Other prefixes specified with '-B' take precedence over this prefix.
In addition, the prefix is used in an unusual way in finding the
directories to search for header files. For each of the standard
directories whose name normally begins with /usr/local/lib/gcc-lib
(more precisely, with the value of GCC_INCLUDE_DIR
), GCC tries
replacing that beginning with the specified prefix to produce an
alternate directory name. Thus, with '-Bfoo/', GCC will search
foo/bar
where it would normally search /usr/local/lib/bar
.
These alternate directories are searched first; the standard directories
come next.
COMPILER_PATH
The value of COMPILER_PATH
is a colon-separated list of
directories, much like PATH
. GCC tries the directories thus
specified when searching for subprograms, if it can't find the
subprograms using GCC_EXEC_PREFIX
.
LIBRARY_PATH
The value of LIBRARY_PATH
is a colon-separated list of
directories, much like PATH
. When configured as a native compiler (which GCC4TI is not),
GCC tries the directories thus specified when searching for special
linker files, if it can't find them using GCC_EXEC_PREFIX
. Linking
using GCC also uses these directories when searching for ordinary
libraries for the '-l' option (but directories specified with
'-L' come first).
LANG
This variable is used to pass locale information to the compiler. One way in
which this information is used is to determine the character set to be used
when character literals, string literals and comments are parsed.
When the compiler is configured to allow multibyte characters,
the following values for LANG
are recognized:
C-JIS
Recognize JIS characters.
C-SJIS
Recognize SJIS characters.
C-EUCJP
Recognize EUCJP characters.
If LANG
is not defined, or if it has some other value, then the
compiler will use mblen and mbtowc as defined by the default locale to
recognize and translate multibyte characters.
Some additional environments variables affect the behavior of the preprocessor.
CPATH
C_INCLUDE_PATH
Each variable's value is a list of directories separated by a special
character, much like PATH
, in which to look for header files.
The special character, PATH_SEPARATOR
, is target-dependent and
determined at GCC build time. For Windows-based targets it is a
semicolon, and for almost all other targets it is a colon.
CPATH
specifies a list of directories to be searched as if
specified with '-I', but after any paths given with '-I'
options on the command line.
C_INCLUDE_PATH
specifies a list of directories
to be searched as if specified with '-isystem', but after any
paths given with '-isystem' options on the command line.
In all these variables, an empty element instructs the compiler to
search its current working directory. Empty elements can appear at the
beginning or end of a path. For instance, if the value of
CPATH
is :/special/include
, that has the same
effect as -I. -I/special/include
.
DEPENDENCIES_OUTPUT
If this variable is set, its value specifies how to output
dependencies for Make based on the non-system header files processed
by the compiler. System header files are ignored in the dependency
output.
The value of DEPENDENCIES_OUTPUT
can be just a file name, in
which case the Make rules are written to that file, guessing the target
name from the source file name. Or the value can have the form
file target
, in which case the rules are written to
file file using target as the target name.
In other words, this environment variable is equivalent to combining
the options '-MM' and '-MF'
(see Options Controlling the Preprocessor),
with an optional '-MT' switch, too.
SUNPRO_DEPENDENCIES
This variable is the same as DEPENDENCIES_OUTPUT
(see above),
except that system header files are not ignored, so it implies
'-M' rather than '-MM'
(see Options Controlling the Preprocessor).
However, the dependence on the main input file is omitted.
Original Version: GCC Command Options
Published by the Free Software Foundation
59 Temple Place - Suite 330
Boston, MA 02111-1307 USA
Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002 Free Software Foundation, Inc.
Modifications for TIGCC: GCC Command-Line Options
Published by the TIGCC Team
Copyright © 2000, 2001, 2002 Zeljko Juric, Sebastian Reichelt, Kevin Kofler
Modifications for GCC4TI: GCC Command-Line Options
Published by the GCC4TI Project
Copyright © 2009, 2010, 2011 Lionel Debroux