diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68a81c7b2c0..bda22d0f736 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,43 @@ +2007-02-12 Nick Clifton + + * 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. + 2007-02-12 Richard Henderson * config/alpha/constraints.md: New file. diff --git a/gcc/c.opt b/gcc/c.opt index 6d3fa88e1fe..624b10e9ede 100644 --- a/gcc/c.opt +++ b/gcc/c.opt @@ -113,23 +113,23 @@ C ObjC C++ ObjC++ Joined Separate -U Undefine Wabi -C++ ObjC++ Var(warn_abi) +C++ ObjC++ Var(warn_abi) Warning Warn about things that will change when compiling with an ABI-compliant compiler Wall -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Enable most warning messages Wassign-intercept -ObjC ObjC++ Var(warn_assign_intercept) +ObjC ObjC++ Var(warn_assign_intercept) Warning Warn whenever an Objective-C assignment is being intercepted by the garbage collector Wbad-function-cast -C ObjC Var(warn_bad_function_cast) +C ObjC Var(warn_bad_function_cast) Warning Warn about casting functions to incompatible types Wc++-compat -C Var(warn_cxx_compat) +C Var(warn_cxx_compat) Warning Warn about C constructs that are not in the common subset of C and C++ Wc++0x-compat @@ -137,55 +137,55 @@ C++ ObjC++ Var(warn_cxx0x_compat) Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 200x Wcast-qual -C ObjC C++ ObjC++ Var(warn_cast_qual) +C ObjC C++ ObjC++ Var(warn_cast_qual) Warning Warn about casts which discard qualifiers Wchar-subscripts -C ObjC C++ ObjC++ Var(warn_char_subscripts) +C ObjC C++ ObjC++ Var(warn_char_subscripts) Warning Warn about subscripts whose type is \"char\" Wclobbered -C ObjC C++ ObjC++ Var(warn_clobbered) Init(-1) +C ObjC C++ ObjC++ Var(warn_clobbered) Init(-1) Warning Warn about variables that might be changed by \"longjmp\" or \"vfork\" Wcomment -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about possibly nested block comments, and C++ comments spanning more than one physical line Wcomments -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Synonym for -Wcomment Wconversion -C ObjC C++ ObjC++ Var(warn_conversion) +C ObjC C++ ObjC++ Var(warn_conversion) Warning Warn for implicit type conversions that may change a value Wctor-dtor-privacy -C++ ObjC++ Var(warn_ctor_dtor_privacy) +C++ ObjC++ Var(warn_ctor_dtor_privacy) Warning Warn when all constructors and destructors are private Wdeclaration-after-statement -C ObjC Var(warn_declaration_after_statement) +C ObjC Var(warn_declaration_after_statement) Warning Warn when a declaration is found after a statement Wdeprecated -C++ ObjC++ Var(warn_deprecated) Init(1) +C++ ObjC++ Var(warn_deprecated) Init(1) Warning Warn about deprecated compiler features Wdiv-by-zero -C ObjC C++ Var(warn_div_by_zero) Init(1) +C ObjC C++ Var(warn_div_by_zero) Init(1) Warning Warn about compile-time integer division by zero Weffc++ -C++ ObjC++ Var(warn_ecpp) +C++ ObjC++ Var(warn_ecpp) Warning Warn about violations of Effective C++ style rules Wempty-body -C ObjC C++ ObjC++ Var(warn_empty_body) Init(-1) +C ObjC C++ ObjC++ Var(warn_empty_body) Init(-1) Warning Warn about an empty body in an if or else statement Wendif-labels -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about stray tokens after #elif and #endif Werror @@ -193,53 +193,53 @@ C ObjC C++ ObjC++ ; Documented in common.opt Werror-implicit-function-declaration -C ObjC RejectNegative +C ObjC RejectNegative Warning Make implicit function declarations an error Wfloat-equal -C ObjC C++ ObjC++ Var(warn_float_equal) +C ObjC C++ ObjC++ Var(warn_float_equal) Warning Warn if testing floating point numbers for equality Wformat -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about printf/scanf/strftime/strfmon format string anomalies Wformat-extra-args -C ObjC C++ ObjC++ Var(warn_format_extra_args) +C ObjC C++ ObjC++ Var(warn_format_extra_args) Warning Warn if passing too many arguments to a function for its format string Wformat-nonliteral -C ObjC C++ ObjC++ Var(warn_format_nonliteral) +C ObjC C++ ObjC++ Var(warn_format_nonliteral) Warning Warn about format strings that are not literals Wformat-security -C ObjC C++ ObjC++ Var(warn_format_security) +C ObjC C++ ObjC++ Var(warn_format_security) Warning Warn about possible security problems with format functions Wformat-y2k -C ObjC C++ ObjC++ Var(warn_format_y2k) +C ObjC C++ ObjC++ Var(warn_format_y2k) Warning Warn about strftime formats yielding 2-digit years Wformat-zero-length -C ObjC Var(warn_format_zero_length) +C ObjC Var(warn_format_zero_length) Warning Warn about zero-length formats Wformat= -C ObjC C++ ObjC++ Joined +C ObjC C++ ObjC++ Joined Warning Winit-self -C ObjC C++ ObjC++ Var(warn_init_self) +C ObjC C++ ObjC++ Var(warn_init_self) Warning Warn about variables which are initialized to themselves Wimplicit -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Wimplicit-function-declaration -C ObjC Var(mesg_implicit_function_declaration) Init(-1) +C ObjC Var(mesg_implicit_function_declaration) Init(-1) Warning Warn about implicit function declarations Wimplicit-int -C ObjC Var(warn_implicit_int) +C ObjC Var(warn_implicit_int) Warning Warn when a declaration does not specify a type Wimport @@ -247,211 +247,211 @@ C ObjC C++ ObjC++ Deprecated. This switch has no effect Wint-to-pointer-cast -C ObjC Var(warn_int_to_pointer_cast) Init(1) +C ObjC Var(warn_int_to_pointer_cast) Init(1) Warning Warn when there is a cast to a pointer from an integer of a different size Winvalid-offsetof -C++ ObjC++ Var(warn_invalid_offsetof) Init(1) +C++ ObjC++ Var(warn_invalid_offsetof) Init(1) Warning Warn about invalid uses of the \"offsetof\" macro Winvalid-pch -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about PCH files that are found but not used Wlong-long -C ObjC C++ ObjC++ Var(warn_long_long) Init(1) +C ObjC C++ ObjC++ Var(warn_long_long) Init(1) Warning Do not warn about using \"long long\" when -pedantic Wmain -C ObjC +C ObjC Warning Warn about suspicious declarations of \"main\" Wmissing-braces -C ObjC C++ ObjC++ Var(warn_missing_braces) +C ObjC C++ ObjC++ Var(warn_missing_braces) Warning Warn about possibly missing braces around initializers Wmissing-declarations -C ObjC C++ ObjC++ Var(warn_missing_declarations) +C ObjC C++ ObjC++ Var(warn_missing_declarations) Warning Warn about global functions without previous declarations Wmissing-field-initializers -C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Init(-1) +C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Init(-1) Warning Warn about missing fields in struct initializers Wmissing-format-attribute -C ObjC C++ ObjC++ Var(warn_missing_format_attribute) +C ObjC C++ ObjC++ Var(warn_missing_format_attribute) Warning Warn about functions which might be candidates for format attributes Wmissing-include-dirs -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about user-specified include directories that do not exist Wmissing-parameter-type -C ObjC Var(warn_missing_parameter_type) Init(-1) +C ObjC Var(warn_missing_parameter_type) Init(-1) Warning Warn about function parameters declared without a type specifier in K&R-style functions Wmissing-prototypes -C ObjC Var(warn_missing_prototypes) +C ObjC Var(warn_missing_prototypes) Warning Warn about global functions without prototypes Wmultichar -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about use of multi-character character constants Wnested-externs -C ObjC Var(warn_nested_externs) +C ObjC Var(warn_nested_externs) Warning Warn about \"extern\" declarations not at file scope Wnon-template-friend -C++ ObjC++ Var(warn_nontemplate_friend) Init(1) +C++ ObjC++ Var(warn_nontemplate_friend) Init(1) Warning Warn when non-templatized friend functions are declared within a template Wnon-virtual-dtor -C++ ObjC++ Var(warn_nonvdtor) +C++ ObjC++ Var(warn_nonvdtor) Warning Warn about non-virtual destructors Wnonnull -C ObjC Var(warn_nonnull) +C ObjC Var(warn_nonnull) Warning Warn about NULL being passed to argument slots marked as requiring non-NULL Wnormalized= -C ObjC C++ ObjC++ Joined +C ObjC C++ ObjC++ Joined Warning -Wnormalized= Warn about non-normalised Unicode strings Wold-style-cast -C++ ObjC++ Var(warn_old_style_cast) +C++ ObjC++ Var(warn_old_style_cast) Warning Warn if a C-style cast is used in a program Wold-style-declaration -C ObjC Var(warn_old_style_declaration) Init(-1) +C ObjC Var(warn_old_style_declaration) Init(-1) Warning Warn for obsolescent usage in a declaration Wold-style-definition -C ObjC Var(warn_old_style_definition) +C ObjC Var(warn_old_style_definition) Warning Warn if an old-style parameter definition is used Woverlength-strings -C ObjC C++ ObjC++ Var(warn_overlength_strings) Init(-1) +C ObjC C++ ObjC++ Var(warn_overlength_strings) Init(-1) Warning Warn if a string is longer than the maximum portable length specified by the standard Woverloaded-virtual -C++ ObjC++ Var(warn_overloaded_virtual) +C++ ObjC++ Var(warn_overloaded_virtual) Warning Warn about overloaded virtual function names Woverride-init -C ObjC Var(warn_override_init) Init(-1) +C ObjC Var(warn_override_init) Init(-1) Warning Warn about overriding initializers without side effects Wparentheses -C ObjC C++ ObjC++ Var(warn_parentheses) +C ObjC C++ ObjC++ Var(warn_parentheses) Warning Warn about possibly missing parentheses Wpmf-conversions -C++ ObjC++ Var(warn_pmf2ptr) Init(1) +C++ ObjC++ Var(warn_pmf2ptr) Init(1) Warning Warn when converting the type of pointers to member functions Wpointer-arith -C ObjC C++ ObjC++ Var(warn_pointer_arith) +C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning Warn about function pointer arithmetic Wpointer-to-int-cast -C ObjC Var(warn_pointer_to_int_cast) Init(1) +C ObjC Var(warn_pointer_to_int_cast) Init(1) Warning Warn when a pointer is cast to an integer of a different size Wpragmas -C ObjC C++ ObjC++ Var(warn_pragmas) Init(1) +C ObjC C++ ObjC++ Var(warn_pragmas) Init(1) Warning Warn about misuses of pragmas Wprotocol -ObjC ObjC++ Var(warn_protocol) Init(1) +ObjC ObjC++ Var(warn_protocol) Init(1) Warning Warn if inherited methods are unimplemented Wredundant-decls -C ObjC C++ ObjC++ Var(warn_redundant_decls) +C ObjC C++ ObjC++ Var(warn_redundant_decls) Warning Warn about multiple declarations of the same object Wreorder -C++ ObjC++ Var(warn_reorder) +C++ ObjC++ Var(warn_reorder) Warning Warn when the compiler reorders code Wreturn-type -C ObjC C++ ObjC++ Var(warn_return_type) +C ObjC C++ ObjC++ Var(warn_return_type) Warning Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++) Wselector -ObjC ObjC++ Var(warn_selector) +ObjC ObjC++ Var(warn_selector) Warning Warn if a selector has multiple methods Wsequence-point -C ObjC C++ ObjC++ Var(warn_sequence_point) +C ObjC C++ ObjC++ Var(warn_sequence_point) Warning Warn about possible violations of sequence point rules Wsign-compare -C ObjC C++ ObjC++ Var(warn_sign_compare) Init(-1) +C ObjC C++ ObjC++ Var(warn_sign_compare) Init(-1) Warning Warn about signed-unsigned comparisons Wsign-promo -C++ ObjC++ Var(warn_sign_promo) +C++ ObjC++ Var(warn_sign_promo) Warning Warn when overload promotes from unsigned to signed Wstrict-null-sentinel -C++ ObjC++ +C++ ObjC++ Warning Warn about uncasted NULL used as sentinel Wstrict-prototypes -C ObjC Var(warn_strict_prototypes) +C ObjC Var(warn_strict_prototypes) Warning Warn about unprototyped function declarations Wstrict-selector-match -ObjC ObjC++ Var(warn_strict_selector_match) +ObjC ObjC++ Var(warn_strict_selector_match) Warning Warn if type signatures of candidate methods do not match exactly Wsynth -C++ ObjC++ Var(warn_synth) +C++ ObjC++ Var(warn_synth) Warning Warn when synthesis behavior differs from Cfront Wsystem-headers -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Do not suppress warnings from system headers Wtraditional -C ObjC Var(warn_traditional) +C ObjC Var(warn_traditional) Warning Warn about features not present in traditional C Wtraditional-conversion -C ObjC Var(warn_traditional_conversion) +C ObjC Var(warn_traditional_conversion) Warning Warn of prototypes causing type conversions different from what would happen in the absence of prototype Wtrigraphs -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn if trigraphs are encountered that might affect the meaning of the program Wundeclared-selector -ObjC ObjC++ Var(warn_undeclared_selector) +ObjC ObjC++ Var(warn_undeclared_selector) Warning Warn about @selector()s without previously declared methods Wundef -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn if an undefined macro is used in an #if directive Wunknown-pragmas -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about unrecognized pragmas Wunused-macros -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Warn about macros defined in the main file that are not used Wvariadic-macros -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Warning Do not warn about using variadic macros when -pedantic Wwrite-strings -C ObjC C++ ObjC++ Var(warn_write_strings) +C ObjC C++ ObjC++ Var(warn_write_strings) Warning In C++, nonzero means warn about deprecated conversion from string literals to `char *'. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard. Wpointer-sign -C ObjC Var(warn_pointer_sign) Init(-1) +C ObjC Var(warn_pointer_sign) Init(-1) Warning Warn when a pointer differs in signedness in an assignment ansi @@ -554,7 +554,7 @@ fguiding-decls C++ ObjC++ fhandle-exceptions -C++ ObjC++ +C++ ObjC++ Optimization fhonor-std C++ ObjC++ @@ -675,19 +675,19 @@ C++ ObjC++ Enable automatic template instantiation frtti -C++ ObjC++ +C++ ObjC++ Optimization Generate run time type descriptor information fshort-double -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Optimization Use the same size for double as for float fshort-enums -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Optimization Use the narrowest integer type possible for enumeration types fshort-wchar -C ObjC C++ ObjC++ +C ObjC C++ ObjC++ Optimization Force the underlying type for \"wchar_t\" to be \"unsigned short\" fsigned-bitfields @@ -720,7 +720,7 @@ fthis-is-variable C++ ObjC++ fthreadsafe-statics -C++ ObjC++ +C++ ObjC++ Optimization -fno-threadsafe-statics Do not generate thread-safe code for initializing local statics funsigned-bitfields diff --git a/gcc/common.opt b/gcc/common.opt index cfb7967c286..dd3deb386a3 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -27,12 +27,29 @@ Common Display this information --param -Common Separate ---param = Set parameter to value. See below for a complete list of parameters +-help= +Common Report Joined +--help= Display descriptions of a specific class of options. is one or more of optimizers, target, warnings, undocumented, params -target-help Common +Alias for --help=target + +;; The following three entries are to work around the gcc driver +;; program's insatiable desire to turn options starting with a +;; double dash (--) into options starting with a dash f (-f). +fhelp +Common + +fhelp= +Common Joined + +ftarget-help +Common + +-param +Common Separate +--param = Set parameter to value. See below for a complete list of parameters -version Common @@ -54,11 +71,11 @@ Common RejectNegative This switch is deprecated; use -Wextra instead Waggregate-return -Common Var(warn_aggregate_return) +Common Var(warn_aggregate_return) Warning Warn about returning structures, unions or arrays Walways-true -Common Var(warn_always_true) +Common Var(warn_always_true) Warning Warn about comparisons that always evaluate to true Warray-bounds @@ -66,19 +83,19 @@ Common Var(warn_array_bounds) Warn if an array is accessed out of bounds Wattributes -Common Var(warn_attributes) Init(1) +Common Var(warn_attributes) Init(1) Warning Warn about inappropriate attribute usage Wcast-align -Common Var(warn_cast_align) +Common Var(warn_cast_align) Warning Warn about pointer casts which increase alignment Wdeprecated-declarations -Common Var(warn_deprecated_decl) Init(1) +Common Var(warn_deprecated_decl) Init(1) Warning Warn about uses of __attribute__((deprecated)) declarations Wdisabled-optimization -Common Var(warn_disabled_optimization) +Common Var(warn_disabled_optimization) Warning Warn when an optimization pass is disabled Werror @@ -90,7 +107,7 @@ Common Joined Treat specified warning as error Wextra -Common +Common Warning Print extra (possibly unwanted) warnings Wfatal-errors @@ -98,103 +115,103 @@ Common Var(flag_fatal_errors) Exit on the first error occurred Winline -Common Var(warn_inline) +Common Var(warn_inline) Warning Warn when an inlined function cannot be inlined Wlarger-than- -Common RejectNegative Joined UInteger +Common RejectNegative Joined UInteger Warning -Wlarger-than- Warn if an object is larger than bytes Wunsafe-loop-optimizations -Common Var(warn_unsafe_loop_optimizations) +Common Var(warn_unsafe_loop_optimizations) Warning Warn if the loop cannot be optimized due to nontrivial assumptions. Wmissing-noreturn -Common Var(warn_missing_noreturn) +Common Var(warn_missing_noreturn) Warning Warn about functions which might be candidates for __attribute__((noreturn)) Woverflow -Common Var(warn_overflow) Init(1) +Common Var(warn_overflow) Init(1) Warning Warn about overflow in arithmetic expressions Wpacked -Common Var(warn_packed) +Common Var(warn_packed) Warning Warn when the packed attribute has no effect on struct layout Wpadded -Common Var(warn_padded) +Common Var(warn_padded) Warning Warn when padding is required to align structure members Wshadow -Common Var(warn_shadow) +Common Var(warn_shadow) Warning Warn when one local variable shadows another Wstack-protector -Common Var(warn_stack_protect) +Common Var(warn_stack_protect) Warning Warn when not issuing stack smashing protection for some reason Wstrict-aliasing -Common +Common Warning Warn about code which might break strict aliasing rules Wstrict-aliasing= -Common Joined UInteger +Common Joined UInteger Warning Warn about code which might break strict aliasing rules Wstring-literal-comparison -Common Var(warn_string_literal_comparison) +Common Var(warn_string_literal_comparison) Warning Warn about comparisons to constant string literals Wswitch -Common Var(warn_switch) +Common Var(warn_switch) Warning Warn about enumerated switches, with no default, missing a case Wswitch-default -Common Var(warn_switch_default) +Common Var(warn_switch_default) Warning Warn about enumerated switches missing a \"default:\" statement Wswitch-enum -Common Var(warn_switch_enum) +Common Var(warn_switch_enum) Warning Warn about all enumerated switches missing a specific case Wsystem-headers -Common Var(warn_system_headers) +Common Var(warn_system_headers) Warning Do not suppress warnings from system headers Wuninitialized -Common Var(warn_uninitialized) +Common Var(warn_uninitialized) Warning Warn about uninitialized automatic variables Wunreachable-code -Common Var(warn_notreached) +Common Var(warn_notreached) Warning Warn about code that will never be executed Wunused -Common +Common Warning Enable all -Wunused- warnings Wunused-function -Common Var(warn_unused_function) +Common Var(warn_unused_function) Warning Warn when a function is unused Wunused-label -Common Var(warn_unused_label) +Common Var(warn_unused_label) Warning Warn when a label is unused Wunused-parameter -Common Var(warn_unused_parameter) +Common Var(warn_unused_parameter) Warning Warn when a function parameter is unused Wunused-value -Common Var(warn_unused_value) +Common Var(warn_unused_value) Warning Warn when an expression value is unused Wunused-variable -Common Var(warn_unused_variable) +Common Var(warn_unused_variable) Warning Warn when a variable is unused Wvolatile-register-var -Common Var(warn_register_var) +Common Var(warn_register_var) Warning Warn when a register variable is declared volatile Wcoverage-mismatch @@ -244,21 +261,21 @@ falign-functions= Common RejectNegative Joined UInteger falign-jumps -Common Report Var(align_jumps,0) +Common Report Var(align_jumps,0) Optimization Align labels which are only reached by jumping falign-jumps= Common RejectNegative Joined UInteger falign-labels -Common Report Var(align_labels,0) +Common Report Var(align_labels,0) Optimization Align all labels falign-labels= Common RejectNegative Joined UInteger falign-loops -Common Report Var(align_loops) +Common Report Var(align_loops) Optimization Align the start of loops falign-loops= @@ -273,23 +290,23 @@ Common RejectNegative Joined UInteger ; 3 if pointer arguments may not alias anything. True in Fortran. ; Set by the front end. fargument-alias -Common Report Var(flag_argument_noalias,0) +Common Report Var(flag_argument_noalias,0) Optimization Specify that arguments may alias each other and globals fargument-noalias -Common Report Var(flag_argument_noalias,1) VarExists +Common Report Var(flag_argument_noalias,1) VarExists Optimization Assume arguments may alias globals but not each other fargument-noalias-global -Common Report Var(flag_argument_noalias,2) VarExists +Common Report Var(flag_argument_noalias,2) VarExists Optimization Assume arguments alias neither each other nor globals fargument-noalias-anything -Common Report Var(flag_argument_noalias,3) VarExists +Common Report Var(flag_argument_noalias,3) VarExists Optimization Assume arguments alias no other storage fasynchronous-unwind-tables -Common Report Var(flag_asynchronous_unwind_tables) +Common Report Var(flag_asynchronous_unwind_tables) Optimization Generate unwind tables that are exact at each instruction boundary ; -fcheck-bounds causes gcc to generate array bounds checks. @@ -301,23 +318,23 @@ Common Report Var(flag_bounds_check) Generate code to check bounds before indexing arrays fbranch-count-reg -Common Report Var(flag_branch_on_count_reg) Init(1) +Common Report Var(flag_branch_on_count_reg) Init(1) Optimization Replace add, compare, branch with branch on count register fbranch-probabilities -Common Report Var(flag_branch_probabilities) +Common Report Var(flag_branch_probabilities) Optimization Use profiling information for branch probabilities fbranch-target-load-optimize -Common Report Var(flag_branch_target_load_optimize) +Common Report Var(flag_branch_target_load_optimize) Optimization Perform branch target load optimization before prologue / epilogue threading fbranch-target-load-optimize2 -Common Report Var(flag_branch_target_load_optimize2) +Common Report Var(flag_branch_target_load_optimize2) Optimization Perform branch target load optimization after prologue / epilogue threading fbtr-bb-exclusive -Common Report Var(flag_btr_bb_exclusive) +Common Report Var(flag_btr_bb_exclusive) Optimization Restrict target load migration not to re-use registers in any basic block fcall-saved- @@ -332,49 +349,49 @@ Common Joined RejectNegative ; be saved across function calls, if that produces overall better code. ; Optional now, so people can test it. fcaller-saves -Common Report Var(flag_caller_saves) +Common Report Var(flag_caller_saves) Optimization Save registers around function calls fcommon -Common Report Var(flag_no_common,0) +Common Report Var(flag_no_common,0) Optimization Do not put uninitialized globals in the common section fcprop-registers -Common Report Var(flag_cprop_registers) +Common Report Var(flag_cprop_registers) Optimization Perform a register copy-propagation optimization pass fcrossjumping -Common Report Var(flag_crossjumping) +Common Report Var(flag_crossjumping) Optimization Perform cross-jumping optimization fcse-follow-jumps -Common Report Var(flag_cse_follow_jumps) +Common Report Var(flag_cse_follow_jumps) Optimization When running CSE, follow jumps to their targets fcse-skip-blocks -Common Report Var(flag_cse_skip_blocks) +Common Report Var(flag_cse_skip_blocks) Optimization When running CSE, follow conditional jumps fcx-limited-range -Common Report Var(flag_cx_limited_range) +Common Report Var(flag_cx_limited_range) Optimization Omit range reduction step when performing complex division fdata-sections -Common Report Var(flag_data_sections) +Common Report Var(flag_data_sections) Optimization Place data items into their own section ; Nonzero for -fdefer-pop: don't pop args after each function call ; instead save them up to pop many calls' args with one insns. fdefer-pop -Common Report Var(flag_defer_pop) +Common Report Var(flag_defer_pop) Optimization Defer popping functions args from stack until later fdelayed-branch -Common Report Var(flag_delayed_branch) +Common Report Var(flag_delayed_branch) Optimization Attempt to fill delay slots of branch instructions fdelete-null-pointer-checks -Common Report Var(flag_delete_null_pointer_checks) +Common Report Var(flag_delete_null_pointer_checks) Optimization Delete useless null pointer checks fdiagnostics-show-location= @@ -398,7 +415,7 @@ Common Report Var(flag_dump_unnumbered) VarExists Suppress output of instruction numbers, line number notes and addresses in debugging dumps fearly-inlining -Common Report Var(flag_early_inlining) Init(1) +Common Report Var(flag_early_inlining) Init(1) Optimization Perform early inlining feliminate-dwarf2-dups @@ -418,18 +435,18 @@ Common Report Var(flag_emit_class_debug_always) Init(1) Do not suppress C++ class debug information. fexceptions -Common Report Var(flag_exceptions) +Common Report Var(flag_exceptions) Optimization Enable exception handling fexpensive-optimizations -Common Report Var(flag_expensive_optimizations) +Common Report Var(flag_expensive_optimizations) Optimization Perform a number of minor, expensive optimizations ffast-math Common ffinite-math-only -Common Report Var(flag_finite_math_only) +Common Report Var(flag_finite_math_only) Optimization Assume no NaNs or infinities are generated ffixed- @@ -437,16 +454,16 @@ Common Joined RejectNegative -ffixed- Mark as being unavailable to the compiler ffloat-store -Common Report Var(flag_float_store) +Common Report Var(flag_float_store) Optimization Don't allocate floats and doubles in extended-precision registers ; Nonzero for -fforce-addr: load memory address into a register before ; reference to memory. This makes better cse but slower compilation. fforce-addr -Common Report Var(flag_force_addr) +Common Report Var(flag_force_addr) Optimization Copy memory address constants into registers before use -fforward-propagate +fforward-propagate Optimization Common Report Var(flag_forward_propagate) Perform a forward propagation pass on RTL @@ -462,29 +479,29 @@ Common Report Var(flag_function_sections) Place each function into its own section fgcse -Common Report Var(flag_gcse) +Common Report Var(flag_gcse) Optimization Perform global common subexpression elimination fgcse-lm -Common Report Var(flag_gcse_lm) Init(1) +Common Report Var(flag_gcse_lm) Init(1) Optimization Perform enhanced load motion during global common subexpression elimination fgcse-sm -Common Report Var(flag_gcse_sm) Init(0) +Common Report Var(flag_gcse_sm) Init(0) Optimization Perform store motion after global common subexpression elimination fgcse-las -Common Report Var(flag_gcse_las) Init(0) +Common Report Var(flag_gcse_las) Init(0) Optimization Perform redundant load after store elimination in global common subexpression elimination fgcse-after-reload -Common Report Var(flag_gcse_after_reload) +Common Report Var(flag_gcse_after_reload) Optimization Perform global common subexpression elimination after register allocation has finished fguess-branch-probability -Common Report Var(flag_guess_branch_prob) +Common Report Var(flag_guess_branch_prob) Optimization Enable guessing of branch probabilities ; Nonzero means ignore `#ident' directives. 0 means handle them. @@ -496,11 +513,11 @@ Common Report Var(flag_no_ident,0) Process #ident directives fif-conversion -Common Report Var(flag_if_conversion) +Common Report Var(flag_if_conversion) Optimization Perform conversion of conditional jumps to branchless equivalents fif-conversion2 -Common Report Var(flag_if_conversion2) +Common Report Var(flag_if_conversion2) Optimization Perform conversion of conditional jumps to conditional execution ; -finhibit-size-directive inhibits output of .size for ELF. @@ -521,11 +538,11 @@ Common Report Var(flag_no_inline,0) Init(2) Pay attention to the \"inline\" keyword finline-functions -Common Report Var(flag_inline_functions) +Common Report Var(flag_inline_functions) Optimization Integrate simple functions into their callers finline-functions-called-once -Common Report Var(flag_inline_functions_called_once) Init(1) +Common Report Var(flag_inline_functions_called_once) Init(1) Optimization Integrate functions called once into their callers finline-limit- @@ -540,31 +557,31 @@ Common Report Var(flag_instrument_function_entry_exit) Instrument function entry and exit with profiling calls fipa-cp -Common Report Var(flag_ipa_cp) +Common Report Var(flag_ipa_cp) Optimization Perform Interprocedural constant propagation fipa-pure-const -Common Report Var(flag_ipa_pure_const) Init(0) +Common Report Var(flag_ipa_pure_const) Init(0) Optimization Discover pure and const functions fipa-pta -Common Report Var(flag_ipa_pta) Init(0) +Common Report Var(flag_ipa_pta) Init(0) Optimization Perform interprocedural points-to analysis fipa-reference -Common Report Var(flag_ipa_reference) Init(0) +Common Report Var(flag_ipa_reference) Init(0) Optimization Discover readonly and non addressable static variables fipa-type-escape -Common Report Var(flag_ipa_type_escape) Init(0) +Common Report Var(flag_ipa_type_escape) Init(0) Optimization Type based escape and alias analysis fivopts -Common Report Var(flag_ivopts) Init(1) +Common Report Var(flag_ivopts) Init(1) Optimization Optimize induction variables on trees fjump-tables -Common Var(flag_jump_tables) Init(1) +Common Var(flag_jump_tables) Init(1) Optimization Use jump tables for sufficiently large switch statements fkeep-inline-functions @@ -595,11 +612,11 @@ Report on permanent memory allocation ; string constants and constants from constant pool, if 2 also constant ; variables. fmerge-all-constants -Common Report Var(flag_merge_constants,2) Init(1) +Common Report Var(flag_merge_constants,2) Init(1) Optimization Attempt to merge identical constants and constant variables fmerge-constants -Common Report Var(flag_merge_constants,1) VarExists +Common Report Var(flag_merge_constants,1) VarExists Optimization Attempt to merge identical constants across compilation units fmessage-length= @@ -607,11 +624,11 @@ Common RejectNegative Joined UInteger -fmessage-length= Limit diagnostics to characters per line. 0 suppresses line-wrapping fmodulo-sched -Common Report Var(flag_modulo_sched) +Common Report Var(flag_modulo_sched) Optimization Perform SMS based modulo scheduling before the first scheduling pass fmove-loop-invariants -Common Report Var(flag_move_loop_invariants) Init(1) +Common Report Var(flag_move_loop_invariants) Init(1) Optimization Move loop invariant computations out of loops fmudflap @@ -627,23 +644,23 @@ Common RejectNegative Report Var(flag_mudflap_ignore_reads) Ignore read operations when inserting mudflap instrumentation freschedule-modulo-scheduled-loops -Common Report Var(flag_resched_modulo_sched) +Common Report Var(flag_resched_modulo_sched) Optimization Enable/Disable the traditional scheduling in loops that already passed modulo scheduling fnon-call-exceptions -Common Report Var(flag_non_call_exceptions) +Common Report Var(flag_non_call_exceptions) Optimization Support synchronous non-call exceptions fomit-frame-pointer -Common Report Var(flag_omit_frame_pointer) +Common Report Var(flag_omit_frame_pointer) Optimization When possible do not generate stack frames foptimize-register-move -Common Report Var(flag_regmove) +Common Report Var(flag_regmove) Optimization Do the full register move optimization pass foptimize-sibling-calls -Common Report Var(flag_optimize_sibling_calls) +Common Report Var(flag_optimize_sibling_calls) Optimization Optimize sibling and tail recursive calls fpre-ipa-mem-report @@ -655,11 +672,11 @@ Common Report Var(post_ipa_mem_report) Report on memory allocation before interprocedural optimization fpack-struct -Common Report Var(flag_pack_struct) +Common Report Var(flag_pack_struct) Optimization Pack structure members together without holes fpack-struct= -Common RejectNegative Joined UInteger +Common RejectNegative Joined UInteger Optimization -fpack-struct= Set initial maximum structure member alignment fpcc-struct-return @@ -667,15 +684,15 @@ Common Report Var(flag_pcc_struct_return,1) VarExists Return small aggregates in memory, not registers fpeel-loops -Common Report Var(flag_peel_loops) +Common Report Var(flag_peel_loops) Optimization Perform loop peeling fpeephole -Common Report Var(flag_no_peephole,0) +Common Report Var(flag_no_peephole,0) Optimization Enable machine specific peephole optimizations fpeephole2 -Common Report Var(flag_peephole2) +Common Report Var(flag_peephole2) Optimization Enable an RTL peephole pass before sched2 fPIC @@ -695,7 +712,7 @@ Common Report Var(flag_pie,1) VarExists Generate position-independent code for executables if possible (small mode) fprefetch-loop-arrays -Common Report Var(flag_prefetch_loop_arrays) +Common Report Var(flag_prefetch_loop_arrays) Optimization Generate prefetch instructions, if available, for arrays in loops fprofile @@ -736,31 +753,31 @@ Common Report Var(flag_record_gcc_switches) Record gcc command line switches in the object file. freg-struct-return -Common Report Var(flag_pcc_struct_return,0) VarExists +Common Report Var(flag_pcc_struct_return,0) VarExists Optimization Return small aggregates in registers fregmove -Common Report Var(flag_regmove) +Common Report Var(flag_regmove) Optimization Enables a register move optimization frename-registers -Common Report Var(flag_rename_registers) Init(2) +Common Report Var(flag_rename_registers) Init(2) Optimization Perform a register renaming optimization pass freorder-blocks -Common Report Var(flag_reorder_blocks) +Common Report Var(flag_reorder_blocks) Optimization Reorder basic blocks to improve code placement freorder-blocks-and-partition -Common Report Var(flag_reorder_blocks_and_partition) +Common Report Var(flag_reorder_blocks_and_partition) Optimization Reorder basic blocks and partition into hot and cold sections freorder-functions -Common Report Var(flag_reorder_functions) +Common Report Var(flag_reorder_functions) Optimization Reorder functions to improve code placement frerun-cse-after-loop -Common Report Var(flag_rerun_cse_after_loop) Init(2) +Common Report Var(flag_rerun_cse_after_loop) Init(2) Optimization Add a common subexpression elimination pass after loop optimizations frerun-loop-opt @@ -768,23 +785,23 @@ Common Does nothing. Preserved for backward compatibility. frounding-math -Common Report Var(flag_rounding_math) +Common Report Var(flag_rounding_math) Optimization Disable optimizations that assume default FP rounding behavior fsched-interblock -Common Report Var(flag_schedule_interblock) Init(1) +Common Report Var(flag_schedule_interblock) Init(1) Optimization Enable scheduling across basic blocks fsched-spec -Common Report Var(flag_schedule_speculative) Init(1) +Common Report Var(flag_schedule_speculative) Init(1) Optimization Allow speculative motion of non-loads fsched-spec-load -Common Report Var(flag_schedule_speculative_load) +Common Report Var(flag_schedule_speculative_load) Optimization Allow speculative motion of some loads fsched-spec-load-dangerous -Common Report Var(flag_schedule_speculative_load_dangerous) +Common Report Var(flag_schedule_speculative_load_dangerous) Optimization Allow speculative motion of more loads fsched-verbose= @@ -792,25 +809,25 @@ Common RejectNegative Joined -fsched-verbose= Set the verbosity level of the scheduler fsched2-use-superblocks -Common Report Var(flag_sched2_use_superblocks) +Common Report Var(flag_sched2_use_superblocks) Optimization If scheduling post reload, do superblock scheduling fsched2-use-traces -Common Report Var(flag_sched2_use_traces) +Common Report Var(flag_sched2_use_traces) Optimization If scheduling post reload, do trace scheduling fschedule-insns -Common Report Var(flag_schedule_insns) +Common Report Var(flag_schedule_insns) Optimization Reschedule instructions before register allocation fschedule-insns2 -Common Report Var(flag_schedule_insns_after_reload) +Common Report Var(flag_schedule_insns_after_reload) Optimization Reschedule instructions after register allocation ; sched_stalled_insns means that insns can be moved prematurely from the queue ; of stalled insns into the ready list. fsched-stalled-insns -Common Report Var(flag_sched_stalled_insns) +Common Report Var(flag_sched_stalled_insns) Optimization Allow premature scheduling of queued insns fsched-stalled-insns= @@ -822,7 +839,7 @@ Common RejectNegative Joined UInteger ; premature removal from the queue of stalled insns into the ready list (has ; an effect only if the flag 'sched_stalled_insns' is set). fsched-stalled-insns-dep -Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) +Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimization Set dependence distance checking in premature scheduling of queued insns fsched-stalled-insns-dep= @@ -830,11 +847,11 @@ Common RejectNegative Joined UInteger -fsched-stalled-insns-dep= Set dependence distance checking in premature scheduling of queued insns fsection-anchors -Common Report Var(flag_section_anchors) +Common Report Var(flag_section_anchors) Optimization Access data in the same section from shared anchor points frtl-abstract-sequences -Common Report Var(flag_rtl_seqabstr) +Common Report Var(flag_rtl_seqabstr) Optimization Perform sequence abstraction optimization on RTL fsee @@ -846,7 +863,7 @@ Common C ObjC C++ ObjC++ Report Var(flag_show_column) Init(1) Show column numbers in diagnostics, when available. Default on fsignaling-nans -Common Report Var(flag_signaling_nans) +Common Report Var(flag_signaling_nans) Optimization Disable optimizations observable by IEEE signaling NaNs fsigned-zeros @@ -854,11 +871,11 @@ Common Report Var(flag_signed_zeros) Init(1) Disable floating point optimizations that ignore the IEEE signedness of zero fsingle-precision-constant -Common Report Var(flag_single_precision_constant) +Common Report Var(flag_single_precision_constant) Optimization Convert floating point constants to single precision constants fsplit-ivs-in-unroller -Common Report Var(flag_split_ivs_in_unroller) Init(1) +Common Report Var(flag_split_ivs_in_unroller) Init(1) Optimization Split lifetimes of induction variables when loops are unrolled fsplit-wide-types @@ -866,7 +883,7 @@ Common Report Var(flag_split_wide_types) Split wide types into independent registers fvariable-expansion-in-unroller -Common Report Var(flag_variable_expansion_in_unroller) +Common Report Var(flag_variable_expansion_in_unroller) Optimization Apply variable expansion when loops are unrolled ; Emit code to probe the stack, to help detect stack overflow; also @@ -903,7 +920,7 @@ Does nothing. Preserved for backward compatibility. ; types do not alias expressions of certain other types. Only used ; if alias analysis (in general) is enabled. fstrict-aliasing -Common Report Var(flag_strict_aliasing) +Common Report Var(flag_strict_aliasing) Optimization Assume strict aliasing rules apply fstrict-overflow @@ -919,7 +936,7 @@ Common Report Var(flag_test_coverage) Create data files needed by \"gcov\" fthread-jumps -Common Report Var(flag_thread_jumps) +Common Report Var(flag_thread_jumps) Optimization Perform jump threading optimizations ftime-report @@ -931,7 +948,7 @@ Common Joined RejectNegative -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model ftoplevel-reorder -Common Report Var(flag_toplevel_reorder) Init(1) +Common Report Var(flag_toplevel_reorder) Init(1) Optimization Reorder top level functions, variables, and asms ftracer @@ -942,110 +959,114 @@ Perform superblock formation via tail duplication ; (user-visible) trap. This is the case, for example, in nonstop ; IEEE 754 arithmetic. ftrapping-math -Common Report Var(flag_trapping_math) Init(1) +Common Report Var(flag_trapping_math) Init(1) Optimization Assume floating-point operations can trap ftrapv -Common Report Var(flag_trapv) +Common Report Var(flag_trapv) Optimization Trap for signed overflow in addition, subtraction and multiplication ftree-ccp -Common Report Var(flag_tree_ccp) +Common Report Var(flag_tree_ccp) Optimization Enable SSA-CCP optimization on trees ftree-store-ccp -Common Report Var(flag_tree_store_ccp) +Common Report Var(flag_tree_store_ccp) Optimization Enable SSA-CCP optimization for stores and loads ftree-ch -Common Report Var(flag_tree_ch) +Common Report Var(flag_tree_ch) Optimization Enable loop header copying on trees ftree-copyrename -Common Report Var(flag_tree_copyrename) +Common Report Var(flag_tree_copyrename) Optimization Replace SSA temporaries with better names in copies ftree-copy-prop -Common Report Var(flag_tree_copy_prop) +Common Report Var(flag_tree_copy_prop) Optimization Enable copy propagation on trees ftree-store-copy-prop -Common Report Var(flag_tree_store_copy_prop) +Common Report Var(flag_tree_store_copy_prop) Optimization Enable copy propagation for stores and loads ftree-dce -Common Report Var(flag_tree_dce) +Common Report Var(flag_tree_dce) Optimization Enable SSA dead code elimination optimization on trees ftree-dominator-opts -Common Report Var(flag_tree_dom) +Common Report Var(flag_tree_dom) Optimization Enable dominator optimizations ftree-dse -Common Report Var(flag_tree_dse) +Common Report Var(flag_tree_dse) Optimization Enable dead store elimination ftree-fre -Common Report Var(flag_tree_fre) +Common Report Var(flag_tree_fre) Optimization Enable Full Redundancy Elimination (FRE) on trees ftree-loop-im -Common Report Var(flag_tree_loop_im) Init(1) +Common Report Var(flag_tree_loop_im) Init(1) Optimization Enable loop invariant motion on trees ftree-loop-linear -Common Report Var(flag_tree_loop_linear) +Common Report Var(flag_tree_loop_linear) Optimization Enable linear loop transforms on trees ftree-loop-ivcanon -Common Report Var(flag_tree_loop_ivcanon) Init(1) +Common Report Var(flag_tree_loop_ivcanon) Init(1) Optimization Create canonical induction variables in loops ftree-loop-optimize -Common Report Var(flag_tree_loop_optimize) Init(1) +Common Report Var(flag_tree_loop_optimize) Init(1) Optimization Enable loop optimizations on tree level ftree-pre -Common Report Var(flag_tree_pre) +Common Report Var(flag_tree_pre) Optimization Enable SSA-PRE optimization on trees ftree-salias -Common Report Var(flag_tree_salias) +Common Report Var(flag_tree_salias) Optimization Perform structural alias analysis ftree-sink -Common Report Var(flag_tree_sink) +Common Report Var(flag_tree_sink) Optimization Enable SSA code sinking on trees ftree-sra -Common Report Var(flag_tree_sra) +Common Report Var(flag_tree_sra) Optimization Perform scalar replacement of aggregates ftree-ter -Common Report Var(flag_tree_ter) +Common Report Var(flag_tree_ter) Optimization Replace temporary expressions in the SSA->normal pass +ftree-lrs +Common Report Var(flag_tree_live_range_split) Optimization +Perform live range splitting during the SSA->normal pass + ftree-vrp -Common Report Var(flag_tree_vrp) Init(0) +Common Report Var(flag_tree_vrp) Init(0) Optimization Perform Value Range Propagation on trees funit-at-a-time -Common Report Var(flag_unit_at_a_time) +Common Report Var(flag_unit_at_a_time) Optimization Compile whole compilation unit at a time funroll-loops -Common Report Var(flag_unroll_loops) +Common Report Var(flag_unroll_loops) Optimization Perform loop unrolling when iteration count is known funroll-all-loops -Common Report Var(flag_unroll_all_loops) +Common Report Var(flag_unroll_all_loops) Optimization Perform loop unrolling for all loops ; Nonzero means that loop optimizer may assume that the induction variables ; that control loops do not overflow and that the loops with nontrivial ; exit condition are not infinite funsafe-loop-optimizations -Common Report Var(flag_unsafe_loop_optimizations) +Common Report Var(flag_unsafe_loop_optimizations) Optimization Allow loop optimizations to assume that the loops behave in normal way ; Nonzero means that unsafe floating-point math optimizations are allowed @@ -1053,27 +1074,27 @@ Allow loop optimizations to assume that the loops behave in normal way ; are allowed to assume that their arguments and results are "normal" ; (e.g., nonnegative for SQRT). funsafe-math-optimizations -Common Report Var(flag_unsafe_math_optimizations) +Common Report Var(flag_unsafe_math_optimizations) Optimization Allow math optimizations that may violate IEEE or ISO standards funswitch-loops -Common Report Var(flag_unswitch_loops) +Common Report Var(flag_unswitch_loops) Optimization Perform loop unswitching funwind-tables -Common Report Var(flag_unwind_tables) +Common Report Var(flag_unwind_tables) Optimization Just generate unwind tables for exception handling fvar-tracking -Common Report Var(flag_var_tracking) VarExists +Common Report Var(flag_var_tracking) VarExists Optimization Perform variable tracking ftree-vectorize -Common Report Var(flag_tree_vectorize) +Common Report Var(flag_tree_vectorize) Optimization Enable loop vectorization on trees ftree-vect-loop-version -Common Report Var(flag_tree_vect_loop_version) Init(1) +Common Report Var(flag_tree_vect_loop_version) Init(1) Optimization Enable loop versioning when doing loop vectorization on trees ftree-vectorizer-verbose= @@ -1100,19 +1121,19 @@ Common Joined RejectNegative fvpt -Common Report Var(flag_value_profile_transformations) +Common Report Var(flag_value_profile_transformations) Optimization Use expression value profiles in optimizations fweb -Common Report Var(flag_web) Init(2) +Common Report Var(flag_web) Init(2) Optimization Construct webs and split unrelated uses of single variable fwhole-program -Common Report Var(flag_whole_program) Init(0) +Common Report Var(flag_whole_program) Init(0) Optimization Perform whole program optimizations fwrapv -Common Report Var(flag_wrapv) +Common Report Var(flag_wrapv) Optimization Assume signed arithmetic overflow wraps around fzero-initialized-in-bss diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b435781d513..8274d74ef0a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -160,8 +160,9 @@ in the following sections. @table @emph @item Overall Options @xref{Overall Options,,Options Controlling the Kind of Output}. -@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol --x @var{language} -v -### --help --target-help --version @@@var{file}} +@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol +-x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol +--version @@@var{file}} @item C Language Options @xref{C Dialect Options,,Options Controlling C Dialect}. @@ -1078,15 +1079,123 @@ Print (on the standard output) a description of the command line options understood by @command{gcc}. If the @option{-v} option is also specified then @option{--help} will also be passed on to the various processes invoked by @command{gcc}, so that they can display the command line options -they accept. If the @option{-Wextra} option is also specified then command -line options which have no documentation associated with them will also -be displayed. +they accept. If the @option{-Wextra} option has also been specified +(prior to the @option{--help} option), then command line options which +have no documentation associated with them will also be displayed. @item --target-help @opindex target-help -Print (on the standard output) a description of target specific command +Print (on the standard output) a description of target-specific command line options for each tool. +@item --help=@var{class}@r{[},@var{qualifier}@r{]} +Print (on the standard output) a description of the command line +options understood by the compiler that fit into a specific class. +The class can be one of @var{optimizers}, @var{warnings}, @var{target} +or @var{params}: + +@table @gcctabopt +@item @var{optimizers} +This will display all of the optimization options supported by the +compiler. + +@item @var{warnings} +This will display all of the options controlling warning messages +produced by the compiler. + +@item @var{target} +This will display target-specific options. Unlike the +@option{--target-help} option however, target-specific options of the +linker and assembler will not be displayed. This is because those +tools do not currently support the extended @option{--help=} syntax. + +@item @var{params} +This will display the values recognized by the @option{--param} +option. +@end table + +It is possible to further refine the output of the @option{--help=} +option by adding a comma separated list of qualifiers after the +class. These can be any from the following list: + +@table @gcctabopt +@item undocumented +Display only those options which are undocumented. + +@item joined +Display options which take an argument that appears after an equal +sign in the same continuous piece of text, such as: +@samp{--help=target}. + +@item separate +Display options which take an argument that appears as a separate word +following the original option, such as: @samp{-o output-file}. +@end table + +Thus for example to display all the undocumented target-specific +switches supported by the compiler the following can be used: + +@smallexample +--help=target,undocumented +@end smallexample + +The sense of a qualifier can be inverted by prefixing it with the +@var{^} character, so for example to display all binary warning +options (i.e. ones that are either on or off and that do not take an +argument), which have a description the following can be used: + +@smallexample +--help=warnings,^joined,^undocumented +@end smallexample + +A class can also be used as a qualifier, although this usually +restricts the output by so much that there is nothing to display. One +case where it does work however is when one of the classes is +@var{target}. So for example to display all the target-specific +optimization options the following can be used: + +@smallexample +--help=target,optimizers +@end smallexample + +The @option{--help=} option can be repeated on the command line. Each +successive use will display its requested class of options, skipping +those that have already been displayed. + +If the @option{-Q} option appears on the command line before the +@option{--help=} option, then the descriptive text displayed by +@option{--help=} is changed. Instead of describing the displayed +options, an indication is given as to whether the option is enabled, +disabled or set to a specific value (assuming that the compiler +knows this at the point where the @option{--help=} option is used). + +Here is a truncated example from the ARM port of @command{gcc}: + +@smallexample + % gcc -Q -mabi=2 --help=target -c + The following options are target specific: + -mabi= 2 + -mabort-on-noreturn [disabled] + -mapcs [disabled] +@end smallexample + +The output is sensitive to the effects of previous command line +options, so for example it is possible to find out which optimizations +are enabled at @option{-O2} by using: + +@smallexample +-O2 --help=optimizers +@end smallexample + +Alternatively you can discover which binary optimizations are enabled +by @option{-O3} by using: + +@smallexample +gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts +gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts +diff /tmp/O2-opts /tmp/O3-opts | grep enabled +@end smallexample + @item --version @opindex version Display the version number and copyrights of the invoked GCC@. @@ -2754,7 +2863,7 @@ if a variable may be clobbered by a @code{setjmp} call. These warnings are possible only in optimizing compilation, because they require data flow information that is computed only -when optimizing. If you do not specify @option{-O}, you will not get +when optimizing. If you do not specify @option{-O}, you will not get these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} requiring @option{-O}. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ae6444a1a7e..86a56529ba8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2007-02-12 Nick Clifton + + * lang.opt: Add Warning attribute to warning options. + 2007-02-11 Daniel Franke * intrinsic.texi (HOSTNM): Fix typographical error in syntax. diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 60806c58286..b1d5f2288a7 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -1,5 +1,5 @@ ; Options for the Fortran 95 front end. -; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ; ; This file is part of GCC. ; @@ -38,43 +38,43 @@ Fortran ; Documented in C Waliasing -Fortran +Fortran Warning Warn about possible aliasing of dummy arguments Wampersand -Fortran +Fortran Warning Warn about missing ampersand in continued character constants Wcharacter-truncation -Fortran +Fortran Warning Warn about truncated character expressions Wconversion -Fortran +Fortran Warning Warn about implicit conversion Wimplicit-interface -Fortran +Fortran Warning Warn about calls with implicit interface Wline-truncation -Fortran +Fortran Warning Warn about truncated source lines Wnonstd-intrinsics -Fortran +Fortran Warning Warn about usage of non-standard intrinsics Wsurprising -Fortran +Fortran Warning Warn about \"suspicious\" constructs Wtabs -Fortran +Fortran Warning Permit nonconforming uses of the tab character Wunderflow -Fortran +Fortran Warning Warn about underflow of numerical constant expressions fall-intrinsics diff --git a/gcc/gcc.c b/gcc/gcc.c index a7bb71e8760..14e4ceea71f 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1,7 +1,7 @@ /* Compiler driver program that can handle many languages. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, - Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -179,9 +179,9 @@ static int verbose_flag; shell scripts to capture the driver-generated command line. */ static int verbose_only_flag; -/* Flag indicating to print target specific command line options. */ +/* Flag indicating how to print command line options of sub-processes. */ -static int target_help_flag; +static int print_subprocess_help; /* Flag indicating whether we should report subprocess execution times (if this is supported by the system - see pexecute.c). */ @@ -805,6 +805,7 @@ static const char *cc1_options = %{v:-version} %{pg:-p} %{p} %{f*} %{undef}\ %{Qn:-fno-ident} %{--help:--help}\ %{--target-help:--target-help}\ + %{--help=*:--help=%(VALUE)}\ %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\ %{fsyntax-only:-o %j} %{-param*}\ %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}\ @@ -1492,7 +1493,7 @@ static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; static const char *md_exec_prefix = MD_EXEC_PREFIX; static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; -static const char *const standard_startfile_prefix_1 +static const char *const standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1; static const char *const standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2; @@ -3174,6 +3175,8 @@ display_help (void) fputs (_(" -pass-exit-codes Exit with highest error code from a phase\n"), stdout); fputs (_(" --help Display this information\n"), stdout); fputs (_(" --target-help Display target specific command line options\n"), stdout); + fputs (_(" --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]\n"), stdout); + fputs (_(" Display specific types of command line options\n"), stdout); if (! verbose_flag) fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout); fputs (_(" -dumpspecs Display all of the built in spec strings\n"), stdout); @@ -3589,10 +3592,19 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" add_assembler_option ("--help", 6); add_linker_option ("--help", 6); } + else if (strncmp (argv[i], "-fhelp=", 7) == 0) + { + /* translate_options () has turned --help into -fhelp. */ + print_subprocess_help = 2; + + /* We will be passing a dummy file on to the sub-processes. */ + n_infiles++; + n_switches++; + } else if (strcmp (argv[i], "-ftarget-help") == 0) { /* translate_options() has turned --target-help into -ftarget-help. */ - target_help_flag = 1; + print_subprocess_help = 1; /* We will be passing a dummy file on to the sub-processes. */ n_infiles++; @@ -4074,10 +4086,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ; else if (! strcmp (argv[i], "-print-multi-os-directory")) ; - else if (! strcmp (argv[i], "-ftarget-help")) - ; - else if (! strcmp (argv[i], "-fhelp")) - ; else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot="))) { target_system_root = argv[i] + strlen ("--sysroot="); @@ -4243,34 +4251,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" error ("warning: '-x %s' after last input file has no effect", spec_lang); /* Ensure we only invoke each subprocess once. */ - if (target_help_flag || print_help_list) + if (print_subprocess_help || print_help_list) { n_infiles = 1; - /* Create a dummy input file, so that we can pass --target-help on to - the various sub-processes. */ + /* Create a dummy input file, so that we can pass + the help option on to the various sub-processes. */ infiles[0].language = "c"; infiles[0].name = "help-dummy"; - - if (target_help_flag) - { - switches[n_switches].part1 = "--target-help"; - switches[n_switches].args = 0; - switches[n_switches].live_cond = SWITCH_OK; - switches[n_switches].validated = 0; - - n_switches++; - } - - if (print_help_list) - { - switches[n_switches].part1 = "--help"; - switches[n_switches].args = 0; - switches[n_switches].live_cond = SWITCH_OK; - switches[n_switches].validated = 0; - - n_switches++; - } } switches[n_switches].part1 = 0; @@ -6421,16 +6409,6 @@ main (int argc, char **argv) return (0); } - if (target_help_flag) - { - /* Print if any target specific options. */ - - /* We do not exit here. Instead we have created a fake input file - called 'target-dummy' which needs to be compiled, and we pass this - on to the various sub-processes, along with the --target-help - switch. */ - } - if (print_help_list) { display_help (); diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 3e4c8059606..87bce434ce6 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -1,4 +1,4 @@ -# Copyright (C) 2003,2004 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc. # Contributed by Kelley Cook, June 2004. # Original code from Neil Booth, May 2003. # @@ -77,6 +77,8 @@ function switch_flags (flags) test_flag("RejectNegative", flags, " | CL_REJECT_NEGATIVE") \ test_flag("UInteger", flags, " | CL_UINTEGER") \ test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \ + test_flag("Warning", flags, " | CL_WARNING") \ + test_flag("Optimization", flags, " | CL_OPTIMIZATION") \ test_flag("Report", flags, " | CL_REPORT") sub( "^0 \\| ", "", result ) return result diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index aa6bb11a10c..35b3d355089 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -1,4 +1,4 @@ -# Copyright (C) 2003,2004 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc. # Contributed by Kelley Cook, June 2004. # Original code from Neil Booth, May 2003. # @@ -119,6 +119,7 @@ for (i = 0; i < n_langs; i++) { print " 0\n};\n" print "const unsigned int cl_options_count = N_OPTS;\n" +print "const unsigned int cl_lang_count = " n_langs ";\n" print "const struct cl_option cl_options[] =\n{" diff --git a/gcc/opts.c b/gcc/opts.c index 0fa98143a69..daa9c9eb65c 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -83,15 +83,12 @@ enum symbol_visibility default_visibility = VISIBILITY_DEFAULT; /* Disable unit-at-a-time for frontends that might be still broken in this respect. */ - + bool no_unit_at_a_time_default; /* Global visibility options. */ struct visibility_flags visibility_options; -/* Columns of --help display. */ -static unsigned int columns = 80; - /* What to print when a switch has no documentation. */ static const char undocumented_msg[] = N_("This switch lacks documentation"); @@ -115,12 +112,6 @@ static char *write_langs (unsigned int lang_mask); static void complain_wrong_lang (const char *, const struct cl_option *, unsigned int lang_mask); static void handle_options (unsigned int, const char **, unsigned int); -static void wrap_help (const char *help, const char *item, unsigned int); -static void print_target_help (void); -static void print_help (void); -static void print_param_help (void); -static void print_filtered_help (unsigned int); -static unsigned int print_switch (const char *text, unsigned int indent); static void set_debug_level (enum debug_info_type type, int extended, const char *arg); @@ -320,7 +311,7 @@ handle_option (const char **argv, unsigned int lang_mask) *(const char **) option->flag_var = arg; break; } - + if (option->flags & lang_mask) if (lang_hooks.handle_option (opt_index, arg, value) == 0) result = 0; @@ -601,7 +592,7 @@ decode_options (unsigned int argc, const char **argv) if (flag_exceptions && flag_reorder_blocks_and_partition) { - inform + inform ("-freorder-blocks-and-partition does not work with exceptions"); flag_reorder_blocks_and_partition = 0; flag_reorder_blocks = 1; @@ -626,13 +617,300 @@ decode_options (unsigned int argc, const char **argv) && (!targetm.have_named_sections || (flag_unwind_tables && targetm.unwind_tables_default))) { - inform + inform ("-freorder-blocks-and-partition does not work on this architecture"); flag_reorder_blocks_and_partition = 0; flag_reorder_blocks = 1; } } +#define LEFT_COLUMN 27 + +/* Output ITEM, of length ITEM_WIDTH, in the left column, + followed by word-wrapped HELP in a second column. */ +static void +wrap_help (const char *help, + const char *item, + unsigned int item_width, + unsigned int columns) +{ + unsigned int col_width = LEFT_COLUMN; + unsigned int remaining, room, len; + + remaining = strlen (help); + + do + { + room = columns - 3 - MAX (col_width, item_width); + if (room > columns) + room = 0; + len = remaining; + + if (room < len) + { + unsigned int i; + + for (i = 0; help[i]; i++) + { + if (i >= room && len != remaining) + break; + if (help[i] == ' ') + len = i; + else if ((help[i] == '-' || help[i] == '/') + && help[i + 1] != ' ' + && i > 0 && ISALPHA (help[i - 1])) + len = i + 1; + } + } + + printf( " %-*.*s %.*s\n", col_width, item_width, item, len, help); + item_width = 0; + while (help[len] == ' ') + len++; + help += len; + remaining -= len; + } + while (remaining); +} + +/* Print help for a specific front-end, etc. */ +static void +print_filtered_help (unsigned int include_flags, + unsigned int exclude_flags, + unsigned int any_flags, + unsigned int columns) +{ + unsigned int i; + const char *help; + static char *printed = NULL; + bool found = false; + bool displayed = false; + + if (include_flags == CL_PARAMS) + { + for (i = 0; i < LAST_PARAM; i++) + { + const char *param = compiler_params[i].option; + + help = compiler_params[i].help; + if (help == NULL || *help == '\0') + { + if (exclude_flags & CL_UNDOCUMENTED) + continue; + help = undocumented_msg; + } + + /* Get the translation. */ + help = _(help); + + wrap_help (help, param, strlen (param), columns); + } + putchar ('\n'); + return; + } + + if (!printed) + printed = xcalloc (1, cl_options_count); + + for (i = 0; i < cl_options_count; i++) + { + static char new_help[128]; + const struct cl_option *option = cl_options + i; + unsigned int len; + const char *opt; + const char *tab; + + if (include_flags == 0 + || ((option->flags & include_flags) != include_flags)) + { + if ((option->flags & any_flags) == 0) + continue; + } + + /* Skip unwanted switches. */ + if ((option->flags & exclude_flags) != 0) + continue; + + found = true; + /* Skip switches that have already been printed. */ + if (printed[i]) + continue; + + printed[i] = true; + + help = option->help; + if (help == NULL) + { + if (exclude_flags & CL_UNDOCUMENTED) + continue; + help = undocumented_msg; + } + + /* Get the translation. */ + help = _(help); + + /* Find the gap between the name of the + option and its descriptive text. */ + tab = strchr (help, '\t'); + if (tab) + { + len = tab - help; + opt = help; + help = tab + 1; + } + else + { + opt = option->opt_text; + len = strlen (opt); + } + + /* With the -Q option enabled we change the descriptive text associated + with an option to be an indication of its current setting. */ + if (!quiet_flag) + { + if (len < (LEFT_COLUMN + 2)) + strcpy (new_help, "\t\t"); + else + strcpy (new_help, "\t"); + + if (option->flag_var != NULL) + { + if (option->flags & CL_JOINED) + { + if (option->var_type == CLVC_STRING) + { + if (* (const char **) option->flag_var != NULL) + snprintf (new_help + strlen (new_help), + sizeof (new_help) - strlen (new_help), + * (const char **) option->flag_var); + } + else + sprintf (new_help + strlen (new_help), + "%#x", * (int *) option->flag_var); + } + else + strcat (new_help, option_enabled (i) + ? _("[enabled]") : _("[disabled]")); + } + + help = new_help; + } + + wrap_help (help, opt, len, columns); + displayed = true; + } + + if (! found) + printf (_(" No options with the desired characteristics were found\n")); + else if (! displayed) + printf (_(" All options with the desired characteristics have already been displayed\n")); + + putchar ('\n'); +} + +/* Display help for a specified type of option. + The options must have ALL of the INCLUDE_FLAGS set + ANY of the flags in the ANY_FLAGS set + and NONE of the EXCLUDE_FLAGS set. */ +static void +print_specific_help (unsigned int include_flags, + unsigned int exclude_flags, + unsigned int any_flags) +{ + unsigned int all_langs_mask = (1U << cl_lang_count) - 1; + const char * description = NULL; + const char * descrip_extra = ""; + size_t i; + unsigned int flag; + static unsigned int columns = 0; + + /* Sanity check: Make sure that we do not have more + languages than we have bits available to enumerate them. */ + gcc_assert ((1U << cl_lang_count) < CL_MIN_OPTION_CLASS); + + /* If we have not done so already, obtain + the desired maximum width of the output. */ + if (columns == 0) + { + const char *p; + + GET_ENVIRONMENT (p, "COLUMNS"); + if (p != NULL) + { + int value = atoi (p); + + if (value > 0) + columns = value; + } + + if (columns == 0) + /* Use a reasonable default. */ + columns = 80; + } + + /* Decide upon the title for the options that we are going to display. */ + for (i = 0, flag = 1; flag <= CL_MAX_OPTION_CLASS; flag <<= 1, i ++) + { + switch (flag & include_flags) + { + case 0: + break; + + case CL_TARGET: + description = _("The following options are target specific"); + break; + case CL_WARNING: + description = _("The following options control compiler warning messages"); + break; + case CL_OPTIMIZATION: + description = _("The following options control optimizations"); + break; + case CL_COMMON: + description = _("The following options are language-independent"); + break; + case CL_PARAMS: + description = _("The --param option recognizes the following as parameters"); + break; + default: + if (i >= cl_lang_count) + break; + if ((exclude_flags & ((1U << cl_lang_count) - 1)) != 0) + { + description = _("The following options are specific to the language "); + descrip_extra = lang_names [i]; + } + else + description = _("The following options are supported by, amoung others, the language "); + break; + } + } + + if (description == NULL) + { + if (any_flags == 0) + { + if (include_flags == CL_UNDOCUMENTED) + description = _("The following options are not documented"); + else + { + internal_error ("unrecognized include_flags 0x%x passed to print_specific_help", + include_flags); + return; + } + } + else + { + if (any_flags & all_langs_mask) + description = _("The following options are language-related"); + else + description = _("The following options are language-independent"); + } + } + + printf ("%s%s:\n", description, descrip_extra); + print_filtered_help (include_flags, exclude_flags, any_flags, columns); +} + /* Handle target- and language-independent options. Return zero to generate an "unknown option" message. Only options that need extra handling need to be listed here; if you simply want @@ -646,20 +924,124 @@ common_handle_option (size_t scode, const char *arg, int value, switch (code) { - case OPT__help: - print_help (); - exit_after_options = true; - break; - case OPT__param: handle_param (arg); break; + case OPT_fhelp: + case OPT__help: + { + unsigned int all_langs_mask = (1U << cl_lang_count) - 1; + unsigned int undoc_mask; + unsigned int i; + + undoc_mask = extra_warnings ? 0 : CL_UNDOCUMENTED; + /* First display any single language specific options. */ + for (i = 0; i < cl_lang_count; i++) + print_specific_help + (1U << i, (all_langs_mask & (~ (1U << i))) | undoc_mask, 0); + /* Next display any multi language specific options. */ + print_specific_help (0, undoc_mask, all_langs_mask); + /* Then display any remaining, non-language options. */ + for (i = CL_MIN_OPTION_CLASS; i <= CL_MAX_OPTION_CLASS; i <<= 1) + print_specific_help (i, undoc_mask, 0); + exit_after_options = true; + break; + } + + case OPT_ftarget_help: case OPT__target_help: - print_target_help (); + print_specific_help (CL_TARGET, CL_UNDOCUMENTED, 0); exit_after_options = true; break; + case OPT_fhelp_: + case OPT__help_: + { + const char * a = arg; + unsigned int include_flags = 0; + /* Note - by default we include undocumented options when listing + specific classes. If you only want to see documented options + then add ",^undocumented" to the --help= option. e.g.: + + --help=target,^undocumented */ + unsigned int exclude_flags = 0; + + /* Walk along the argument string, parsing each word in turn. + The format is: + arg = [^]{word}[,{arg}] + word = {optimizers|target|warnings|undocumented|params} */ + while (* a != 0) + { + static struct + { + const char * string; + unsigned int flag; + } + specifics[] = + { + { "optimizers", CL_OPTIMIZATION }, + { "target", CL_TARGET }, + { "warnings", CL_WARNING }, + { "undocumented", CL_UNDOCUMENTED }, + { "params", CL_PARAMS }, + { "joined", CL_JOINED }, + { "separate", CL_SEPARATE }, + { NULL, 0 } + }; + unsigned int * pflags; + char * comma; + unsigned int len; + unsigned int i; + + if (* a == '^') + { + ++ a; + pflags = & exclude_flags; + } + else + pflags = & include_flags; + + comma = strchr (a, ','); + if (comma == NULL) + len = strlen (a); + else + len = comma - a; + + for (i = 0; specifics[i].string != NULL; i++) + if (strncasecmp (a, specifics[i].string, len) == 0) + { + * pflags |= specifics[i].flag; + break; + } + + if (specifics[i].string == NULL) + { + /* Check to see if the string matches a language name. */ + for (i = 0; i < cl_lang_count; i++) + if (strncasecmp (a, lang_names[i], len) == 0) + { + * pflags |= 1U << i; + break; + } + + if (i == cl_lang_count) + fnotice (stderr, + "warning: unrecognized argument to --help= switch: %.*s\n", + len, a); + } + + if (comma == NULL) + break; + a = comma + 1; + } + + if (include_flags) + print_specific_help (include_flags, exclude_flags, 0); + exit_after_options = true; + break; + } + case OPT__version: print_version (stderr, ""); exit_after_options = true; @@ -684,6 +1066,7 @@ common_handle_option (size_t scode, const char *arg, int value, { char *new_option; int option_index; + new_option = XNEWVEC (char, strlen (arg) + 2); new_option[0] = 'W'; strcpy (new_option+1, arg); @@ -819,7 +1202,7 @@ common_handle_option (size_t scode, const char *arg, int value, case OPT_fpack_struct_: if (value <= 0 || (value & (value - 1)) || value > 16) - error("structure alignment must be a small power of two, not %d", value); + error ("structure alignment must be a small power of two, not %d", value); else { initial_max_fld_align = value; @@ -1153,238 +1536,6 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg) } } -/* Display help for target options. */ -static void -print_target_help (void) -{ - unsigned int i; - static bool displayed = false; - - /* Avoid double printing for --help --target-help. */ - if (displayed) - return; - - displayed = true; - for (i = 0; i < cl_options_count; i++) - if ((cl_options[i].flags & (CL_TARGET | CL_UNDOCUMENTED)) == CL_TARGET) - { - printf (_("\nTarget specific options:\n")); - print_filtered_help (CL_TARGET); - break; - } -} - -/* Output --help text. */ -static void -print_help (void) -{ - size_t i; - const char *p; - - GET_ENVIRONMENT (p, "COLUMNS"); - if (p) - { - int value = atoi (p); - if (value > 0) - columns = value; - } - - puts (_("The following options are language-independent:\n")); - - print_filtered_help (CL_COMMON); - print_param_help (); - - for (i = 0; lang_names[i]; i++) - { - printf (_("The %s front end recognizes the following options:\n\n"), - lang_names[i]); - print_filtered_help (1U << i); - } - print_target_help (); -} - -/* Print the help for --param. */ -static void -print_param_help (void) -{ - size_t i; - - puts (_("The --param option recognizes the following as parameters:\n")); - - for (i = 0; i < LAST_PARAM; i++) - { - const char *help = compiler_params[i].help; - const char *param = compiler_params[i].option; - - if (help == NULL || *help == '\0') - help = undocumented_msg; - - /* Get the translation. */ - help = _(help); - - wrap_help (help, param, strlen (param)); - } - - putchar ('\n'); -} - -/* Print help for a specific front-end, etc. */ -static void -print_filtered_help (unsigned int flag) -{ - unsigned int i, len, filter, indent = 0; - bool duplicates = false; - const char *help, *opt, *tab; - static char *printed; - - if (flag == CL_COMMON || flag == CL_TARGET) - { - filter = flag; - if (!printed) - printed = xmalloc (cl_options_count); - memset (printed, 0, cl_options_count); - } - else - { - /* Don't print COMMON options twice. */ - filter = flag | CL_COMMON; - - for (i = 0; i < cl_options_count; i++) - { - if ((cl_options[i].flags & filter) != flag) - continue; - - /* Skip help for internal switches. */ - if (cl_options[i].flags & CL_UNDOCUMENTED) - continue; - - /* Skip switches that have already been printed, mark them to be - listed later. */ - if (printed[i]) - { - duplicates = true; - indent = print_switch (cl_options[i].opt_text, indent); - } - } - - if (duplicates) - { - putchar ('\n'); - putchar ('\n'); - } - } - - for (i = 0; i < cl_options_count; i++) - { - if ((cl_options[i].flags & filter) != flag) - continue; - - /* Skip help for internal switches. */ - if (cl_options[i].flags & CL_UNDOCUMENTED) - continue; - - /* Skip switches that have already been printed. */ - if (printed[i]) - continue; - - printed[i] = true; - - help = cl_options[i].help; - if (!help) - help = undocumented_msg; - - /* Get the translation. */ - help = _(help); - - tab = strchr (help, '\t'); - if (tab) - { - len = tab - help; - opt = help; - help = tab + 1; - } - else - { - opt = cl_options[i].opt_text; - len = strlen (opt); - } - - wrap_help (help, opt, len); - } - - putchar ('\n'); -} - -/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by - word-wrapped HELP in a second column. */ -static unsigned int -print_switch (const char *text, unsigned int indent) -{ - unsigned int len = strlen (text) + 1; /* trailing comma */ - - if (indent) - { - putchar (','); - if (indent + len > columns) - { - putchar ('\n'); - putchar (' '); - indent = 1; - } - } - else - putchar (' '); - - putchar (' '); - fputs (text, stdout); - - return indent + len + 1; -} - -/* Output ITEM, of length ITEM_WIDTH, in the left column, followed by - word-wrapped HELP in a second column. */ -static void -wrap_help (const char *help, const char *item, unsigned int item_width) -{ - unsigned int col_width = 27; - unsigned int remaining, room, len; - - remaining = strlen (help); - - do - { - room = columns - 3 - MAX (col_width, item_width); - if (room > columns) - room = 0; - len = remaining; - - if (room < len) - { - unsigned int i; - - for (i = 0; help[i]; i++) - { - if (i >= room && len != remaining) - break; - if (help[i] == ' ') - len = i; - else if ((help[i] == '-' || help[i] == '/') - && help[i + 1] != ' ' - && i > 0 && ISALPHA (help[i - 1])) - len = i + 1; - } - } - - printf( " %-*.*s %.*s\n", col_width, item_width, item, len, help); - item_width = 0; - while (help[len] == ' ') - len++; - help += len; - remaining -= len; - } - while (remaining); -} - /* Return 1 if OPTION is enabled, 0 if it is disabled, or -1 if it isn't a simple on-off switch. */ @@ -1392,6 +1543,7 @@ int option_enabled (int opt_idx) { const struct cl_option *option = &(cl_options[opt_idx]); + if (option->flag_var) switch (option->var_type) { diff --git a/gcc/opts.h b/gcc/opts.h index 3af501fbf99..b60cb47a16f 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -1,5 +1,5 @@ /* Command line option handling. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -64,17 +64,30 @@ struct cl_option_state { extern const struct cl_option cl_options[]; extern const unsigned int cl_options_count; extern const char *const lang_names[]; +extern const unsigned int cl_lang_count; extern bool no_unit_at_a_time_default; -#define CL_DISABLED (1 << 21) /* Disabled in this configuration. */ -#define CL_TARGET (1 << 22) /* Target-specific option. */ -#define CL_REPORT (1 << 23) /* Report argument with -fverbose-asm */ -#define CL_JOINED (1 << 24) /* If takes joined argument. */ -#define CL_SEPARATE (1 << 25) /* If takes a separate argument. */ -#define CL_REJECT_NEGATIVE (1 << 26) /* Reject no- form. */ -#define CL_MISSING_OK (1 << 27) /* Missing argument OK (joined). */ -#define CL_UINTEGER (1 << 28) /* Argument is an integer >=0. */ -#define CL_COMMON (1 << 29) /* Language-independent. */ +#define CL_PARAMS (1 << 18) /* Fake entry. Used to display --param info with --help. */ +#define CL_WARNING (1 << 19) /* Enables an (optional) warning message. */ +#define CL_OPTIMIZATION (1 << 20) /* Enables an (optional) optimization. */ +#define CL_TARGET (1 << 21) /* Target-specific option. */ +#define CL_COMMON (1 << 22) /* Language-independent. */ + +#define CL_MIN_OPTION_CLASS CL_PARAMS +#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_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. */ /* Input file names. */