builtins.c (gimplify_va_arg_expr): Use inform for help message.

2007-10-17  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	* builtins.c (gimplify_va_arg_expr): Use inform for help message.
	* toplev.c (check_global_declaration_1): Use appropriate warning
	option instead of unnamed warning.
	* stor-layout.c (layout_decl): Likewise.
	* c-typeck.c (build_conditional_expr): Likewise.
	(build_compound_expr): Fix wrong comment.
	(build_binary_op): Use appropriate warning option instead of
	unnamed warning.
	* cfgexpand.c (tree_expand_cfg): Likewise.
	* tree-optimize.c (tree_rest_of_compilation): Likewise.
	* tree-cfg.c (remove_useless_stmts_warn_notreached): Likewise.
	(execute_warn_function_return): Likewise.
	* stmt.c (warn_if_unused_value): Likewise.
cp/
	* typeck.c (build_binary_op) : Use appropriate warning option
	instead of unnamed warning.

From-SVN: r129393
parent 2e8cd6eb
2007-10-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* builtins.c (gimplify_va_arg_expr): Use inform for help message.
* toplev.c (check_global_declaration_1): Use appropriate warning
option instead of unnamed warning.
* stor-layout.c (layout_decl): Likewise.
* c-typeck.c (build_conditional_expr): Likewise.
(build_compound_expr): Fix wrong comment.
(build_binary_op): Use appropriate warning option instead of
unnamed warning.
* cfgexpand.c (tree_expand_cfg): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-cfg.c (remove_useless_stmts_warn_notreached): Likewise.
(execute_warn_function_return): Likewise.
* stmt.c (warn_if_unused_value): Likewise.
2007-10-16 Eric B. Weddington <eweddington@cso.atmel.com> 2007-10-16 Eric B. Weddington <eweddington@cso.atmel.com>
* config/avr/avr.c (avr_mcu_types): Add at90pwm216, at90pwm316. * config/avr/avr.c (avr_mcu_types): Add at90pwm216, at90pwm316.
...@@ -4873,7 +4873,7 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p) ...@@ -4873,7 +4873,7 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
if (! gave_help) if (! gave_help)
{ {
gave_help = true; gave_help = true;
warning (0, "(so you should pass %qT not %qT to %<va_arg%>)", inform ("(so you should pass %qT not %qT to %<va_arg%>)",
promoted_type, type); promoted_type, type);
} }
......
...@@ -3439,7 +3439,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2) ...@@ -3439,7 +3439,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
&& tree_expr_nonnegative_warnv_p (op2, &ovf))) && tree_expr_nonnegative_warnv_p (op2, &ovf)))
/* OK */; /* OK */;
else else
warning (0, "signed and unsigned type in conditional expression"); warning (OPT_Wsign_compare, "signed and unsigned type in conditional expression");
} }
} }
} }
...@@ -3534,7 +3534,7 @@ build_compound_expr (tree expr1, tree expr2) ...@@ -3534,7 +3534,7 @@ build_compound_expr (tree expr1, tree expr2)
if (!TREE_SIDE_EFFECTS (expr1)) if (!TREE_SIDE_EFFECTS (expr1))
{ {
/* The left-hand operand of a comma expression is like an expression /* The left-hand operand of a comma expression is like an expression
statement: with -Wextra or -Wunused, we should warn if it doesn't have statement: with -Wunused, we should warn if it doesn't have
any side-effects, unless it was explicitly cast to (void). */ any side-effects, unless it was explicitly cast to (void). */
if (warn_unused_value) if (warn_unused_value)
{ {
...@@ -8497,7 +8497,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -8497,7 +8497,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
c_common_signed_type (result_type))) c_common_signed_type (result_type)))
/* OK */; /* OK */;
else else
warning (0, "comparison between signed and unsigned"); warning (OPT_Wsign_compare, "comparison between signed and unsigned");
} }
/* Warn if two unsigned values are being compared in a size /* Warn if two unsigned values are being compared in a size
...@@ -8543,7 +8543,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -8543,7 +8543,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{ {
mask = (~(HOST_WIDE_INT) 0) << bits; mask = (~(HOST_WIDE_INT) 0) << bits;
if ((mask & constant) != mask) if ((mask & constant) != mask)
warning (0, "comparison of promoted ~unsigned with constant"); warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with constant");
} }
} }
else if (unsignedp0 && unsignedp1 else if (unsignedp0 && unsignedp1
...@@ -8551,7 +8551,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -8551,7 +8551,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
< TYPE_PRECISION (result_type)) < TYPE_PRECISION (result_type))
&& (TYPE_PRECISION (TREE_TYPE (primop1)) && (TYPE_PRECISION (TREE_TYPE (primop1))
< TYPE_PRECISION (result_type))) < TYPE_PRECISION (result_type)))
warning (0, "comparison of promoted ~unsigned with unsigned"); warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
} }
} }
} }
......
...@@ -1877,9 +1877,11 @@ tree_expand_cfg (void) ...@@ -1877,9 +1877,11 @@ tree_expand_cfg (void)
if (warn_stack_protect) if (warn_stack_protect)
{ {
if (current_function_calls_alloca) if (current_function_calls_alloca)
warning (0, "not protecting local variables: variable length buffer"); warning (OPT_Wstack_protector,
"not protecting local variables: variable length buffer");
if (has_short_buffer && !cfun->stack_protect_guard) if (has_short_buffer && !cfun->stack_protect_guard)
warning (0, "not protecting function: no buffer at least %d bytes long", warning (OPT_Wstack_protector,
"not protecting function: no buffer at least %d bytes long",
(int) PARAM_VALUE (PARAM_SSP_BUFFER_SIZE)); (int) PARAM_VALUE (PARAM_SSP_BUFFER_SIZE));
} }
......
2007-10-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* typeck.c (build_binary_op) : Use appropriate warning option
instead of unnamed warning.
2007-10-16 Paolo Carlini <pcarlini@suse.de> 2007-10-16 Paolo Carlini <pcarlini@suse.de>
PR c++/31446 PR c++/31446
......
...@@ -3746,7 +3746,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3746,7 +3746,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0)) && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1))) != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
{ {
warning (0, "comparison between types %q#T and %q#T", warning (OPT_Wsign_compare, "comparison between types %q#T and %q#T",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1)); TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
} }
...@@ -3782,7 +3782,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3782,7 +3782,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
(result_type))))) (result_type)))))
/* OK */; /* OK */;
else else
warning (0, "comparison between signed and unsigned integer expressions"); warning (OPT_Wsign_compare,
"comparison between signed and unsigned integer expressions");
/* Warn if two unsigned values are being compared in a size /* Warn if two unsigned values are being compared in a size
larger than their original size, and one (and only one) is the larger than their original size, and one (and only one) is the
...@@ -3826,7 +3827,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3826,7 +3827,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
{ {
mask = (~ (HOST_WIDE_INT) 0) << bits; mask = (~ (HOST_WIDE_INT) 0) << bits;
if ((mask & constant) != mask) if ((mask & constant) != mask)
warning (0, "comparison of promoted ~unsigned with constant"); warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with constant");
} }
} }
else if (unsignedp0 && unsignedp1 else if (unsignedp0 && unsignedp1
...@@ -3834,7 +3835,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3834,7 +3835,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
< TYPE_PRECISION (result_type)) < TYPE_PRECISION (result_type))
&& (TYPE_PRECISION (TREE_TYPE (primop1)) && (TYPE_PRECISION (TREE_TYPE (primop1))
< TYPE_PRECISION (result_type))) < TYPE_PRECISION (result_type)))
warning (0, "comparison of promoted ~unsigned with unsigned"); warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
} }
} }
} }
......
...@@ -1479,7 +1479,7 @@ warn_if_unused_value (const_tree exp, location_t locus) ...@@ -1479,7 +1479,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
return 0; return 0;
warn: warn:
warning (0, "%Hvalue computed is not used", &locus); warning (OPT_Wunused_value, "%Hvalue computed is not used", &locus);
return 1; return 1;
} }
} }
......
...@@ -464,9 +464,9 @@ layout_decl (tree decl, unsigned int known_align) ...@@ -464,9 +464,9 @@ layout_decl (tree decl, unsigned int known_align)
int size_as_int = TREE_INT_CST_LOW (size); int size_as_int = TREE_INT_CST_LOW (size);
if (compare_tree_int (size, size_as_int) == 0) if (compare_tree_int (size, size_as_int) == 0)
warning (0, "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 else
warning (0, "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); decl, larger_than_size);
} }
} }
......
...@@ -846,7 +846,7 @@ check_global_declaration_1 (tree decl) ...@@ -846,7 +846,7 @@ check_global_declaration_1 (tree decl)
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
pedwarn ("%q+F used but never defined", decl); pedwarn ("%q+F used but never defined", decl);
else else
warning (0, "%q+F declared %<static%> but never defined", decl); warning (OPT_Wunused_function, "%q+F declared %<static%> but never defined", decl);
/* This symbol is effectively an "extern" declaration now. */ /* This symbol is effectively an "extern" declaration now. */
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
assemble_external (decl); assemble_external (decl);
...@@ -871,7 +871,10 @@ check_global_declaration_1 (tree decl) ...@@ -871,7 +871,10 @@ check_global_declaration_1 (tree decl)
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)) && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
/* Otherwise, ask the language. */ /* Otherwise, ask the language. */
&& lang_hooks.decls.warn_unused_global (decl)) && lang_hooks.decls.warn_unused_global (decl))
warning (0, "%q+D defined but not used", decl); warning ((TREE_CODE (decl) == FUNCTION_DECL)
? OPT_Wunused_function
: OPT_Wunused_variable,
"%q+D defined but not used", decl);
} }
/* Issue appropriate warnings for the global declarations in VEC (of /* Issue appropriate warnings for the global declarations in VEC (of
......
...@@ -1422,7 +1422,7 @@ remove_useless_stmts_warn_notreached (tree stmt) ...@@ -1422,7 +1422,7 @@ remove_useless_stmts_warn_notreached (tree stmt)
location_t loc = EXPR_LOCATION (stmt); location_t loc = EXPR_LOCATION (stmt);
if (LOCATION_LINE (loc) > 0) if (LOCATION_LINE (loc) > 0)
{ {
warning (0, "%Hwill never be executed", &loc); warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc);
return true; return true;
} }
} }
...@@ -6957,12 +6957,12 @@ execute_warn_function_return (void) ...@@ -6957,12 +6957,12 @@ execute_warn_function_return (void)
location = EXPR_LOCATION (last); location = EXPR_LOCATION (last);
if (location == UNKNOWN_LOCATION) if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus; location = cfun->function_end_locus;
warning (0, "%Hcontrol reaches end of non-void function", &location); warning (OPT_Wreturn_type, "%Hcontrol reaches end of non-void function", &location);
#else #else
locus = EXPR_LOCUS (last); locus = EXPR_LOCUS (last);
if (!locus) if (!locus)
locus = &cfun->function_end_locus; locus = &cfun->function_end_locus;
warning (0, "%Hcontrol reaches end of non-void function", locus); warning (OPT_Wreturn_type, "%Hcontrol reaches end of non-void function", locus);
#endif #endif
TREE_NO_WARNING (cfun->decl) = 1; TREE_NO_WARNING (cfun->decl) = 1;
break; break;
......
...@@ -427,10 +427,10 @@ tree_rest_of_compilation (tree fndecl) ...@@ -427,10 +427,10 @@ tree_rest_of_compilation (tree fndecl)
= TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)); = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0) if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
warning (0, "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); fndecl, size_as_int);
else else
warning (0, "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); fndecl, larger_than_size);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment