OSDN Git Service

2007-10-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Oct 2007 00:11:25 +0000 (00:11 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Oct 2007 00:11:25 +0000 (00:11 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129393 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/builtins.c
gcc/c-typeck.c
gcc/cfgexpand.c
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/stmt.c
gcc/stor-layout.c
gcc/toplev.c
gcc/tree-cfg.c
gcc/tree-optimize.c

index 36326b9..e2bf83b 100644 (file)
@@ -1,3 +1,19 @@
+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>
 
        * config/avr/avr.c (avr_mcu_types): Add at90pwm216, at90pwm316.
 2007-10-16  Eric B. Weddington  <eweddington@cso.atmel.com>
 
        * config/avr/avr.c (avr_mcu_types): Add at90pwm216, at90pwm316.
index bafdce0..4f4cba2 100644 (file)
@@ -4873,7 +4873,7 @@ gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
       if (! gave_help)
        {
          gave_help = true;
       if (! gave_help)
        {
          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);
        }
 
index 3d80ce2..9f3d9cb 100644 (file)
@@ -3439,7 +3439,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
                           && tree_expr_nonnegative_warnv_p (op2, &ovf)))
                /* OK */;
              else
                           && tree_expr_nonnegative_warnv_p (op2, &ovf)))
                /* OK */;
              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)
   if (!TREE_SIDE_EFFECTS (expr1))
     {
       /* The left-hand operand of a comma expression is like an expression
   if (!TREE_SIDE_EFFECTS (expr1))
     {
       /* 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).  */
       if (warn_unused_value)
        {
         any side-effects, unless it was explicitly cast to (void).  */
       if (warn_unused_value)
        {
@@ -8497,7 +8497,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
                            c_common_signed_type (result_type)))
                    /* OK */;
                  else
                            c_common_signed_type (result_type)))
                    /* OK */;
                  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,
                        {
                          mask = (~(HOST_WIDE_INT) 0) << bits;
                          if ((mask & constant) != mask)
                        {
                          mask = (~(HOST_WIDE_INT) 0) << bits;
                          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,
                               < TYPE_PRECISION (result_type))
                           && (TYPE_PRECISION (TREE_TYPE (primop1))
                               < TYPE_PRECISION (result_type)))
                               < TYPE_PRECISION (result_type))
                           && (TYPE_PRECISION (TREE_TYPE (primop1))
                               < TYPE_PRECISION (result_type)))
-                   warning (0, "comparison of promoted ~unsigned with unsigned");
+                   warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
                }
            }
        }
                }
            }
        }
index e550a4c..769483b 100644 (file)
@@ -1877,9 +1877,11 @@ tree_expand_cfg (void)
   if (warn_stack_protect)
     {
       if (current_function_calls_alloca)
   if (warn_stack_protect)
     {
       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));
     }
 
index 5fd1c1b..4283a88 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        PR c++/31446
 2007-10-16  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/31446
index cfad878..392e2db 100644 (file)
@@ -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_op1)))
            {
              && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
                 != 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,
                                                (result_type)))))
            /* OK */;
          else
                                                (result_type)))))
            /* OK */;
          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
             larger than their original size, and one (and only one) is the
 
          /* Warn if two unsigned values are being compared in a size
             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,
                    {
                      mask = (~ (HOST_WIDE_INT) 0) << bits;
                      if ((mask & constant) != mask)
                    {
                      mask = (~ (HOST_WIDE_INT) 0) << bits;
                      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,
                           < TYPE_PRECISION (result_type))
                       && (TYPE_PRECISION (TREE_TYPE (primop1))
                           < TYPE_PRECISION (result_type)))
                           < TYPE_PRECISION (result_type))
                       && (TYPE_PRECISION (TREE_TYPE (primop1))
                           < TYPE_PRECISION (result_type)))
-               warning (0, "comparison of promoted ~unsigned with unsigned");
+               warning (OPT_Wsign_compare, "comparison of promoted ~unsigned with unsigned");
            }
        }
     }
            }
        }
     }
index 69cb5e0..f1be5e0 100644 (file)
@@ -1479,7 +1479,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
        return 0;
 
     warn:
        return 0;
 
     warn:
-      warning (0, "%Hvalue computed is not used", &locus);
+      warning (OPT_Wunused_value, "%Hvalue computed is not used", &locus);
       return 1;
     }
 }
       return 1;
     }
 }
index f149e68..2260917 100644 (file)
@@ -464,9 +464,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)
          int size_as_int = TREE_INT_CST_LOW (size);
 
          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);
        }
     }
index 944f199..f7f887a 100644 (file)
@@ -846,7 +846,7 @@ check_global_declaration_1 (tree decl)
       if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
        pedwarn ("%q+F used but never defined", decl);
       else
       if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
        pedwarn ("%q+F used but never defined", decl);
       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.  */
       TREE_PUBLIC (decl) = 1;
       assemble_external (decl);
       /* This symbol is effectively an "extern" declaration now.  */
       TREE_PUBLIC (decl) = 1;
       assemble_external (decl);
@@ -871,7 +871,10 @@ check_global_declaration_1 (tree decl)
       && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
       /* Otherwise, ask the language.  */
       && lang_hooks.decls.warn_unused_global (decl))
       && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
       /* Otherwise, ask the language.  */
       && 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
index 05c69b8..69780c7 100644 (file)
@@ -1422,7 +1422,7 @@ remove_useless_stmts_warn_notreached (tree stmt)
       location_t loc = EXPR_LOCATION (stmt);
       if (LOCATION_LINE (loc) > 0)
        {
       location_t loc = EXPR_LOCATION (stmt);
       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)
              location = EXPR_LOCATION (last);
              if (location == UNKNOWN_LOCATION)
                  location = cfun->function_end_locus;
              location = EXPR_LOCATION (last);
              if (location == UNKNOWN_LOCATION)
                  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
              locus = EXPR_LOCUS (last);
              if (!locus)
                locus = &cfun->function_end_locus;
 #else
              locus = EXPR_LOCUS (last);
              if (!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
              TREE_NO_WARNING (cfun->decl) = 1;
              break;
 #endif
              TREE_NO_WARNING (cfun->decl) = 1;
              break;
index e367bb7..cb30ba4 100644 (file)
@@ -427,10 +427,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)
            = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
 
          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);
          else
                      fndecl, size_as_int);
          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);
        }
     }