]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cp/init.c
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
[thirdparty/gcc.git] / gcc / cp / init.c
index 26089965d0c6ab27ed496c3c66946319d93549af..96dd6c1dfadcd28f8357b823fbd10f2db6a51871 100644 (file)
@@ -426,8 +426,9 @@ perform_member_init (tree member, tree init)
   /* Effective C++ rule 12 requires that all data members be
      initialized.  */
   if (warn_ecpp && init == NULL_TREE && TREE_CODE (type) != ARRAY_TYPE)
-    warning (OPT_Weffc__, "%J%qD should be initialized in the member initialization "
-            "list", current_function_decl, member);
+    warning_at (DECL_SOURCE_LOCATION (current_function_decl), OPT_Weffc__,
+               "%qD should be initialized in the member initialization list",
+               member);
 
   /* Get an lvalue for the data member.  */
   decl = build_class_member_access_expr (current_class_ref, member,
@@ -451,9 +452,9 @@ perform_member_init (tree member, tree init)
       else
        {
          if (TREE_CODE (type) == REFERENCE_TYPE)
-           permerror (input_location, "%Jvalue-initialization of %q#D, "
-                                      "which has reference type",
-                      current_function_decl, member);
+           permerror (DECL_SOURCE_LOCATION (current_function_decl),
+                      "value-initialization of %q#D, which has reference type",
+                      member);
          else
            {
              init = build2 (INIT_EXPR, type, decl, build_value_init (type));
@@ -492,8 +493,9 @@ perform_member_init (tree member, tree init)
              && !type_has_user_provided_default_constructor (type))
            /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a
               vtable; still give this diagnostic.  */
-           permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
-                      current_function_decl, member, type);
+           permerror (DECL_SOURCE_LOCATION (current_function_decl),
+                      "uninitialized member %qD with %<const%> type %qT",
+                      member, type);
          finish_expr_stmt (build_aggr_init (decl, init, 0, 
                                             tf_warning_or_error));
        }
@@ -504,11 +506,13 @@ perform_member_init (tree member, tree init)
        {
          /* member traversal: note it leaves init NULL */
          if (TREE_CODE (type) == REFERENCE_TYPE)
-           permerror (input_location, "%Juninitialized reference member %qD",
-                      current_function_decl, member);
+           permerror (DECL_SOURCE_LOCATION (current_function_decl),
+                      "uninitialized reference member %qD",
+                      member);
          else if (CP_TYPE_CONST_P (type))
-           permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
-                      current_function_decl, member, type);
+           permerror (DECL_SOURCE_LOCATION (current_function_decl),
+                      "uninitialized member %qD with %<const%> type %qT",
+                      member, type);
        }
       else if (TREE_CODE (init) == TREE_LIST)
        /* There was an explicit member initialization.  Do some work
@@ -661,7 +665,8 @@ sort_mem_initializers (tree t, tree mem_inits)
            warning (OPT_Wreorder, "  %q+#D", subobject);
          else
            warning (OPT_Wreorder, "  base %qT", subobject);
-         warning (OPT_Wreorder, "%J  when initialized here", current_function_decl);
+         warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+                     OPT_Wreorder, "  when initialized here");
        }
 
       /* Look again, from the beginning of the list.  */
@@ -677,11 +682,13 @@ sort_mem_initializers (tree t, tree mem_inits)
       if (TREE_VALUE (subobject_init))
        {
          if (TREE_CODE (subobject) == FIELD_DECL)
-           error ("%Jmultiple initializations given for %qD",
-                  current_function_decl, subobject);
+           error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                     "multiple initializations given for %qD",
+                     subobject);
          else
-           error ("%Jmultiple initializations given for base %qT",
-                  current_function_decl, subobject);
+           error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                     "multiple initializations given for base %qT",
+                     subobject);
        }
 
       /* Record the initialization.  */
@@ -747,8 +754,9 @@ sort_mem_initializers (tree t, tree mem_inits)
                  if (same_type_p (last_field_type, field_type))
                    {
                      if (TREE_CODE (field_type) == UNION_TYPE)
-                       error ("%Jinitializations for multiple members of %qT",
-                              current_function_decl, last_field_type);
+                       error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                                 "initializations for multiple members of %qT",
+                                 last_field_type);
                      done = 1;
                      break;
                    }
@@ -810,9 +818,10 @@ emit_mem_initializers (tree mem_inits)
       if (extra_warnings && !arguments
          && DECL_COPY_CONSTRUCTOR_P (current_function_decl)
          && type_has_user_nondefault_constructor (BINFO_TYPE (subobject)))
-       warning (OPT_Wextra, "%Jbase class %q#T should be explicitly initialized in the "
-                "copy constructor",
-                current_function_decl, BINFO_TYPE (subobject));
+       warning_at (DECL_SOURCE_LOCATION (current_function_decl), OPT_Wextra,
+                   "base class %q#T should be explicitly initialized in the "
+                   "copy constructor",
+                   BINFO_TYPE (subobject));
 
       /* Initialize the base.  */
       if (BINFO_VIRTUAL_P (subobject))