diff options
author | DJ Delorie <dj@redhat.com> | 2003-04-17 19:18:58 -0400 |
---|---|---|
committer | DJ Delorie <dj@gcc.gnu.org> | 2003-04-17 19:18:58 -0400 |
commit | c409ea0d30ef28e68ff6b4fcb699ba013ee947f1 (patch) | |
tree | 432d0630d4f7f8857bbaeabf962e23436cceb28b /gcc/doc/tm.texi | |
parent | 368018184c55e6e262dc1acfe8b21a674b170e75 (diff) | |
download | gcc-c409ea0d30ef28e68ff6b4fcb699ba013ee947f1.zip gcc-c409ea0d30ef28e68ff6b4fcb699ba013ee947f1.tar.gz gcc-c409ea0d30ef28e68ff6b4fcb699ba013ee947f1.tar.bz2 |
toplev.c (target_options): Add value field.
* toplev.c (target_options): Add value field.
(set_target_switch): Handle target options with values.
* doc/tm.texi: Document how fixed vs variable target
options work.
* config/alpha/alpha.h, config/arc/arc.h, config/avr/avr.h,
config/c4x/c4x.h, config/cris/aout.h, config/cris/cris.h,
config/d30v/d30v.h, config/dsp16xx/dsp16xx.h,
config/frv/frv.h, config/i386/i386.h, config/ia64/ia64.h,
config/m32r/m32r.h, config/m68hc11/m68hc11.h,
config/m68k/m68k.h, config/m88k/m88k.h, config/mcore/mcore.h,
config/mips/mips.h, config/mmix/mmix.h, config/pa/pa.h,
config/rs6000/rs6000.h, config/rs6000/sysv4.h,
config/s390/s390.h, config/sparc/sparc.h, config/v850/v850.h:
Add value initializer to target options.
From-SVN: r65756
Diffstat (limited to 'gcc/doc/tm.texi')
-rw-r--r-- | gcc/doc/tm.texi | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index e17d5a1..b824b1e 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -761,17 +761,26 @@ This macro is similar to @code{TARGET_SWITCHES} but defines names of command options that have values. Its definition is an initializer with a subgrouping for each command option. -Each subgrouping contains a string constant, that defines the fixed part -of the option name, the address of a variable, and a description string. -Non-empty description strings should be marked with @code{N_(@dots{})} for -@command{xgettext}. Please do not mark empty strings because the empty -string is reserved by GNU gettext. @code{gettext("")} returns the header entry -of the message catalog with meta information, not the empty string. +Each subgrouping contains a string constant, that defines the option +name, the address of a variable, a description string, and a value. +Non-empty description strings should be marked with @code{N_(@dots{})} +for @command{xgettext}. Please do not mark empty strings because the +empty string is reserved by GNU gettext. @code{gettext("")} returns the +header entry of the message catalog with meta information, not the empty +string. + +If the value listed in the table is @code{NULL}, then the variable, type +@code{char *}, is set to the variable part of the given option if the +fixed part matches. In other words, if the first part of the option +matches what's in the table, the variable will be set to point to the +rest of the option. This allows the user to specify a value for that +option. The actual option name is made by appending @samp{-m} to the +specified name. Again, each option should also be documented in +@file{invoke.texi}. -The variable, type @code{char *}, is set to the variable part of the -given option if the fixed part matches. The actual option name is made -by appending @samp{-m} to the specified name. Again, each option should -also be documented in @file{invoke.texi}. +If the value listed in the table is non-@code{NULL}, then the option +must match the option in the table exactly (with @samp{-m}), and the +variable is set to point to the value listed in the table. Here is an example which defines @option{-mshort-data-@var{number}}. If the given option is @option{-mshort-data-512}, the variable @code{m88k_short_data} @@ -781,7 +790,38 @@ will be set to the string @code{"512"}. extern char *m88k_short_data; #define TARGET_OPTIONS \ @{ @{ "short-data-", &m88k_short_data, \ - N_("Specify the size of the short data section") @} @} + N_("Specify the size of the short data section"), 0 @} @} +@end smallexample + +Here is an variant of the above that allows the user to also specify +just @option{-mshort-data} where a default of @code{"64"} is used. + +@smallexample +extern char *m88k_short_data; +#define TARGET_OPTIONS \ + @{ @{ "short-data-", &m88k_short_data, \ + N_("Specify the size of the short data section"), 0 @} \ + @{ "short-data", &m88k_short_data, "", "64" @}, + @} +@end smallexample + +Here is an example which defines @option{-mno-alu}, @option{-malu1}, and +@option{-malu2} as a three-state switch, along with suitable macros for +checking the state of the option (documentation is elided for brevity). + +@smallexample +[chip.c] +char *chip_alu = ""; /* Specify default here. */ + +[chip.h] +extern char *chip_alu; +#define TARGET_OPTIONS \ + @{ @{ "no-alu", &chip_alu, "", "" @}, \ + @{ "alu1", &chip_alu, "", "1" @}, \ + @{ "alu2", &chip_alu, "", "2" @}, @} +#define TARGET_ALU (chip_alu[0] != '\0') +#define TARGET_ALU1 (chip_alu[0] == '1') +#define TARGET_ALU2 (chip_alu[0] == '2') @end smallexample @findex TARGET_VERSION |