From: Joseph Myers Date: Thu, 2 Sep 2010 11:41:22 +0000 (+0100) Subject: re PR driver/44076 (-MT behaves different as -MT (w/o space)) X-Git-Tag: releases/gcc-4.6.0~4710 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5de8299cec99d5a056149ce23d09d3db5cbf0116;p=thirdparty%2Fgcc.git re PR driver/44076 (-MT behaves different as -MT (w/o space)) PR driver/44076 * opts.h (struct cl_option): Add alias_arg, neg_alias_arg and alias_target fields. * opt-functions.awk (opt_sanitized_name): Don't handle finline-limit=, Wlarger-than= and ftemplate-depth= specially. * optc-gen.awk: Generate alias fields. * opth-gen.awk: Explicitly give values for OPT_* enum constants. Don't generate such constants for aliases. * opts-common.c (generate_canonical_option): New. (decode_cmdline_option): Handle aliases. Use generate_canonical_option for known options instead of copying the input option text. * doc/options.texi (Alias): Document. * common.opt (W, Wlarger-than-, aux-info=, finline-limit-, fstack-check, specs): Mark as aliases. * gcc.c (driver_handle_option): Canonicalize -L options to joined arguments. (driver_handle_option): Don't handle OPT_specs. * opts.c (common_handle_option): Don't handle options marked as aliases. (enable_warning_as_error): Handle aliases. * stor-layout.c (layout_decl): Use OPT_Wlarger_than_ instead of OPT_Wlarger_than_eq. * tree-optimize.c (tree_rest_of_compilation): Use OPT_Wlarger_than_ instead of OPT_Wlarger_than_eq. c-family: * c.opt (Wcomments, Werror-implicit-function-declaration, ftemplate-depth-, std=c89, std=c9x, std=gnu89, std=gnu9x, std=iso9899:1990, std=iso9899:1999, std=iso9899:199x): Mark as aliases. * c-common.c (option_codes): Use OPT_Wcomment instead of OPT_Wcomments. * c-opts.c (warning_as_error_callback, c_common_handle_option): Don't handle options marked as aliases. java: * lang.opt (CLASSPATH, bootclasspath, classpath, encoding, fCLASSPATH=): Mark as Java options and as aliases. * jvspec.c (jvgenmain_spec): Don't handle -fCLASSPATH*. (lang_specific_driver): Don't handle options marked as aliases. * lang.c (java_handle_option): Don't handle OPT_fCLASSPATH_. testsuite: * gcc.dg/cpp/warn-comments-3.c: New. Based on warn-comments-2.c but using -Werror=comment. * gcc.dg/cpp/warn-comments.c, gcc.dg/cpp/warn-comments-2.c: Adjust expected error messages. From-SVN: r163770 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41ceb7b79b18..3baa67ace257 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2010-09-02 Joseph Myers + + PR driver/44076 + * opts.h (struct cl_option): Add alias_arg, neg_alias_arg and + alias_target fields. + * opt-functions.awk (opt_sanitized_name): Don't handle + finline-limit=, Wlarger-than= and ftemplate-depth= specially. + * optc-gen.awk: Generate alias fields. + * opth-gen.awk: Explicitly give values for OPT_* enum constants. + Don't generate such constants for aliases. + * opts-common.c (generate_canonical_option): New. + (decode_cmdline_option): Handle aliases. Use + generate_canonical_option for known options instead of copying the + input option text. + * doc/options.texi (Alias): Document. + * common.opt (W, Wlarger-than-, aux-info=, finline-limit-, + fstack-check, specs): Mark as aliases. + * gcc.c (driver_handle_option): Canonicalize -L options to joined + arguments. + (driver_handle_option): Don't handle OPT_specs. + * opts.c (common_handle_option): Don't handle options marked as + aliases. + (enable_warning_as_error): Handle aliases. + * stor-layout.c (layout_decl): Use OPT_Wlarger_than_ instead of + OPT_Wlarger_than_eq. + * tree-optimize.c (tree_rest_of_compilation): Use + OPT_Wlarger_than_ instead of OPT_Wlarger_than_eq. + 2010-09-02 Uros Bizjak * config/i386/i386.md (nonmemory_operand): New mode attribute. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 165ec2032b54..dac0bf4684ec 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2010-09-02 Joseph Myers + + * c.opt (Wcomments, Werror-implicit-function-declaration, + ftemplate-depth-, std=c89, std=c9x, std=gnu89, std=gnu9x, + std=iso9899:1990, std=iso9899:1999, std=iso9899:199x): Mark as + aliases. + * c-common.c (option_codes): Use OPT_Wcomment instead of + OPT_Wcomments. + * c-opts.c (warning_as_error_callback, c_common_handle_option): + Don't handle options marked as aliases. + 2010-08-25 Richard Guenther * c-common.c (c_common_get_alias_set): Remove special diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 3a79968b202a..6b9a9676af03 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8150,7 +8150,7 @@ struct reason_option_codes_t static const struct reason_option_codes_t option_codes[] = { {CPP_W_DEPRECATED, OPT_Wdeprecated}, - {CPP_W_COMMENTS, OPT_Wcomments}, + {CPP_W_COMMENTS, OPT_Wcomment}, {CPP_W_TRIGRAPHS, OPT_Wtrigraphs}, {CPP_W_MULTICHAR, OPT_Wmultichar}, {CPP_W_TRADITIONAL, OPT_Wtraditional}, diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index b46b0a04908f..d9b212c4e2b2 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -161,7 +161,6 @@ warning_as_error_callback (int option_index) break; case OPT_Wcomment: - case OPT_Wcomments: cpp_opts->warn_comments = 1; break; @@ -493,7 +492,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_Wcomment: - case OPT_Wcomments: cpp_opts->warn_comments = value; break; @@ -521,13 +519,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, global_dc->warning_as_error_requested = value; break; - case OPT_Werror_implicit_function_declaration: - /* For backward compatibility, this is the same as - -Werror=implicit-function-declaration. */ - enable_warning_as_error ("implicit-function-declaration", value, - CL_C | CL_ObjC, handlers); - break; - case OPT_Wformat: set_Wformat (value); break; @@ -752,8 +743,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT_ftemplate_depth_: - /* Kept for backwards compatibility. */ - case OPT_ftemplate_depth_eq: max_tinst_depth = value; break; @@ -865,30 +854,23 @@ c_common_handle_option (size_t scode, const char *arg, int value, set_std_cxx0x (code == OPT_std_c__0x /* ISO */); break; - case OPT_std_c89: case OPT_std_c90: - case OPT_std_iso9899_1990: case OPT_std_iso9899_199409: if (!preprocessing_asm_p) set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */); break; - case OPT_std_gnu89: case OPT_std_gnu90: if (!preprocessing_asm_p) set_std_c89 (false /* c94 */, false /* ISO */); break; case OPT_std_c99: - case OPT_std_c9x: - case OPT_std_iso9899_1999: - case OPT_std_iso9899_199x: if (!preprocessing_asm_p) set_std_c99 (true /* ISO */); break; case OPT_std_gnu99: - case OPT_std_gnu9x: if (!preprocessing_asm_p) set_std_c99 (false /* ISO */); break; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 05fedd66f027..5cba0ded57a7 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -164,7 +164,7 @@ 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++ Warning +C ObjC C++ ObjC++ Warning Alias(Wcomment) Synonym for -Wcomment Wconversion @@ -216,7 +216,7 @@ C ObjC C++ ObjC++ ; Documented in common.opt Werror-implicit-function-declaration -C ObjC RejectNegative Warning +C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration) This switch is deprecated; use -Werror=implicit-function-declaration instead Wfloat-equal @@ -804,7 +804,7 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger -ftabstop= Distance between tab stops for column reporting ftemplate-depth- -C++ ObjC++ Joined RejectNegative UInteger Undocumented +C++ ObjC++ Joined RejectNegative Undocumented Alias(ftemplate-depth=) ftemplate-depth= C++ ObjC++ Joined RejectNegative UInteger @@ -972,7 +972,7 @@ C ObjC Conform to the ISO 201X C standard draft (experimental and incomplete support) std=c89 -C ObjC +C ObjC Alias(std=c90) Conform to the ISO 1990 C standard std=c90 @@ -984,7 +984,7 @@ C ObjC Conform to the ISO 1999 C standard std=c9x -C ObjC +C ObjC Alias(std=c99) Deprecated in favor of -std=c99 std=gnu++98 @@ -1003,7 +1003,7 @@ C ObjC Conform to the ISO 201X C standard draft with GNU extensions (experimental and incomplete support) std=gnu89 -C ObjC +C ObjC Alias(std=gnu90) Conform to the ISO 1990 C standard with GNU extensions std=gnu90 @@ -1015,11 +1015,11 @@ C ObjC Conform to the ISO 1999 C standard with GNU extensions std=gnu9x -C ObjC +C ObjC Alias(std=gnu99) Deprecated in favor of -std=gnu99 std=iso9899:1990 -C ObjC +C ObjC Alias(std=c90) Conform to the ISO 1990 C standard std=iso9899:199409 @@ -1027,11 +1027,11 @@ C ObjC Conform to the ISO 1990 C standard as amended in 1994 std=iso9899:1999 -C ObjC +C ObjC Alias(std=c99) Conform to the ISO 1999 C standard std=iso9899:199x -C ObjC +C ObjC Alias(std=c99) Deprecated in favor of -std=iso9899:1999 traditional-cpp diff --git a/gcc/common.opt b/gcc/common.opt index 2147be83e64d..d30e41c86515 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -88,7 +88,7 @@ S Driver W -Common RejectNegative Var(extra_warnings) Warning +Common RejectNegative Warning Alias(Wextra) This switch is deprecated; use -Wextra instead Wa, @@ -153,7 +153,7 @@ Common Var(warn_inline) Warning Warn when an inlined function cannot be inlined Wlarger-than- -Common RejectNegative Joined UInteger Warning Undocumented +Common RejectNegative Joined Warning Undocumented Alias(Wlarger-than=) Wlarger-than= Common RejectNegative Joined UInteger Warning @@ -301,7 +301,7 @@ Common Separate -aux-info Emit declaration information into aux-info= -Common Joined +Common Joined Alias(aux-info) auxbase Common Separate RejectDriver @@ -750,7 +750,7 @@ Common Report Var(flag_inline_functions_called_once) Init(1) Optimization Integrate functions called once into their callers finline-limit- -Common RejectNegative Joined UInteger +Common RejectNegative Joined Alias(finline-limit=) finline-limit= Common RejectNegative Joined UInteger @@ -1259,7 +1259,7 @@ Common Report RejectNegative Joined -fstack-check=[no|generic|specific] Insert stack checking code into the program fstack-check -Common Report +Common Alias(fstack-check=, specific, no) Insert stack checking code into the program. Same as -fstack-check=specific fstack-limit @@ -1755,7 +1755,7 @@ shared-libgcc Driver specs -Driver Separate +Driver Separate Alias(specs=) specs= Driver Joined diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi index aac638bd1fea..46610f03ad5f 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -247,6 +247,32 @@ The main purpose of this property is to support synonymous options. The first option should use @samp{Mask(@var{name})} and the others should use @samp{Mask(@var{name}) MaskExists}. +@item Alias(@var{opt}) +@itemx Alias(@var{opt}, @var{arg}) +@itemx Alias(@var{opt}, @var{posarg}, @var{negarg}) +The option is an alias for @option{-@var{opt}}. In the first form, +any argument passed to the alias is considered to be passed to +@option{-@var{opt}}, and @option{-@var{opt}} is considered to be +negated if the alias is used in negated form. In the second form, the +alias may not be negated or have an argument, and @var{posarg} is +considered to be passed as an argument to @option{-@var{opt}}. In the +third form, the alias may not have an argument, if the alias is used +in the positive form then @var{posarg} is considered to be passed to +@option{-@var{opt}}, and if the alias is used in the negative form +then @var{negarg} is considered to be passed to @option{-@var{opt}}. + +Aliases should not specify @code{Var} or @code{Mask} or +@code{UInteger}. Aliases should normally specify the same languages +as the target of the alias; the flags on the target will be used to +determine any diagnostic for use of an option for the wrong language, +while those on the alias will be used to identify what command-line +text is the option and what text is any argument to that option. + +When an @code{Alias} definition is used for an option, driver specs do +not need to handle it and no @samp{OPT_} enumeration value is defined +for it; only the canonical form of the option will be seen in those +places. + @item Report The state of the option should be printed by @option{-fverbose-asm}. diff --git a/gcc/gcc.c b/gcc/gcc.c index ea49ec748e64..61afb74224f1 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3742,6 +3742,12 @@ driver_handle_option (const struct cl_decoded_option *decoded, do_save = false; break; + case OPT_L: + /* Similarly, canonicalize -L for linkers that may not accept + separate arguments. */ + save_switch (concat ("-L", arg, NULL), 0, NULL, validated); + return true; + case OPT_save_temps: save_temps_flag = SAVE_TEMPS_CWD; validated = true; @@ -3772,7 +3778,6 @@ driver_handle_option (const struct cl_decoded_option *decoded, processing. */ break; - case OPT_specs: case OPT_specs_: { struct user_specs *user = XNEW (struct user_specs); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index ca9a8d278575..f6022e055b37 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2010-09-02 Joseph Myers + + * lang.opt (CLASSPATH, bootclasspath, classpath, encoding, + fCLASSPATH=): Mark as Java options and as aliases. + * jvspec.c (jvgenmain_spec): Don't handle -fCLASSPATH*. + (lang_specific_driver): Don't handle options marked as aliases. + * lang.c (java_handle_option): Don't handle OPT_fCLASSPATH_. + 2010-08-22 Joseph Myers * Make-lang.in (jvspec.o): Update dependencies. diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index cb8c1469ea7b..792dda0dad5e 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -69,7 +69,7 @@ static const char jvgenmain_spec[] = %opt_text; + + if (value == 0 + && !(option->flags & CL_REJECT_NEGATIVE) + && (opt_text[1] == 'W' || opt_text[1] == 'f' || opt_text[1] == 'm')) + { + char *t = XNEWVEC (char, option->opt_len + 5); + t[0] = '-'; + t[1] = opt_text[1]; + t[2] = 'n'; + t[3] = 'o'; + t[4] = '-'; + memcpy (t + 5, opt_text + 2, option->opt_len); + opt_text = t; + } + + decoded->canonical_option[2] = NULL; + decoded->canonical_option[3] = NULL; + + if (arg) + { + if (option->flags & CL_SEPARATE) + { + decoded->canonical_option[0] = opt_text; + decoded->canonical_option[1] = arg; + decoded->canonical_option_num_elements = 2; + } + else + { + gcc_assert (option->flags & CL_JOINED); + decoded->canonical_option[0] = concat (opt_text, arg, NULL); + decoded->canonical_option[1] = NULL; + decoded->canonical_option_num_elements = 1; + } + } + else + { + decoded->canonical_option[0] = opt_text; + decoded->canonical_option[1] = NULL; + decoded->canonical_option_num_elements = 1; + } +} + /* Decode the switch beginning at ARGV for the language indicated by LANG_MASK (including CL_COMMON and CL_TARGET if applicable), into the structure *DECODED. Returns the number of switches @@ -245,13 +297,64 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, result = 1; } + if (arg == NULL && (separate_arg_flag || joined_arg_flag)) + errors |= CL_ERR_MISSING_ARG; + + /* Is this option an alias? */ + if (option->alias_target != N_OPTS) + { + size_t new_opt_index = option->alias_target; + const struct cl_option *new_option = &cl_options[new_opt_index]; + + /* The new option must not be an alias itself. */ + gcc_assert (new_option->alias_target == N_OPTS); + + if (option->neg_alias_arg) + { + gcc_assert (option->alias_arg != NULL); + gcc_assert (arg == NULL); + if (value) + arg = option->alias_arg; + else + arg = option->neg_alias_arg; + value = 1; + } + else if (option->alias_arg) + { + gcc_assert (value == 1); + gcc_assert (arg == NULL); + arg = option->alias_arg; + } + + opt_index = new_opt_index; + option = new_option; + + if (value == 0) + gcc_assert (!(option->flags & CL_REJECT_NEGATIVE)); + + /* Recompute what arguments are allowed. */ + separate_arg_flag = ((option->flags & CL_SEPARATE) + && !((option->flags & CL_NO_DRIVER_ARG) + && (lang_mask & CL_DRIVER))); + joined_arg_flag = (option->flags & CL_JOINED) != 0; + + if (!(errors & CL_ERR_MISSING_ARG)) + { + if (separate_arg_flag || joined_arg_flag) + gcc_assert (arg != NULL); + else + gcc_assert (arg == NULL); + } + + /* Recheck for disabled options. */ + if (option->flags & CL_DISABLED) + errors |= CL_ERR_DISABLED; + } + /* Check if this is a switch for a different front end. */ if (!option_ok_for_language (option, lang_mask)) errors |= CL_ERR_WRONG_LANG; - if (arg == NULL && (separate_arg_flag || joined_arg_flag)) - errors |= CL_ERR_MISSING_ARG; - /* If the switch takes an integer, convert it. */ if (arg && (option->flags & CL_UINTEGER)) { @@ -296,12 +399,17 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { if (i < result) { - decoded->canonical_option[i] = argv[i]; + if (opt_index == OPT_SPECIAL_unknown) + decoded->canonical_option[i] = argv[i]; + else + decoded->canonical_option[i] = NULL; total_len += strlen (argv[i]) + 1; } else decoded->canonical_option[i] = NULL; } + if (opt_index != OPT_SPECIAL_unknown) + generate_canonical_option (opt_index, arg, value, decoded); decoded->orig_option_with_args_text = p = XNEWVEC (char, total_len); for (i = 0; i < result; i++) { @@ -571,39 +679,26 @@ generate_option (size_t opt_index, const char *arg, int value, decoded->opt_index = opt_index; decoded->arg = arg; - decoded->canonical_option[2] = NULL; - decoded->canonical_option[3] = NULL; decoded->value = value; decoded->errors = (option_ok_for_language (option, lang_mask) ? 0 : CL_ERR_WRONG_LANG); - if (arg) + generate_canonical_option (opt_index, arg, value, decoded); + switch (decoded->canonical_option_num_elements) { - if (option->flags & CL_SEPARATE) - { - decoded->orig_option_with_args_text = concat (option->opt_text, " ", - arg, NULL); - decoded->canonical_option[0] = option->opt_text; - decoded->canonical_option[1] = arg; - decoded->canonical_option_num_elements = 2; - } - else - { - gcc_assert (option->flags & CL_JOINED); - decoded->orig_option_with_args_text = concat (option->opt_text, arg, - NULL); - decoded->canonical_option[0] = decoded->orig_option_with_args_text; - decoded->canonical_option[1] = NULL; - decoded->canonical_option_num_elements = 1; - } - } - else - { - decoded->orig_option_with_args_text = option->opt_text; - decoded->canonical_option[0] = option->opt_text; - decoded->canonical_option[1] = NULL; - decoded->canonical_option_num_elements = 1; + case 1: + decoded->orig_option_with_args_text = decoded->canonical_option[0]; + break; + + case 2: + decoded->orig_option_with_args_text + = concat (decoded->canonical_option[0], " ", + decoded->canonical_option[1], NULL); + break; + + default: + gcc_unreachable (); } } diff --git a/gcc/opts.c b/gcc/opts.c index 7425fa4c34ee..ab7b45d52441 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1598,11 +1598,6 @@ common_handle_option (const struct cl_decoded_option *decoded, break; case OPT_Wlarger_than_: - /* This form corresponds to -Wlarger-than-. - Kept for backward compatibility. - Don't use it as the first argument of warning(). */ - - case OPT_Wlarger_than_eq: larger_than_size = value; warn_larger_than = value != -1; break; @@ -1643,7 +1638,6 @@ common_handle_option (const struct cl_decoded_option *decoded, break; case OPT_aux_info: - case OPT_aux_info_: aux_info_file_name = arg; flag_gen_aux_info = 1; break; @@ -1754,7 +1748,6 @@ common_handle_option (const struct cl_decoded_option *decoded, break; case OPT_finline_limit_: - case OPT_finline_limit_eq: set_param_value ("max-inline-insns-single", value / 2); set_param_value ("max-inline-insns-auto", value / 2); break; @@ -1943,18 +1936,6 @@ common_handle_option (const struct cl_decoded_option *decoded, warning (0, "unknown stack check parameter \"%s\"", arg); break; - case OPT_fstack_check: - /* This is the same as the "specific" mode above. */ - if (value) - flag_stack_check = STACK_CHECK_BUILTIN - ? FULL_BUILTIN_STACK_CHECK - : STACK_CHECK_STATIC_BUILTIN - ? STATIC_BUILTIN_STACK_CHECK - : GENERIC_STACK_CHECK; - else - flag_stack_check = NO_STACK_CHECK; - break; - case OPT_fstack_limit: /* The real switch is -fno-stack-limit. */ if (value) @@ -2377,8 +2358,11 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, } else { + const struct cl_option *option = &cl_options[option_index]; const diagnostic_t kind = value ? DK_ERROR : DK_WARNING; + if (option->alias_target != N_OPTS) + option_index = option->alias_target; diagnostic_classify_diagnostic (global_dc, option_index, kind, UNKNOWN_LOCATION); if (kind == DK_ERROR) diff --git a/gcc/opts.h b/gcc/opts.h index b2ff86c637b2..f3e01440a08b 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -45,6 +45,9 @@ struct cl_option const char *opt_text; const char *help; const char *missing_argument_error; + const char *alias_arg; + const char *neg_alias_arg; + unsigned short alias_target; unsigned short back_chain; unsigned char opt_len; int neg_index; diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 09bb594eb2bb..7ffef4d84919 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -675,9 +675,9 @@ layout_decl (tree decl, unsigned int known_align) int size_as_int = TREE_INT_CST_LOW (size); if (compare_tree_int (size, size_as_int) == 0) - warning (OPT_Wlarger_than_eq, "size of %q+D is %d bytes", decl, size_as_int); + warning (OPT_Wlarger_than_, "size of %q+D is %d bytes", decl, size_as_int); else - warning (OPT_Wlarger_than_eq, "size of %q+D is larger than %wd bytes", + warning (OPT_Wlarger_than_, "size of %q+D is larger than %wd bytes", decl, larger_than_size); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95a0b8b05e3e..83c17e4b56f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-09-02 Joseph Myers + + * gcc.dg/cpp/warn-comments-3.c: New. Based on warn-comments-2.c + but using -Werror=comment. + * gcc.dg/cpp/warn-comments.c, gcc.dg/cpp/warn-comments-2.c: Adjust + expected error messages. + 2010-09-02 Eric Botcazou * gcc.dg/stack-usage-1.c: Adjust on i386/Darwin. diff --git a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c index 17cc9f1ce15b..492b99cb956e 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c @@ -1,7 +1,7 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=comments" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comments." } +/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comment." } // \ - // { dg-error "multi-line comment .-Werror=comments." "multi-line" { target *-*-* } 6 } + // { dg-error "multi-line comment .-Werror=comment." "multi-line" { target *-*-* } 6 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c b/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c new file mode 100644 index 000000000000..639fa10158ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=comment" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comment." } + +// \ + // { dg-error "multi-line comment .-Werror=comment." "multi-line" { target *-*-* } 6 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-comments.c b/gcc/testsuite/gcc.dg/cpp/warn-comments.c index 6f3d5a56fa73..1cdf75cf2739 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-comments.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-comments.c @@ -1,7 +1,7 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wcomments" } -/* /* */ // { dg-warning "\"\.\*\" within comment .-Wcomments." } +/* /* */ // { dg-warning "\"\.\*\" within comment .-Wcomment." } // \ - // { dg-warning "multi-line comment .-Wcomments." "multi-line" { target *-*-* } 6 } + // { dg-warning "multi-line comment .-Wcomment." "multi-line" { target *-*-* } 6 } diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 5df3fdb75cf5..ce18d6f1febf 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -477,10 +477,10 @@ tree_rest_of_compilation (tree fndecl) = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)); if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0) - warning (OPT_Wlarger_than_eq, "size of return value of %q+D is %u bytes", + warning (OPT_Wlarger_than_, "size of return value of %q+D is %u bytes", fndecl, size_as_int); else - warning (OPT_Wlarger_than_eq, "size of return value of %q+D is larger than %wd bytes", + warning (OPT_Wlarger_than_, "size of return value of %q+D is larger than %wd bytes", fndecl, larger_than_size); } }