gcc/gcc/opth-gen.awk

197 lines
4.8 KiB
Awk
Raw Normal View History

# Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
# Contributed by Kelley Cook, June 2004.
# Original code from Neil Booth, May 2003.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This Awk script reads in the option records generated from
# opt-gather.awk, combines the flags of duplicate options and generates a
# C header file.
#
# This program uses functions from opt-functions.awk
# Usage: awk -f opt-functions.awk -f opth-gen.awk < inputfile > options.h
BEGIN {
n_opts = 0
n_langs = 0
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
n_extra_masks = 0
quote = "\042"
comma = ","
FS=SUBSEP
}
# Collect the text and flags of each option into an array
{
if ($1 == "Language") {
langs[n_langs] = $2
n_langs++;
}
else {
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
name = opt_args("Mask", $1)
if (name == "") {
opts[n_opts] = $1
flags[n_opts] = $2
help[n_opts] = $3
n_opts++;
}
else {
extra_masks[n_extra_masks++] = name
}
}
}
# Dump out an enumeration into a .h file.
# Combine the flags of duplicate options.
END {
print "/* This file is auto-generated by opts.sh. */"
print ""
print "#ifndef OPTIONS_H"
print "#define OPTIONS_H"
print ""
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
print "extern int target_flags;"
print "extern int target_flags_explicit;"
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
print ""
for (i = 0; i < n_opts; i++) {
name = var_name(flags[i]);
if (name == "")
continue;
opt-functions.awk (var_type): New function. * opt-functions.awk (var_type): New function. (var_set): Use CLVC_STRING if var_type returns "const char *". * opth-gen.awk: Use var_type to find out the types of variables. Don't print comments above each "extern" definition. * optc-gen.awk: Use var_type in the same way. * opts.h (cl_var_cond): Rename to... (cl_var_type): ...this. Add CLVC_STRING. (cl_option): Make "flag_var" a "void *" pointer. Replace "var_cond" with "var_type". * opts.c (handle_option, option_enabled): Update after above name change. Cast flag_var before using it. Handle CLVC_STRING. * config/alpha/alpha.h (alpha_tls_size): Delete. * config/alpha/alpha.c (alpha_tls_size, alpha_cpu_string) (alpha_tune_string, alpha_tp_string, alpha_fprm_string) (alpha_fptm_string, alpha_mlat_string): Delete. (alpha_handle_option): Don't set the above variables here. Use the integer argument to check the validity of -mtls-size=. * config/alpha/alpha.opt (mcpu=, mtune=, mfp-rounding-mode=) (mfp-trap-mode=, mtrap-precision=, mmemory-latency=): Add Var()s. (mtls-size=): Likewise. Convert to a UInteger and initialize the variable to 32. * config/arc/arc.c (arc_cpu_string, arc_text_string) (arc_data_string, arc_rodata_string): Delete. (arc_handle_option): Don't set the above variables here. * config/arc/arc.opt (mcpu=, mtext=, mdata=, mrodata=): Add Var()s and initialize them. * config/arm/arm.c (target_fpu_name, target_fpe_name) (target_float_abi_name, target_abi_name, structure_size_string) (arm_pic_register_string): Delete. (arm_handle_option): Don't set the above variables here, except in the handling of -mhard-float and -msoft-float. * config/arm/arm.opt (mabi=, mfloat-abi=, mfp=, mfpe=, mfpu=) (mpic-register=, mstructure-size-boundary=): Add Var()s. * config/avr/avr.c (avr_init_stack, avr_mcu_name, TARGET_HANDLE_OPTION) (avr_handle_option): Delete. * config/avr/avr.opt (mmcu=, minit-stack=): Add Var()s and initialize them. * config/bfin/bfin.c (bfin_library_id): Delete. (bfin_handle_option): Don't set it. * config/bfin/bfin.opt (mshared-library-id=): Add Var(). * config/c4x/c4x.h (c4x_rpts_cycles): Delete. * config/c4x/c4x.c (c4x_rpts_cycles): Delete. (c4x_handle_option): Don't set c4x_rpts_cycles here. * config/c4x/c4x.opt (mrpts=): Add Var(). * config/cris/aout.h (CRIS_SUBTARGET_HANDLE_OPTION): Don't set cris_elinux_stacksize_str here. * config/cris/aout.opt (melinux-stacksize=): Add Var(). * config/cris/cris.h (cris_max_stackframe_str, cris_cpu_str) (cris_tune_str, cris_elinux_stacksize_str): Delete. * config/cris/cris.c (cris_max_stackframe_str, cris_cpu_str) (cris_tune_str, cris_elinux_stacksize_str): Delete. (cris_handle_option): Don't set the above variables here. * config/cris/cris.opt (mcpu=, march=, mtune=, mmax-stackframe=) (max-stackframe=): Add Var()s. * config/i386/i386.h (ix86_tune_string, ix86_arch_string): Delete. * config/i386/i386.c (ix86_cmodel_string, ix86_asm_string) (ix86_tls_dialect_string, ix86_tune_string, ix86_arch_string) (ix86_fpmath_string, ix86_regparm_string, ix86_align_loops_string) (ix86_align_jumps_string, ix86_preferred_stack_boundary_string) (ix86_branch_cost_string, ix86_align_funcs_string): Delete. (ix86_handle_option): Don't set the above variables here. * config/i386/i386.opt (malign-functions=, malign-jumps=) (malign-loops=, march=, masm=, mbranch-cost=, mcmodel=, mfpmath=) (mpreferred-stack-boundary=, mregparm=, mtls-dialect=, mtune=): Add Var()s. * config/ia64/ia64.h (ia64_tls_size): Delete. * config/ia64/ia64.c (ia64_tls_size): Delete. (ia64_handle_option): Treat -mtls-size= as a UInteger option, reading the integer argument from the "value" parameter. Don't set ia64_tls_size here. * config/ia64/ia64.opt (mtls-size=): Turn into a UInteger option. Add Var() and Init(). * config/m32r/m32r.h (m32r_cache_flush_func): Delete. (m32r_cache_flush_trap): Delete. * config/m32r/m32r.c (m32r_cache_flush_func): Delete. (m32r_cache_flush_trap): Delete. (m32r_handle_option): Don't set the above variables when handling -mflush-func= and -mflush-trap=. * config/m32r/m32r.opt (-mflush-func=, -mflush-trap=): Add Var()s and Init()s. * config/mips/mips.h (mips_cache_flush_func): Delete. * config/mips/mips.c (mips_arch_string, mips_tune_string) (mips_cache_flush_func): Delete. (mips_handle_option): Don't set the above variables when handling -march=, -mtune= and -mflush-func=. * config/mips/mips.opt (march=, mflush-func=, mtune=): Add Var()s. * config/s390/s390.c (s390_arch_string): Delete. (s390_handle_option): Don't set it here. * config/s390/s390.opt (march=): Add Var(). * config/sparc/sparc.h (sparc_cmodel_string): Delete. * config/sparc/sparc.c (sparc_cmodel_string): Delete. (sparc_handle_option): Don't set it here. * config/sparc/sparc.opt (mcmodel=): Add Var(). From-SVN: r100185
2005-05-26 07:28:04 +02:00
print "extern " var_type(flags[i]) name ";"
}
print ""
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
vname = var_name(flags[i])
mask = "MASK_"
if (vname != "") {
mask = "OPTION_MASK_"
}
if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define " mask name " (1 << " masknum[vname]++ ")"
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
}
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
for (i = 0; i < n_extra_masks; i++) {
print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")"
}
for (var in masknum) {
if (masknum[var] > 31) {
if (var == "")
print "#error too many target masks"
else
print "#error too many masks for " var
}
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
}
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
print ""
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
vname = var_name(flags[i])
macro = "OPTION_"
mask = "OPTION_MASK_"
if (vname == "") {
vname = "target_flags"
macro = "TARGET_"
mask = "MASK_"
}
if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define " macro name \
" ((" vname " & " mask name ") != 0)"
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
}
optc-gen.awk: Handle stand-alone Mask records. * optc-gen.awk: Handle stand-alone Mask records. * opth-gen.awk: Likewise. * doc/options.texi (Option file format): Document them. * config.gcc (sparc-*-netbsdelf*, sparc-*-linux*, sparc64-*-freebsd*, sparc64-*-linux*, sparc64-*-netbsd*): Add long-double-switch.opt. (sparc64-*-openbsd*, sparc64-*-elf*): Add little-endian.opt. * config/sparc/sparc.h (MASK_FPU, MASK_UNALIGNED_DOUBLES, MASK_V8, MASK_SPARCLITE, MASK_SPARCLET, MASK_V9, MASK_DEPRECATED_V8_INSNS, MASK_IMPURE_TEXT, MASK_APP_REGS, MASK_HARD_QUAD, MASK_LITTLE_ENDIAN, MASK_PTR64, MASK_64BIT, MASK_STACK_BIAS, MASK_FPU_SET, MASK_VIS, MASK_V8PLUS, MASK_FASTER_STRUCTS, MASK_LONG_DOUBLE_128): Delete. (TARGET_FPU, TARGET_UNALIGNED_DOUBLES, TARGET_V8, TARGET_SPARCLITE, TARGET_SPARCLET, TARGET_V9, TARGET_DEPRECATED_V8_INSNS, TARGET_IMPURE_TEXT, TARGET_APP_REGS, MASK_HARD_QUAD, TARGET_LITTLE_ENDIAN, TARGET_PTR64, TARGET_64BIT, MASK_STACK_BIAS, TARGET_FPU_SET, TARGET_VIS, TARGET_V8PLUS, TARGET_FASTER_STRUCTS, TARGET_LONG_DOUBLE_128): Likewise. (TARGET_SWITCHES, SUBTARGET_SWITCHES): Likewise. (TARGET_OPTIONS, SUBTARGET_OPTIONS): Likewise. * config/sparc/freebsd.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/linux64.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/netbsd-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. * config/sparc/sparc.c (fpu_option_set): New global. (sparc_handle_option): New function. (sparc_override_options): Test fpu_option_set. (TARGET_DEFAULT_TARGET_FLAGS): Set to TARGET_DEFAULT. (TARGET_HANDLE_OPTION): Set to sparc_handle_option. * config/sparc/sparc.opt: New file. * config/sparc/little-endian.opt: Likewise. * config/sparc/long-double-switch.opt: Likewise. From-SVN: r98078
2005-04-13 10:47:23 +02:00
for (i = 0; i < n_extra_masks; i++) {
print "#define TARGET_" extra_masks[i] \
" ((target_flags & MASK_" extra_masks[i] ") != 0)"
}
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
print ""
for (i = 0; i < n_opts; i++) {
opt = opt_args("InverseMask", flags[i])
re PR target/24837 (move dynamic linker names out of LINK_SPEC and into new DYNAMIC_LINKER) PR target/24837 * config.gcc: Define UCLIBC_DEFAULT to 0 or 1. * opth-gen.awk: Handle Var and InverseMask together. * config/linux.opt (muclibc, mglibc): Use Var(linux_uclibc). * config/linux.h: Use #if not #ifdef for testing UCLIBC_DEFAULT. (TARGET_C99_FUNCTIONS): Test OPTION_GLIBC not TARGET_GLIBC. (CHOOSE_DYNAMIC_LINKER): Give an error for -mglibc and -muclibc used together. (UCLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER64, LINUX_DYNAMIC_LINKER32, LINUX_DYNAMIC_LINKER64): Define. * config/alpha/linux-elf.h (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, CHOOSE_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER): Define. (ELF_DYNAMIC_LINKER): Define to LINUX_DYNAMIC_LINKER. * config/alpha/linux.h (TARGET_C99_FUNCTIONS): Define to TARGET_GLIBC. * config/cris/linux.h (GLIBC_DYNAMIC_LINKER): Define. (CRIS_LINK_SUBTARGET_SPEC): Pass a -dynamic-linker option. * config/frv/linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. (TARGET_C99_FUNCTIONS): Don't define. * config/i386/linux.h (DYNAMIC_LINKER): Rename to GLIBC_DYNAMIC_LINKER. (SUBTARGET_EXTRA_SPECS): Use LINUX_DYNAMIC_LINKER. * config/i386/linux64.h (GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER32 and LINUX_DYNAMIC_LINKER64. * config/ia64/linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/m32r/linux.h (GLIBC_DYNAMIC_LINKE): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/m68k/linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/mips/linux64.h (GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64, GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, LINUX_DYNAMIC_LINKERN32): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKERN32, LINUX_DYNAMIC_LINKER64 and LINUX_DYNAMIC_LINKER32. * config/mn10300/linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/pa/pa-linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/rs6000/linux.h (TARGET_C99_FUNCTIONS): Define to TARGET_GLIBC. * config/rs6000/linux64.h (TARGET_C99_FUNCTIONS): Likewise. (GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER64, CHOOSE_DYNAMIC_LINKER, CHOOSE_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER32, LINUX_DYNAMIC_LINKER64): Define. (LINK_OS_LINUX_SPEC32): Use LINUX_DYNAMIC_LINKER32. (LINK_OS_LINUX_SPEC64): Use LINUX_DYNAMIC_LINKER64. * config/rs6000/sysv4.h (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, CHOOSE_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER): Define. (LINK_OS_LINUX_SPEC): Use LINUX_DYNAMIC_LINKE. * config/s390/linux.h (GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER32 and LINUX_DYNAMIC_LINKER64. * config/sh/linux.h (GLIBC_DYNAMIC_LINKER): Define. (SUBTARGET_LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * config/sparc/linux.h (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, CHOOSE_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. (TARGET_C99_FUNCTIONS): Define to TARGET_GLIBC. * config/sparc/linux64.h (GLIBC_DYNAMIC_LINKER32, GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER64, CHOOSE_DYNAMIC_LINKER, LINUX_DYNAMIC_LINKER32, LINUX_DYNAMIC_LINKER64): Define. (LINK_ARCH32_SPEC): Use LINUX_DYNAMIC_LINKER32. (LINK_ARCH64_SPEC, LINK_SPEC): Use LINUX_DYNAMIC_LINKER64. (TARGET_C99_FUNCTIONS): Define to TARGET_GLIBC. * config/xtensa/linux.h (GLIBC_DYNAMIC_LINKER): Define. (LINK_SPEC): Use LINUX_DYNAMIC_LINKER. * doc/invoke.texi (-muclibc): Remove caveat about supported targets. testsuite: * gcc.dg/glibc-uclibc-1.c, gcc.dg/glibc-uclibc-2.c: New tests. From-SVN: r111235
2006-02-18 12:12:51 +01:00
if (opt ~ ",") {
vname = var_name(flags[i])
macro = "OPTION_"
mask = "OPTION_MASK_"
if (vname == "") {
vname = "target_flags"
macro = "TARGET_"
mask = "MASK_"
}
print "#define " macro nth_arg(1, opt) \
" ((" vname " & " mask nth_arg(0, opt) ") == 0)"
}
config.gcc (extra_options): New variable for listing option files. * config.gcc (extra_options): New variable for listing option files. Add ${cpu_type}/${cpu_type}.opt to it if that file exists. * configure.ac (extra_opt_files): New AC_SUBST variable. (tm_file_list, tm_include_list): Include options.h first. * configure: Regenerate. * Makefile.in (extra_opt_files, ALL_OPT_FILES): New variables. (s-options): Use $(ALL_OPT_FILES) instead of $(lang_opt_files) (s-options-h): New rule. (options.h): Depend on it. (TEXI_GCCINT_FILES): Add options.texi. * hooks.h (hook_bool_size_t_constcharptr_int_true): Declare. * hooks.c (hook_bool_size_t_constcharptr_int_true): New function. * target.h (gcc_target): Add default_target_flags and handle_option. * target-def.h (TARGET_DEFAULT_TARGET_FLAGS) (TARGET_HANDLE_OPTION): New macros. (TARGET_INITIALIZER): Include them. * opt-functions.awk (opt_args, nth_arg): New functions. (switch_flags): Handle the "Target" flag. (var_args): Delete. (var_name): Use opt_args and nth_arg. (var_set, var_ref): Likewise. Handle "Mask" and "InverseMask". * opth-gen.awk: Declare target_flags. Declare MASK_* and TARGET_* macros for the "Mask" and "InverseMask" options. * opts.h (cl_var_cond): New enum. (cl_option): Replace the "has_set_value" and "set_value" fields with "var_cond" and "var_value". (CL_TARGET): New macro. (option_enabled, print_filtered_help): Declare. (decode_options): Move definition. * opts.c (handle_option): Search for the original option before removing any "no-" prefix. Handle CL_TARGET. Adjust for the new var_cond and var_value fields. Use targetm.handle_option to handle target options. (decode_options): Set target_flags to targetm.default_target_flags. (print_filtered_help): Make global. Handle CL_TARGET. (option_enabled): New function. * toplev.c (target_switches): Guard with #ifdef TARGET_SWITCHES. (display_target_options, set_target_switch, print_switch_values) (default_pch_valid_p): Guard uses of target_switches with #ifdef TARGET_SWITCHES. Also... (display_target_options): Display the CL_TARGET entries in cl_options. (set_target_option): Don't complain about the "" option when TARGET_SWITCHES is undefined. (print_switch_values): Use option_enabled. (default_pch_valid_p): Check cl_options[] when looking for something that has changed the value of target_flags. * c.opt: Remove documentation from top of file. * doc/gccint.texi: Add an "Options" chapter. Include options.texi. * doc/sourecebuild.texi: Refer to the new options documentation instead of c.opt. Document machine-specific .opt files. * doc/tm.texi (target_flags): Say that this variable is declared by options.h. (TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Document. (TARGET_SWITCHES, TARGET_OPTIONS): Refer to the option files as an alternative. * doc/options.texi: New file. From-SVN: r96448
2005-03-14 21:18:43 +01:00
}
print ""
for (i = 0; i < n_langs; i++) {
macros[i] = "CL_" langs[i]
gsub( "[^A-Za-z0-9_]", "X", macros[i] )
s = substr(" ", length (macros[i]))
print "#define " macros[i] s " (1 << " i ")"
}
print "#define CL_LANG_ALL ((1 << " n_langs ") - 1)"
print ""
print "enum opt_code"
print "{"
for (i = 0; i < n_opts; i++)
back_chain[i] = "N_OPTS";
for (i = 0; i < n_opts; i++) {
# Combine the flags of identical switches. Switches
# appear many times if they are handled by many front
# ends, for example.
while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
flags[i + 1] = flags[i] " " flags[i + 1];
i++;
}
len = length (opts[i]);
enum = "OPT_" opts[i]
if (opts[i] == "finline-limit=")
enum = enum "eq"
gsub ("[^A-Za-z0-9]", "_", enum)
# If this switch takes joined arguments, back-chain all
# subsequent switches to it for which it is a prefix. If
# a later switch S is a longer prefix of a switch T, T
# will be back-chained to S in a later iteration of this
# for() loop, which is what we want.
if (flag_set_p("Joined.*", flags[i])) {
for (j = i + 1; j < n_opts; j++) {
if (substr (opts[j], 1, len) != opts[i])
break;
back_chain[j] = enum;
}
}
s = substr(" ", length (opts[i]))
if (i + 1 == n_opts)
comma = ""
if (help[i] == "")
hlp = "0"
else
hlp = "N_(\"" help[i] "\")";
print " " enum "," s "/* -" opts[i] " */"
}
print " N_OPTS"
print "};"
print ""
print "#endif /* OPTIONS_H */"
}