gcc/gcc/opts.h

225 lines
8.2 KiB
C
Raw Normal View History

Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
/* Command line option handling.
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
This file is part of GCC.
GCC 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
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
version.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
#ifndef GCC_OPTS_H
#define GCC_OPTS_H
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
/* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */
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
enum cl_var_type {
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
/* The switch is enabled when FLAG_VAR is nonzero. */
CLVC_BOOLEAN,
/* The switch is enabled when FLAG_VAR == VAR_VALUE. */
CLVC_EQUAL,
/* The switch is enabled when VAR_VALUE is not set in FLAG_VAR. */
CLVC_BIT_CLEAR,
/* The switch is enabled when VAR_VALUE is set in FLAG_VAR. */
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
CLVC_BIT_SET,
/* The switch takes a string argument and FLAG_VAR points to that
argument. */
CLVC_STRING
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
};
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
struct cl_option
{
const char *opt_text;
const char *help;
const char *missing_argument_error;
unsigned short back_chain;
unsigned char opt_len;
re PR target/26885 (-m64 -m32 no longer creates 32-bit object) gcc/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Makefile.in (GCC_OBJS): New. (OBJS-common): Add opts-common.o. (xgcc$(exeext)): Replace gcc.o with $(GCC_OBJS). (cpp$(exeext)): Likewise. (gcc.o): Also depend on opts.h. (opts-common.o): New. * common.opt (gcoff): Add Negative(gdwarf-2). (gdwarf-2): Add Negative(gstabs). (gstabs): Add Negative(gstabs+). (gstabs+): Add Negative(gvms). (gvms): Add Negative(gxcoff). (gxcoff): Add Negative(gxcoff+). (gxcoff+): Add Negative(gcoff). * config/i386/i386.opt (m32): Add Negative(m64). (m64): Add Negative(m32). * doc/options.texi: Document the Negative option. * gcc.c: Include "opts.h". (main): Call prune_options after expandargv. * optc-gen.awk: Generate common declarations for all flag variables in options.c. Output the neg_index field. * opts.c (find_opt): Moved to ... * opts-common.c: Here. New file. * opts.h (cl_option): Add a neg_index field. (find_opt): New. (prune_options): Likewise. gcc/cp/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GXX_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/fortran/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GFORTRAN_D_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/java/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in ($(GCJ)$(exeext)): Replace gcc.o with $(GCC_OBJS). gcc/treelang/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (gtreelang$(exeext)): Replace gcc.o with $(GCC_OBJS). From-SVN: r113824
2006-05-16 16:27:18 +02:00
int neg_index;
Makefile.in: Update to use common.opt and lang_opt_files. * Makefile.in: Update to use common.opt and lang_opt_files. (c-options.c, c-options.h): Remove. (options.c, options.h): Add. * c-opts.c: Include options.h not c-options.h. * common.opt: New file. * configure, configure.in: Add lang_opt_files. * opts.c: Include flags.h and diagnostic.h. (common_handle_option): New. (handle_option): Update to recognize common options and all language-dependent options. * opts.h (CL_F77, CL_JAVA, CL_ADA, CL_COMMON, CL_TREELANG): New. (struct cl_option): Make flags of type int. * opts.h: Flag option with front ends to which it applies. Handle duplicate options. * toplev.c (filename): Remove. (independent_decode_option): Don't handle filenames and -quiet. (process_options, do_compile): Update. ada: * Make-lang.in: Update to use options.c and options.h. * misc.c: Include options.h not aoptions.h. (gnat_handle_option): Abort on unrecognized switch. (gnat_init_options): Request Ada switches. cp: * Make-lang.in: Remove c-options.o. f: * Make-lang.in: Update to use options.c and options.h. * top.c: Include options.h not f-options.h. (gnat_handle_option): Abort on unrecognized switch. (ffe_init_options): From com.c. Request F77 options. (ffe_handle_options): Abort on unrecognized switch. * com.c (ffe_init_options): Move to top.c. * top.h (fee_init_options): New. java: * Make-lang.in: Update to use options.c and options.h. * lang.c: Include options.h not j-options.h. (java_handle_option): Abort on unrecognized option. (java_init_options): Request Java switches. treelang: * Make-lang.in: Update to use options.c and options.h. * tree1.c: Include options.h not t-options.h. (treelang_init_options): New. (treelang_handle_option): Abort on unrecognized switch. * treetree.c (LANG_HOOKS_INIT_OPTIONS): Override. * treetree.h (treelang_init_options): New. From-SVN: r67941
2003-06-14 14:26:36 +02:00
unsigned int flags;
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
void *flag_var;
enum cl_var_type var_type;
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
int var_value;
};
/* Records that the state of an option consists of SIZE bytes starting
at DATA. DATA might point to CH in some cases. */
struct cl_option_state {
const void *data;
size_t size;
char ch;
};
extern const struct cl_option cl_options[];
extern const unsigned int cl_options_count;
extern const char *const lang_names[];
invoke.texi (Overall Options): Document --help=. * doc/invoke.texi (Overall Options): Document --help=. * gcc.c (target_help_flag): Rename to print_subprocess_flag. (cc1_options): Pass --help= on to cc1. (display_help): Add description of --help=. (process_command): Add code to handle --help=. Allow translated --help and --target-help switches to be passed on to compiler sub-process. (main): Remove unused if statement. * opts.c (columns): Remove. (LEFT_COLUMN): Define. (wrap_help): Add columns argument. (print_filtered_help): Change parameters to be an include bitmask, an exclude bitmask, an any bitmask and the column width. Move the code to display the params list here. Add code to display the status of options rather than their descriptions if the quiet flag is not active. (print_specific_help): Change parameters to be an include bitmask, an exclude bitmask and an any bitmask. Move code to look up the column width here. Decide upon the title for an options listing. (common_handle_options): Add code to handle --help=. Adapt code for --help and --target-help to use the revised form of the print_specific_help function. (print_help): Delete. (print_param_help): Delete. (print_switch): Delete. * opts.h (cl_lang_count): Add prototype. (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_MIN_OPTION_CLASS, CL_MAX_OPTION_CLASS): New defines. * optc-gen.awk: Add construction of cl_lang_count. * c.opt: Add Warning attribute to warning options and Optimization attribute to optimization options. * common.opt: Likewise. Add --help=. Add -fhelp and -ftarget-help as aliases for the transformed --help and --target-help options. * opt-functions.awk: Add code to handle Warning and Optimization attributes. From-SVN: r121849
2007-02-12 17:25:14 +01:00
extern const unsigned int cl_lang_count;
#define CL_PARAMS (1 << 14) /* Fake entry. Used to display --param info with --help. */
#define CL_WARNING (1 << 15) /* Enables an (optional) warning message. */
#define CL_OPTIMIZATION (1 << 16) /* Enables an (optional) optimization. */
#define CL_DRIVER (1 << 17) /* Driver option. */
#define CL_TARGET (1 << 18) /* Target-specific option. */
#define CL_COMMON (1 << 19) /* Language-independent. */
#define CL_MIN_OPTION_CLASS CL_PARAMS
invoke.texi (Overall Options): Document --help=. * doc/invoke.texi (Overall Options): Document --help=. * gcc.c (target_help_flag): Rename to print_subprocess_flag. (cc1_options): Pass --help= on to cc1. (display_help): Add description of --help=. (process_command): Add code to handle --help=. Allow translated --help and --target-help switches to be passed on to compiler sub-process. (main): Remove unused if statement. * opts.c (columns): Remove. (LEFT_COLUMN): Define. (wrap_help): Add columns argument. (print_filtered_help): Change parameters to be an include bitmask, an exclude bitmask, an any bitmask and the column width. Move the code to display the params list here. Add code to display the status of options rather than their descriptions if the quiet flag is not active. (print_specific_help): Change parameters to be an include bitmask, an exclude bitmask and an any bitmask. Move code to look up the column width here. Decide upon the title for an options listing. (common_handle_options): Add code to handle --help=. Adapt code for --help and --target-help to use the revised form of the print_specific_help function. (print_help): Delete. (print_param_help): Delete. (print_switch): Delete. * opts.h (cl_lang_count): Add prototype. (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_MIN_OPTION_CLASS, CL_MAX_OPTION_CLASS): New defines. * optc-gen.awk: Add construction of cl_lang_count. * c.opt: Add Warning attribute to warning options and Optimization attribute to optimization options. * common.opt: Likewise. Add --help=. Add -fhelp and -ftarget-help as aliases for the transformed --help and --target-help options. * opt-functions.awk: Add code to handle Warning and Optimization attributes. From-SVN: r121849
2007-02-12 17:25:14 +01:00
#define CL_MAX_OPTION_CLASS CL_COMMON
/* From here on the bits describe attributes of the options.
Before this point the bits have described the class of the option.
This distinction is important because --help will not list options
which only have these higher bits set. */
#define CL_NO_DRIVER_ARG (1 << 20) /* Option takes no argument in the driver. */
common.opt: Add driver options. * common.opt: Add driver options. (auxbase, auxbase-strip, quiet, version): Mark RejectDriver. * doc/options.texi (Driver, RejectDriver): Document. * gcc.c (pass_exit_codes, print_search_dirs, print_file_name, print_prog_name, print_multi_directory, print_sysroot, print_multi_os_directory, print_multi_lib, print_sysroot_headers_suffix, report_times, combine_flag, use_pipes, wrapper_string): Remove. (save_switch, driver_unknown_option_callback, driver_wrong_lang_callback, driver_post_handling_callback, driver_handle_option): New. (spec_lang, last_language_n_infiles): Make file-scope static instead of local to process_command. (process_command): Use decode_cmdline_options_to_array and read_cmdline_option for option processing. Compute have_c in prescan of decoded options. * opt-functions.awk (switch_flags): Handle Driver and RejectDriver. (var_type, var_type_struct): Handle Separate options as generating const char * variables. * opts-common.c (decode_cmdline_option): Expect CL_COMMON and CL_TARGET to be passed by caller if required. (decode_cmdline_options_to_array): Update comment. * opts.c (complain_wrong_lang): Handle options only valid for the driver. (decode_options): Update call to decode_cmdline_options_to_array. (print_filtered_help): Ignore driver-only options. (print_specific_help): Ignore CL_DRIVER. (common_handle_option): Don't call print_specific_help for CL_DRIVER. * opts.h (CL_DRIVER, CL_REJECT_DRIVER): Define. (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_TARGET, CL_COMMON): Update values. c-family: * c.opt (MDX, MMDX, lang-asm): Mark RejectDriver. fortran: * lang.opt (MDX, MMDX): Mark RejectDriver. java: * lang.opt (MD_, MMD_, version): Mark RejectDriver. From-SVN: r163279
2010-08-16 12:15:15 +02:00
#define CL_REJECT_DRIVER (1 << 21) /* Reject this option in the driver. */
#define CL_SAVE (1 << 22) /* Target-specific option for attribute. */
invoke.texi (Overall Options): Document --help=. * doc/invoke.texi (Overall Options): Document --help=. * gcc.c (target_help_flag): Rename to print_subprocess_flag. (cc1_options): Pass --help= on to cc1. (display_help): Add description of --help=. (process_command): Add code to handle --help=. Allow translated --help and --target-help switches to be passed on to compiler sub-process. (main): Remove unused if statement. * opts.c (columns): Remove. (LEFT_COLUMN): Define. (wrap_help): Add columns argument. (print_filtered_help): Change parameters to be an include bitmask, an exclude bitmask, an any bitmask and the column width. Move the code to display the params list here. Add code to display the status of options rather than their descriptions if the quiet flag is not active. (print_specific_help): Change parameters to be an include bitmask, an exclude bitmask and an any bitmask. Move code to look up the column width here. Decide upon the title for an options listing. (common_handle_options): Add code to handle --help=. Adapt code for --help and --target-help to use the revised form of the print_specific_help function. (print_help): Delete. (print_param_help): Delete. (print_switch): Delete. * opts.h (cl_lang_count): Add prototype. (CL_PARAMS, CL_WARNING, CL_OPTIMIZATION, CL_MIN_OPTION_CLASS, CL_MAX_OPTION_CLASS): New defines. * optc-gen.awk: Add construction of cl_lang_count. * c.opt: Add Warning attribute to warning options and Optimization attribute to optimization options. * common.opt: Likewise. Add --help=. Add -fhelp and -ftarget-help as aliases for the transformed --help and --target-help options. * opt-functions.awk: Add code to handle Warning and Optimization attributes. From-SVN: r121849
2007-02-12 17:25:14 +01:00
#define CL_DISABLED (1 << 23) /* Disabled in this configuration. */
#define CL_REPORT (1 << 24) /* Report argument with -fverbose-asm */
#define CL_JOINED (1 << 25) /* If takes joined argument. */
#define CL_SEPARATE (1 << 26) /* If takes a separate argument. */
#define CL_REJECT_NEGATIVE (1 << 27) /* Reject no- form. */
#define CL_MISSING_OK (1 << 28) /* Missing argument OK (joined). */
#define CL_UINTEGER (1 << 29) /* Argument is an integer >=0. */
#define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
/* Possible ways in which a command-line option may be erroneous.
These do not include not being known at all; an option index of
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
OPT_SPECIAL_unknown is used for that. */
#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */
#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */
#define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */
#define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */
/* Structure describing the result of decoding an option. */
struct cl_decoded_option
{
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
/* The index of this option, or an OPT_SPECIAL_* value for
non-options and unknown options. */
size_t opt_index;
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
/* The string argument, or NULL if none. For OPT_SPECIAL_* cases,
the option or non-option command-line argument. */
const char *arg;
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
/* The original text of option plus arguments, with separate argv
elements concatenated into one string with spaces separating
them. This is for such uses as diagnostics and
-frecord-gcc-switches. */
const char *orig_option_with_args_text;
langhooks-def.h (lhd_init_options, [...]): New. * langhooks-def.h (lhd_init_options, LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): New. (LANG_HOOKS_INIT_OPTIONS): Update default definition. (LANG_HOOKS_INITIALIZER): Add new hooks. * langhooks.c (lhd_init_options, lhd_complain_wrong_lang_p): New. * langhooks.h (struct lang_hooks): Add new hooks option_lang_mask and complain_wrong_lang_p. Update init_options prototype. * c-objc-common.c (c_initialize_diagnostics): First call c_common_initialize_diagnostics. * c-objc-common.h (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. * coretypes.h (struct cl_option, struct cl_decoded_option): Declare. * hooks.c (hook_uint_uint_constcharptrptr_0): Remove. (hook_uint_void_0): New. * hooks.h (hook_uint_uint_constcharptrptr_0): Remove. (hook_uint_void_0): New. * opts-common.c (decode_cmdline_option, decode_cmdline_options_to_array): Also fill in canonical_option field. * opts.c (complain_wrong_lang): Use langhook to determine whether to complain instead of special-casing LTO. (decode_options): Separate lang_mask determination with option_lang_mask hook from call of init_options hook. * opts.h (struct cl_decoded_option): Add canonical_option. ada: * gcc-interface/misc.c (gnat_option_lang_mask): New. (gnat_init_options): Update prototype. Reconstruct argv array from decoded options. c-family: * c-common.h (c_common_option_lang_mask, c_common_initialize_diagnostics, c_common_complain_wrong_lang_p): New. (c_common_init_options): Update prototype. * c-opts.c (c_common_option_lang_mask): New. (c_common_initialize_diagnostics): Split out of c_common_init_options. (accept_all_c_family_options, c_common_complain_wrong_lang_p): New. (c_common_init_options): Update prototype. Use decoded options in search for -lang-asm. cp: * cp-objcp-common.c (cxx_initialize_diagnostics): First call c_common_initialize_diagnostics. * cp-objcp-common.h (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. fortran: * cpp.c (gfc_cpp_init_options): Update prototype. Use number of decoded options in allocating deferred_opt. * cpp.h (gfc_cpp_init_options): Update prototype. * f95-lang.c (LANG_HOOKS_OPTION_LANG_MASK): Define. * gfortran.h (gfc_option_lang_mask): New. (gfc_init_options): Update prototype. * options.c (gfc_option_lang_mask): New. (gfc_init_options): Update prototype. Pass new arguments to gfc_cpp_init_options. java: * lang.c (java_option_lang_mask): New. (java_init_options): Update prototype. (LANG_HOOKS_OPTION_LANG_MASK): Define. lto: * lto-lang.c (lto_option_lang_mask, lto_complain_wrong_lang_p): New. (lto_init_options): Update prototype. (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. From-SVN: r162560
2010-07-27 11:59:51 +02:00
/* The canonical form of the option and its argument, for when it is
necessary to reconstruct argv elements (in particular, for
processing specs and passing options to subprocesses from the
driver). */
const char *canonical_option[4];
/* The number of elements in the canonical form of the option and
arguments; always at least 1. */
size_t canonical_option_num_elements;
langhooks-def.h (lhd_init_options, [...]): New. * langhooks-def.h (lhd_init_options, LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): New. (LANG_HOOKS_INIT_OPTIONS): Update default definition. (LANG_HOOKS_INITIALIZER): Add new hooks. * langhooks.c (lhd_init_options, lhd_complain_wrong_lang_p): New. * langhooks.h (struct lang_hooks): Add new hooks option_lang_mask and complain_wrong_lang_p. Update init_options prototype. * c-objc-common.c (c_initialize_diagnostics): First call c_common_initialize_diagnostics. * c-objc-common.h (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. * coretypes.h (struct cl_option, struct cl_decoded_option): Declare. * hooks.c (hook_uint_uint_constcharptrptr_0): Remove. (hook_uint_void_0): New. * hooks.h (hook_uint_uint_constcharptrptr_0): Remove. (hook_uint_void_0): New. * opts-common.c (decode_cmdline_option, decode_cmdline_options_to_array): Also fill in canonical_option field. * opts.c (complain_wrong_lang): Use langhook to determine whether to complain instead of special-casing LTO. (decode_options): Separate lang_mask determination with option_lang_mask hook from call of init_options hook. * opts.h (struct cl_decoded_option): Add canonical_option. ada: * gcc-interface/misc.c (gnat_option_lang_mask): New. (gnat_init_options): Update prototype. Reconstruct argv array from decoded options. c-family: * c-common.h (c_common_option_lang_mask, c_common_initialize_diagnostics, c_common_complain_wrong_lang_p): New. (c_common_init_options): Update prototype. * c-opts.c (c_common_option_lang_mask): New. (c_common_initialize_diagnostics): Split out of c_common_init_options. (accept_all_c_family_options, c_common_complain_wrong_lang_p): New. (c_common_init_options): Update prototype. Use decoded options in search for -lang-asm. cp: * cp-objcp-common.c (cxx_initialize_diagnostics): First call c_common_initialize_diagnostics. * cp-objcp-common.h (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. fortran: * cpp.c (gfc_cpp_init_options): Update prototype. Use number of decoded options in allocating deferred_opt. * cpp.h (gfc_cpp_init_options): Update prototype. * f95-lang.c (LANG_HOOKS_OPTION_LANG_MASK): Define. * gfortran.h (gfc_option_lang_mask): New. (gfc_init_options): Update prototype. * options.c (gfc_option_lang_mask): New. (gfc_init_options): Update prototype. Pass new arguments to gfc_cpp_init_options. java: * lang.c (java_option_lang_mask): New. (java_init_options): Update prototype. (LANG_HOOKS_OPTION_LANG_MASK): Define. lto: * lto-lang.c (lto_option_lang_mask, lto_complain_wrong_lang_p): New. (lto_init_options): Update prototype. (LANG_HOOKS_OPTION_LANG_MASK, LANG_HOOKS_COMPLAIN_WRONG_LANG_P): Define. From-SVN: r162560
2010-07-27 11:59:51 +02:00
/* For a boolean option, 1 for the true case and 0 for the "no-"
case. For an unsigned integer option, the value of the
argument. 1 in all other cases. */
int value;
/* Any flags describing errors detected in this option. */
int errors;
};
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
/* Structure describing a single option-handling callback. */
struct cl_option_handler_func
{
/* The function called to handle the option. */
bool (*handler) (const struct cl_decoded_option *decoded,
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
unsigned int lang_mask, int kind,
const struct cl_option_handlers *handlers);
/* The mask that must have some bit in common with the flags for the
option for this particular handler to be used. */
unsigned int mask;
};
/* Structure describing the callbacks used in handling options. */
struct cl_option_handlers
{
/* Callback for an unknown option to determine whether to give an
error for it, and possibly store information to diagnose the
option at a later point. Return true if an error should be
given, false otherwise. */
bool (*unknown_option_callback) (const struct cl_decoded_option *decoded);
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
/* Callback to handle, and possibly diagnose, an option for another
language. */
void (*wrong_lang_callback) (const struct cl_decoded_option *decoded,
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
unsigned int lang_mask);
/* Callback to call after the successful handling of any option. */
void (*post_handling_callback) (const struct cl_decoded_option *decoded,
unsigned int mask);
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
/* The number of individual handlers. */
size_t num_handlers;
/* The handlers themselves. */
struct cl_option_handler_func handlers[3];
};
/* Input file names. */
extern const char **in_fnames;
/* The count of input filenames. */
extern unsigned num_in_fnames;
re PR target/26885 (-m64 -m32 no longer creates 32-bit object) gcc/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Makefile.in (GCC_OBJS): New. (OBJS-common): Add opts-common.o. (xgcc$(exeext)): Replace gcc.o with $(GCC_OBJS). (cpp$(exeext)): Likewise. (gcc.o): Also depend on opts.h. (opts-common.o): New. * common.opt (gcoff): Add Negative(gdwarf-2). (gdwarf-2): Add Negative(gstabs). (gstabs): Add Negative(gstabs+). (gstabs+): Add Negative(gvms). (gvms): Add Negative(gxcoff). (gxcoff): Add Negative(gxcoff+). (gxcoff+): Add Negative(gcoff). * config/i386/i386.opt (m32): Add Negative(m64). (m64): Add Negative(m32). * doc/options.texi: Document the Negative option. * gcc.c: Include "opts.h". (main): Call prune_options after expandargv. * optc-gen.awk: Generate common declarations for all flag variables in options.c. Output the neg_index field. * opts.c (find_opt): Moved to ... * opts-common.c: Here. New file. * opts.h (cl_option): Add a neg_index field. (find_opt): New. (prune_options): Likewise. gcc/cp/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GXX_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/fortran/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GFORTRAN_D_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/java/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in ($(GCJ)$(exeext)): Replace gcc.o with $(GCC_OBJS). gcc/treelang/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (gtreelang$(exeext)): Replace gcc.o with $(GCC_OBJS). From-SVN: r113824
2006-05-16 16:27:18 +02:00
size_t find_opt (const char *input, int lang_mask);
extern int integral_argument (const char *arg);
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
extern void decode_cmdline_options_to_array (unsigned int argc,
const char **argv,
unsigned int lang_mask,
struct cl_decoded_option **decoded_options,
unsigned int *decoded_options_count);
re PR target/26885 (-m64 -m32 no longer creates 32-bit object) gcc/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Makefile.in (GCC_OBJS): New. (OBJS-common): Add opts-common.o. (xgcc$(exeext)): Replace gcc.o with $(GCC_OBJS). (cpp$(exeext)): Likewise. (gcc.o): Also depend on opts.h. (opts-common.o): New. * common.opt (gcoff): Add Negative(gdwarf-2). (gdwarf-2): Add Negative(gstabs). (gstabs): Add Negative(gstabs+). (gstabs+): Add Negative(gvms). (gvms): Add Negative(gxcoff). (gxcoff): Add Negative(gxcoff+). (gxcoff+): Add Negative(gcoff). * config/i386/i386.opt (m32): Add Negative(m64). (m64): Add Negative(m32). * doc/options.texi: Document the Negative option. * gcc.c: Include "opts.h". (main): Call prune_options after expandargv. * optc-gen.awk: Generate common declarations for all flag variables in options.c. Output the neg_index field. * opts.c (find_opt): Moved to ... * opts-common.c: Here. New file. * opts.h (cl_option): Add a neg_index field. (find_opt): New. (prune_options): Likewise. gcc/cp/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GXX_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/fortran/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GFORTRAN_D_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/java/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in ($(GCJ)$(exeext)): Replace gcc.o with $(GCC_OBJS). gcc/treelang/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (gtreelang$(exeext)): Replace gcc.o with $(GCC_OBJS). From-SVN: r113824
2006-05-16 16:27:18 +02:00
extern void prune_options (int *argcp, char ***argvp);
re PR other/32998 (-frecord-gcc-switches issues) PR other/32998 * opth-gen.awk: Generate definitions of OPT_SPECIAL_unknown, OPT_SPECIAL_program_name and OPT_SPECIAL_input_file. * opts-common.c (find_opt): Return OPT_SPECIAL_unknown on failure. (decode_cmdline_option): Update for this return value. Set orig_option_with_args_text field. Set arg field for unknown options. Make static. (decode_cmdline_options_to_array): New. (prune_options): Update handling of find_opt return value. * opts.c (read_cmdline_option): Take decoded option. Return void. (read_cmdline_options): Take decoded options. (decode_options): Add parameters for decoded options. Use decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. (decode_cmdline_option): Remove. (decode_cmdline_options_to_array): Declare. (decode_options): Update prototype. * toplev.c (save_argv): Remove. (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. * varasm.c (elf_record_gcc_switches): Don't handle holding back names. c-family: * c-common.c (parse_optimize_options): Update call to decode_options. fortran: * options.c (gfc_handle_option): Don't handle N_OPTS. testsuite: * gcc.dg/opts-2.c: New test. From-SVN: r161053
2010-06-20 23:02:46 +02:00
extern void decode_options (unsigned int argc, const char **argv,
struct cl_decoded_option **decoded_options,
unsigned int *decoded_options_count);
extern int option_enabled (int opt_idx);
extern bool get_option_state (int, struct cl_option_state *);
re PR c/40989 (-Werror= and #pragma diagnostics do not work with group flags) 2010-05-06 Manuel López-Ibáñez <manu@gcc.gnu.org> PR 40989 * doc/invoke.texi (Wimplicit): Document as C only. * opts.c (common_handle_option): Add argument kind. (handle_option): Rename as read_cmdline_option. Factor out code to... (handle_option): ... here. New. (handle_options): Rename as read_cmdline_options. (decode_options): Update call. (set_option): Use option index instead of option pointer. Classify diagnostics correctly. (enable_warning_as_error): Call handle_option. * opts.h (set_option): Update declaration. (handle_option): Declare. * langhooks.h (struct lang_hooks): Add argument kind to handle_option. * c.opt (Wimplicit,Wimplicit-int): Initialize to -1. * c-opts.c (set_Wimplicit): Delete. (c_family_lang_mask): New static constant. (c_common_handle_option): Add argument kind. Use handle_option instead of set_Wimplicit. (c_common_post_options): warn_implicit and warn_implicit_int are disabled by default. * c-common.c (warn_implicit): Do not define here. * c-common.h (warn_implicit): Do not declare here. (c_common_handle_option): Update declaration. * lto-opts.c (lto_reissue_options): Update call to set_option. java/ * lang.c (java_handle_option): Add argument kind. fortran/ * options.c (gfc_handle_option): Add argument kind. * gfortran.h (gfc_handle_option): Update declaration. ada/ * gcc-interface/misc.c (gnat_handle_option): Add argument kind. testsuite/ * gcc.dg/pr40989.c: New. From-SVN: r159102
2010-05-06 12:12:36 +02:00
extern void set_option (int opt_index, int value, const char *arg, int);
bool handle_option (const struct cl_decoded_option *decoded,
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
unsigned int lang_mask, int kind,
const struct cl_option_handlers *handlers);
bool handle_generated_option (size_t opt_index, const char *arg, int value,
unsigned int lang_mask, int kind,
const struct cl_option_handlers *handlers);
Makefile.in (gccspec.o, cppspec.o): Update dependencies. * Makefile.in (gccspec.o, cppspec.o): Update dependencies. * common.opt (L, nodefaultlibs, nostdlib, pg, static): New options. * config/avr/avr.h (LIBSTDCXX): Remove initial "-l". * config/freebsd.h (MATH_LIBRARY_PROFILE): Remove initial "-l". * config/i386/djgpp.h (LIBSTDCXX): Remove initial "-l". * config/rs6000/aix.h (LIBSTDCXX_STATIC): Remove initial "-l". * config/s390/tpf.h (MATH_LIBRARY, LIBSTDCXX): Remove initial "-l". * cppspec.c: Include opts.h. (lang_specific_driver): Use cl_decoded_option structures. * doc/tm.texi.in (MATH_LIBRARY): Update documentation. * doc/tm.texi: Regenerate. * gcc.c (translate_options): Translate -d to -foutput-class-dir=. (driver_handle_option): Allow driver options needing no special processing. (process_command): Decode options before call to lang_specific_driver. Pass decoded options to lang_specific_driver. * gcc.h (lang_specific_driver): Update prototype. * gccspec.c: Include opts.h. (lang_specific_driver): Use cl_decoded_option structures. * opts-common.c (option_ok_for_language, generate_option, generate_option_input_file): New. (decode_cmdline_option): Use option_ok_for_language. (decode_cmdline_options_to_array): Use generate_option_input_file. (handle_generated_option): Use generate_option. * opts.h (generate_option, generate_option_input_file): Declare. cp: * Make-lang.in (g++spec.o): Update dependencies. * g++spec.c: Include opts.h (MATH_LIBRARY, LIBSTDCXX): Remove initial "-l". (lang_specific_driver): Use cl_decoded_option structures. fortran: * Make-lang.in (gfortranspec.o): Update dependencies. * gfortranspec.c: Include coretypes.h before gcc.h. Include opts.h. (MATH_LIBRARY, FORTRAN_LIBRARY): Remove initial "-l". (ADD_ARG_LIBGFORTRAN, Option, lookup_option): Remove. (g77_xargc): Make unsigned. (g77_xargv): Change to g77_x_decoded_options. (g77_newargc): Make unsigned. (g77_newargv): Change to g77_new_decoded_options. (strings_same, options_same): New. (append_arg): Use cl_decoded_option structures. (append_option): New. (add_arg_libgfortran): New. (lang_specific_driver): Use cl_decoded_option structures. java: * Make-lang.in (jvspec.o): Update dependencies. * jvspec.c: Include opts.h. (PARAM_ARG): Remove. (find_spec_file): Do not add leading -specs=. (lang_specific_driver): Use cl_decoded_option structures. * lang.opt (C, CLASSPATH, D, bootclasspath, classpath, encoding, extdirs, fmain=, s-bc-abi): New options. From-SVN: r163459
2010-08-22 14:19:01 +02:00
void generate_option (size_t opt_index, const char *arg, int value,
unsigned int lang_mask,
struct cl_decoded_option *decoded);
void generate_option_input_file (const char *file,
struct cl_decoded_option *decoded);
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
extern void read_cmdline_option (struct cl_decoded_option *decoded,
unsigned int lang_mask,
const struct cl_option_handlers *handlers);
diagnostic.h (diagnostic_override_option_index): New macro to set a diagnostic's option_index. * diagnostic.h (diagnostic_override_option_index): New macro to set a diagnostic's option_index. * c-tree.h (c_cpp_error): Add warning reason argument. * opts.c (_warning_as_error_callback): New. (register_warning_as_error_callback): Store callback for warnings enabled via enable_warning_as_error. (enable_warning_as_error): Call callback, minor code tidy. * opts.h (register_warning_as_error_callback): Declare. * c-opts.c (warning_as_error_callback): New, set cpp_opts flag in response to -Werror=. (c_common_init_options): Register warning_as_error_callback in opts.c. * common.opt: Add -Wno-cpp option. * c-common.c (struct reason_option_codes_t): Map cpp warning reason codes to gcc option indexes. * (c_option_controlling_cpp_error): New function, lookup the gcc option index for a cpp warning reason code. * (c_cpp_error): Add warning reason argument, call c_option_controlling_cpp_error for diagnostic_override_option_index. * doc/invoke.texi: Document -Wno-cpp. * cpp.c (cb_cpp_error): Add warning reason argument, set a value for diagnostic_override_option_index if CPP_W_WARNING_DIRECTIVE. * directives.c (do_diagnostic): Add warning reason argument, call appropriate error reporting function for code. (directive_diagnostics): Call specific warning functions with warning reason where appropriate. (do_error, do_warning, do_pragma_dependency): Add warning reason argument to do_diagnostic calls. * macro.c (_cpp_warn_if_unused_macro, enter_macro_context, _cpp_create_definition): Call specific warning functions with warning reason where appropriate. * Makefile.in: Add new diagnostic functions to gettext translations. * include/cpplib.h (struct cpp_callbacks): Add warning reason code to error callback. (CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR, CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums. (CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS, CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR, CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS, CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS, CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF, CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE, CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp warning reason codes. (cpp_warning, cpp_pedwarning, cpp_warning_syshdr, cpp_warning_with_line, cpp_pedwarning_with_line, cpp_warning_with_line_syshdr): New specific error reporting functions. * pch.c (cpp_valid_state): Call specific warning functions with warning reason where appropriate. * errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central diagnostic handlers. (cpp_warning, cpp_pedwarning, cpp_warning_syshdr, cpp_warning_with_line, cpp_pedwarning_with_line, cpp_warning_with_line_syshdr): New specific error reporting functions. * expr.c (cpp_classify_number, eval_token, num_unary_op): Call specific warning functions with warning reason where appropriate. * lex.c (_cpp_process_line_notes, _cpp_skip_block_comment, warn_about_normalization, lex_identifier_intern, lex_identifier, _cpp_lex_direct): Ditto. * charset.c (_cpp_valid_ucn, convert_hex, convert_escape, narrow_str_to_charconst): Ditto. * gcc.dg/cpp/warn-undef-2.c: New. * gcc.dg/cpp/warn-traditional-2.c: New. * gcc.dg/cpp/warn-comments-2.c: New. * gcc.dg/cpp/warning-directive-1.c: New. * gcc.dg/cpp/warn-long-long.c: New. * gcc.dg/cpp/warn-traditional.c: New. * gcc.dg/cpp/warn-variadic-2.c: New. * gcc.dg/cpp/warn-undef.c: New. * gcc.dg/cpp/warn-normalized-1.c: New. * gcc.dg/cpp/warning-directive-2.c: New. * gcc.dg/cpp/warn-long-long-2.c: New. * gcc.dg/cpp/warn-variadic.c: New. * gcc.dg/cpp/warn-normalized-2.c: New. * gcc.dg/cpp/warning-directive-3.c: New. * gcc.dg/cpp/warn-deprecated-2.c: New. * gcc.dg/cpp/warn-trigraphs-1.c: New. * gcc.dg/cpp/warn-multichar-2.c: New. * gcc.dg/cpp/warn-normalized-3.c: New. * gcc.dg/cpp/warning-directive-4.c: New. * gcc.dg/cpp/warn-unused-macros.c: New. * gcc.dg/cpp/warn-trigraphs-2.c: New. * gcc.dg/cpp/warn-cxx-compat-2.c: New. * gcc.dg/cpp/warn-cxx-compat.c: New. * gcc.dg/cpp/warn-redefined.c: New. * gcc.dg/cpp/warn-trigraphs-3.c: New. * gcc.dg/cpp/warn-unused-macros-2.c: New. * gcc.dg/cpp/warn-deprecated.c: New. * gcc.dg/cpp/warn-trigraphs-4.c: New. * gcc.dg/cpp/warn-redefined-2.c: New. * gcc.dg/cpp/warn-comments.c: New. * gcc.dg/cpp/warn-multichar.c: New. * g++.dg/cpp/warning-directive-1.C: New. * g++.dg/cpp/warning-directive-2.C: New. * g++.dg/cpp/warning-directive-3.C: New. * g++.dg/cpp/warning-directive-4.C: New. * gfortran.dg/warning-directive-1.F90: New. * gfortran.dg/warning-directive-3.F90: New. * gfortran.dg/warning-directive-2.F90: New. * gfortran.dg/warning-directive-4.F90: New. From-SVN: r158079
2010-04-07 19:18:10 +02:00
extern void register_warning_as_error_callback (void (*callback) (int));
2007-02-15 23:31:17 +01:00
extern void enable_warning_as_error (const char *arg, int value,
coretypes.h (struct cl_option_handlers): Declare. * coretypes.h (struct cl_option_handlers): Declare. * hooks.c (hook_int_size_t_constcharptr_int_0): Remove. * hooks.h (hook_int_size_t_constcharptr_int_0): Remove. * langhooks-def.h (lhd_handle_option): Declare. (LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option. * langhooks.c (lhd_handle_option): New. * langhooks.h (struct lang_hooks): Update prototype and return value type of handle_option hook. * optc-gen.awk: Generate target_flags_explicit definition for the driver. * opts-common.c: Include diagnostic.h. (handle_option): Move from opts.c. Update prototype and return value type. Use handlers structure. (read_cmdline_option): Move from opts.c. Update prototype. Use handlers structure. (set_option): Move from opts.c. * opts.c (common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. (unknown_option_callback, post_handling_callback, lang_handle_option, target_handle_option): New. (handle_option, read_cmdline_option): Move to opts-common.c. (read_cmdline_options): Update prototype. Update call to read_cmdline_option. (decode_options): Initialize and use handlers structure. (set_option): Move to opts-common.c. (enable_warning_as_error): Update prototype. Update call to handle_option. * opts.h (struct cl_option_handler_func, struct cl_option_handlers): New. (handle_option, enable_warning_as_error): Update prototypes. (read_cmdline_option): Declare. * Makefile.in (opts-common.o): Update dependencies. ada: * gcc-interface/misc.c (gnat_handle_option): Update prototype and return value type. Don't check for missing arguments here. c-family: * c-common.h (c_common_handle_option): Update prototype and return value type. * c-opts.c (c_common_handle_option): Update prototype and return value type. Update calls to handle_option and enable_warning_as_error. fortran: * gfortran.h (gfc_handle_option): Update prototype and return value type. * options.c (gfc_handle_option): Update prototype and return value type. java: * lang.c (java_handle_option): Update prototype and return value type. lto: * lto-lang.c (lto_handle_option): Update prototype and return value type. Remove duplicate assignment to result. From-SVN: r162601
2010-07-27 23:23:53 +02:00
unsigned int lang_mask,
const struct cl_option_handlers *handlers);
extern void print_ignored_options (void);
Makefile.in (OJBS, c-opts.o): Update. * Makefile.in (OJBS, c-opts.o): Update. (c-options.c, c-options.h): Rename options.h and options.c. (options.h): Rename options_.h. (opts.o): New. * c-common.h (c_common_handle_option): Replace c_common_decode_option. (c_common_init_options): Update prototype. * c-lang.c (c_init_options): Update prototype. (LANG_HOOKS_HANDLE_OPTION): Override. (LANG_HOOKS_DECODE_OPTION): Drop. * c-opts.c: Include opts.h and options.h instead of c-options.h and c-options.c. (lang_flags): Move to file scope. (find_opt, c_common_decode_option): Remove. (CL_C, CL_OBJC, CL_CXX, CL_OBJCXX, CL_JOINED, CL_SEPARATE, CL_REJECT_NEGATIVE): Move to opts.h. (missing_arg): Update prototype. (c_common_init_options): Update for new prototype. (c_common_handle_options): Filenames are passed as N_OPTS. * hooks.c (hook_int_void_0): New. * hooks.h (hook_int_void_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): New default. (LANG_HOOKS_HANDLE_OPTION): Default to NULL for now. (LANG_HOOKS_INITIALIZER): Update. * langhooks.h (init_options): Update. (handle_option): New. * opts.c, opts.h: New files. * opts.sh: Update c file to include opts.h and options.h. * toplev.c: Include opts.h; change options.h to options_.h. (parse_options_and_default_flags): Get lang_mask, use handle_option for language-specific handling. * objc/objc-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. (objc_init_options): Update. ada: * misc.c (gnat_init_options): Update. cp: * cp-lang.c (LANG_HOOKS_DECODE_OPTON): Drop. (LANG_HOOKS_HANDLE_OPTION): Override. * cp-tree.h (cxx_init_options): Update. * lex.c (cxx_init_options): Update. f: * com.c (ffe_init_options): Update. java: * lang.c (java_init_options): Update. From-SVN: r67584
2003-06-07 13:10:46 +02:00
#endif