|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
To add a new command-line option to
g77, first decide
what kind of option you wish to add.
gcc documentation for one
or more options that is most closely like the one you want to add
(in terms of what kind of effect it has, and so on) to
help clarify its nature.
gcc, but they apply only when compiling Fortran programs.
Fortran options are listed in the file
which is used during the build of
build a list of all options that are accepted by
at least one language's compiler.
This list goes into the
in `gcc/toplev.c', which uses this array to
determine whether a particular option should be
offered to the linked-in front end for processing
lang_option_decode, which, for
g77, is in `egcs/gcc/f/com.c' and just
If the linked-in front end "rejects" a particular option passed to it, `toplev.c' just ignores the option, because some language's compiler is willing to accept it.
This allows commands like `gcc -fno-asm foo.c bar.f'
to work, even though Fortran compilation does
not currently support the `-fno-asm' option;
even though the
f771 version of
rejects `-fno-asm', `toplev.c' doesn't
produce a diagnostic because some other language (C)
does accept it.
This also means that commands like `g77 -fno-asm foo.f' yield no diagnostics, despite the fact that no phase of the command was able to recognize and process `-fno-asm'---perhaps a warning about this would be helpful if it were possible.
Code that processes Fortran options is found in
This code needs to check positive and negative forms
of each option.
The defaults for Fortran options are set in their
global definitions, also found in `egcs/gcc/f/top.c'.
Many of these defaults are actually macros defined
in `egcs/gcc/f/target.h', since they might be
However, since, in practice, GNU compilers
should behave the same way on all configurations
(especially when it comes to language constructs),
the practice of setting defaults in `target.h'
is likely to be deprecated and, ultimately, stopped
in future versions of
Accessor macros for Fortran options, used by code
g77 FFE, are defined in `egcs/gcc/f/top.h'.
Compiler options are listed in `gcc/toplev.c'
in the array
An option not listed in
looked up in
f_options and handled from there.
The defaults for compiler options are set in the global definitions for the corresponding variables, some of which are in `gcc/toplev.c'.
You can set different defaults for Fortran-oriented
or Fortran-reticent compiler options by changing
the source code of
g77 and rebuilding.
How to do this depends on the version of
G77 0.5.24 (EGCS 1.1)
G77 0.5.25 (EGCS 1.2)
lang_init_optionsroutine in `egcs/gcc/f/com.c'.
(Note that these versions of
perform internal consistency checking automatically
when the `-fversion' option is specified.)
G77 0.5.24 (EGCS 1.0)
f771handles the `-fset-g77-defaults' option, which is always provided as the first option when called by
This code is in
ffe_decode_options in `egcs/gcc/f/top.c'.
Have it change just the variables that you want to default
to a different setting for Fortran compiles compared to
compiles of other languages.
The `-fset-g77-defaults' option is passed to
automatically because of the specification information
kept in `egcs/gcc/f/lang-specs.h'.
This file tells the
gcc command how to recognize,
in this case, Fortran source files (those to be preprocessed,
and those that are not), and further, how to invoke the
appropriate programs (including
f771) to process
those source files.
It is in `egcs/gcc/f/lang-specs.h' that `-fset-g77-defaults', `-fversion', and other options are passed, as appropriate, even when the user has not explicitly specified them. Other "internal" options such as `-quiet' also are passed via this mechanism.
|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|