This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ diagnostics: Use quoting flag q (2/n)


Like all patches in this series, this is mechanical.
Changes file cp/class.c

Bootstrapped and regetested on an i686-pc-linux-gnu.

2004-10-03  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        Convert diagnostics to use quoting flag q 2/n
        * class.c (build_base_path, add_method, alter_access,
        handle_using_decl, check_bases,
        maybe_warn_about_overly_private_class, find_final_overrider,
        warn_hidden, finish_struct_anon, add_implicitly_declared_members,
        check_bitfield_decl, check_field_decls, layout_empty_base,
        build_base_field, check_methods, layout_virtual_bases,
        warn_about_ambiguous_bases, layout_class_type, finish_struct_1,
        resolve_address_of_overloaded_function, instantiate_type,
        note_name_declared_in_class): Use format flag "q" for quoting.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.679
diff -p -r1.679 class.c
*** class.c	29 Sep 2004 06:23:46 -0000	1.679
--- class.c	4 Oct 2004 00:38:41 -0000
*************** build_base_path (enum tree_code code,
*** 273,279 ****
  
    if (code == MINUS_EXPR && v_binfo)
      {
!       error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'",
  	     BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
        return error_mark_node;
      }
--- 273,279 ----
  
    if (code == MINUS_EXPR && v_binfo)
      {
!       error ("cannot convert from base %qT to derived type %qT via virtual base %qT",
  	     BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
        return error_mark_node;
      }
*************** add_method (tree type, tree method)
*** 885,892 ****
        
        if (TYPE_FOR_JAVA (type))
  	error (DECL_ARTIFICIAL (method)
! 	       ? "Java class '%T' cannot have an implicit non-trivial destructor"
! 	       : "Java class '%T' cannot have a destructor",
  	       DECL_CONTEXT (method));
      }
    else
--- 885,892 ----
        
        if (TYPE_FOR_JAVA (type))
  	error (DECL_ARTIFICIAL (method)
! 	       ? "Java class %qT cannot have an implicit non-trivial destructor"
! 	       : "Java class %qT cannot have a destructor",
  	       DECL_CONTEXT (method));
      }
    else
*************** alter_access (tree t, tree fdecl, tree a
*** 1042,1050 ****
        if (TREE_VALUE (elem) != access)
  	{
  	  if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
! 	    cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl));
  	  else
! 	    error ("conflicting access specifications for field `%E', ignored",
  		   DECL_NAME (fdecl));
  	}
        else
--- 1042,1051 ----
        if (TREE_VALUE (elem) != access)
  	{
  	  if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
! 	    cp_error_at ("conflicting access specifications for method"
!                          " %qD, ignored", TREE_TYPE (fdecl));
  	  else
! 	    error ("conflicting access specifications for field %qE, ignored",
  		   DECL_NAME (fdecl));
  	}
        else
*************** handle_using_decl (tree using_decl, tree
*** 1094,1105 ****
    
    if (constructor_name_p (name, ctype))
      {
!       cp_error_at ("`%D' names constructor", using_decl);
        return;
      }
    if (constructor_name_p (name, t))
      {
!       cp_error_at ("`%D' invalid in `%T'", using_decl, t);
        return;
      }
  
--- 1095,1106 ----
    
    if (constructor_name_p (name, ctype))
      {
!       cp_error_at ("%qD names constructor", using_decl);
        return;
      }
    if (constructor_name_p (name, t))
      {
!       cp_error_at ("%qD invalid in %qT", using_decl, t);
        return;
      }
  
*************** handle_using_decl (tree using_decl, tree
*** 1107,1113 ****
    
    if (!fdecl)
      {
!       cp_error_at ("no members matching `%D' in `%#T'", using_decl, ctype);
        return;
      }
  
--- 1108,1114 ----
    
    if (!fdecl)
      {
!       cp_error_at ("no members matching %qD in %q#T", using_decl, ctype);
        return;
      }
  
*************** handle_using_decl (tree using_decl, tree
*** 1139,1154 ****
  	   the same name already present in the current class.  */;
        else
  	{
! 	  cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
! 	  cp_error_at ("  because of local method `%#D' with same name",
  		       OVL_CURRENT (old_value));
  	  return;
  	}
      }
    else if (!DECL_ARTIFICIAL (old_value))
      {
!       cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
!       cp_error_at ("  because of local member `%#D' with same name", old_value);
        return;
      }
    
--- 1140,1155 ----
  	   the same name already present in the current class.  */;
        else
  	{
! 	  cp_error_at ("%qD invalid in %q#T", using_decl, t);
! 	  cp_error_at ("  because of local method %q#D with same name",
  		       OVL_CURRENT (old_value));
  	  return;
  	}
      }
    else if (!DECL_ARTIFICIAL (old_value))
      {
!       cp_error_at ("%qD invalid in %q#T", using_decl, t);
!       cp_error_at ("  because of local member %q#D with same name", old_value);
        return;
      }
    
*************** check_bases (tree t,
*** 1193,1200 ****
  	 dtor is handled in finish_struct_1.  */
        if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype)
  	  && TYPE_HAS_DESTRUCTOR (basetype))
! 	warning ("base class `%#T' has a non-virtual destructor",
! 		    basetype);
  
        /* If the base class doesn't have copy constructors or
  	 assignment operators that take const references, then the
--- 1194,1200 ----
  	 dtor is handled in finish_struct_1.  */
        if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype)
  	  && TYPE_HAS_DESTRUCTOR (basetype))
! 	warning ("base class %q#T has a non-virtual destructor", basetype);
  
        /* If the base class doesn't have copy constructors or
  	 assignment operators that take const references, then the
*************** check_bases (tree t,
*** 1213,1220 ****
  	{
  	  *cant_have_default_ctor_p = 1;
  	  if (! TYPE_HAS_CONSTRUCTOR (t))
!             pedwarn ("base `%T' with only non-default constructor in class without a constructor",
!                         basetype);
  	}
  
        if (BINFO_VIRTUAL_P (base_binfo))
--- 1213,1221 ----
  	{
  	  *cant_have_default_ctor_p = 1;
  	  if (! TYPE_HAS_CONSTRUCTOR (t))
!             pedwarn ("base %qT with only non-default constructor in class "
!                      "without a constructor",
!                      basetype);
  	}
  
        if (BINFO_VIRTUAL_P (base_binfo))
*************** maybe_warn_about_overly_private_class (t
*** 1519,1525 ****
  	  }
        if (!has_nonprivate_method) 
  	{
! 	  warning ("all member functions in class `%T' are private", t);
  	  return;
  	}
      }
--- 1520,1526 ----
  	  }
        if (!has_nonprivate_method) 
  	{
! 	  warning ("all member functions in class %qT are private", t);
  	  return;
  	}
      }
*************** maybe_warn_about_overly_private_class (t
*** 1530,1536 ****
    if (TYPE_HAS_DESTRUCTOR (t)
        && TREE_PRIVATE (CLASSTYPE_DESTRUCTORS (t)))
      {
!       warning ("`%#T' only defines a private destructor and has no friends",
  	       t);
        return;
      }
--- 1531,1537 ----
    if (TYPE_HAS_DESTRUCTOR (t)
        && TREE_PRIVATE (CLASSTYPE_DESTRUCTORS (t)))
      {
!       warning ("%q#T only defines a private destructor and has no friends",
  	       t);
        return;
      }
*************** maybe_warn_about_overly_private_class (t
*** 1570,1577 ****
  
        if (nonprivate_ctor == 0)
  	{
! 	  warning ("`%#T' only defines private constructors and has no friends",
! 		      t);
  	  return;
  	}
      }
--- 1571,1578 ----
  
        if (nonprivate_ctor == 0)
  	{
! 	  warning ("%q#T only defines private constructors and has no friends",
!                    t);
  	  return;
  	}
      }
*************** find_final_overrider (tree derived, tree
*** 1951,1957 ****
    /* If there was no winner, issue an error message.  */
    if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
      {
!       error ("no unique final overrider for `%D' in `%T'", fn, 
  	     BINFO_TYPE (derived));
        return error_mark_node;
      }
--- 1952,1958 ----
    /* If there was no winner, issue an error message.  */
    if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
      {
!       error ("no unique final overrider for %qD in %qT", fn, 
  	     BINFO_TYPE (derived));
        return error_mark_node;
      }
*************** warn_hidden (tree t)
*** 2405,2412 ****
        while (base_fndecls) 
  	{
  	  /* Here we know it is a hider, and no overrider exists.  */
! 	  cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
! 	  cp_warning_at ("  by `%D'", fns);
  	  base_fndecls = TREE_CHAIN (base_fndecls);
  	}
      }
--- 2406,2413 ----
        while (base_fndecls) 
  	{
  	  /* Here we know it is a hider, and no overrider exists.  */
! 	  cp_warning_at ("%qD was hidden", TREE_VALUE (base_fndecls));
! 	  cp_warning_at ("  by %qD", fns);
  	  base_fndecls = TREE_CHAIN (base_fndecls);
  	}
      }
*************** finish_struct_anon (tree t)
*** 2447,2462 ****
  
  	      if (TREE_CODE (elt) != FIELD_DECL)
  		{
! 		  cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members",
  				 elt);
  		  continue;
  		}
  
  	      if (TREE_PRIVATE (elt))
! 		cp_pedwarn_at ("private member `%#D' in anonymous union",
  			       elt);
  	      else if (TREE_PROTECTED (elt))
! 		cp_pedwarn_at ("protected member `%#D' in anonymous union",
  			       elt);
  
  	      TREE_PRIVATE (elt) = TREE_PRIVATE (field);
--- 2448,2464 ----
  
  	      if (TREE_CODE (elt) != FIELD_DECL)
  		{
! 		  cp_pedwarn_at ("%q#D invalid; an anonymous union can "
!                                  "only have non-static data members",
  				 elt);
  		  continue;
  		}
  
  	      if (TREE_PRIVATE (elt))
! 		cp_pedwarn_at ("private member %q#D in anonymous union",
  			       elt);
  	      else if (TREE_PROTECTED (elt))
! 		cp_pedwarn_at ("protected member %q#D in anonymous union",
  			       elt);
  
  	      TREE_PRIVATE (elt) = TREE_PRIVATE (field);
*************** add_implicitly_declared_members (tree t,
*** 2570,2576 ****
    else
      {
        if (warn_abi && virtual_dtor)
! 	warning ("vtable layout for class `%T' may not be ABI-compliant "
  		 "and may change in a future version of GCC due to implicit "
  		 "virtual destructor",
  		 t);
--- 2572,2578 ----
    else
      {
        if (warn_abi && virtual_dtor)
! 	warning ("vtable layout for class %qT may not be ABI-compliant "
  		 "and may change in a future version of GCC due to implicit "
  		 "virtual destructor",
  		 t);
*************** check_bitfield_decl (tree field)
*** 2628,2634 ****
    if (DECL_INITIAL (field)
        && ! INTEGRAL_TYPE_P (TREE_TYPE (field)))
      {
!       cp_error_at ("bit-field `%#D' with non-integral type", field);
        w = error_mark_node;
      }
  
--- 2630,2636 ----
    if (DECL_INITIAL (field)
        && ! INTEGRAL_TYPE_P (TREE_TYPE (field)))
      {
!       cp_error_at ("bit-field %q#D with non-integral type", field);
        w = error_mark_node;
      }
  
*************** check_bitfield_decl (tree field)
*** 2648,2671 ****
  
        if (TREE_CODE (w) != INTEGER_CST)
  	{
! 	  cp_error_at ("bit-field `%D' width not an integer constant",
  		       field);
  	  w = error_mark_node;
  	}
        else if (tree_int_cst_sgn (w) < 0)
  	{
! 	  cp_error_at ("negative width in bit-field `%D'", field);
  	  w = error_mark_node;
  	}
        else if (integer_zerop (w) && DECL_NAME (field) != 0)
  	{
! 	  cp_error_at ("zero width for bit-field `%D'", field);
  	  w = error_mark_node;
  	}
        else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
  	       && TREE_CODE (type) != ENUMERAL_TYPE
  	       && TREE_CODE (type) != BOOLEAN_TYPE)
! 	cp_warning_at ("width of `%D' exceeds its type", field);
        else if (TREE_CODE (type) == ENUMERAL_TYPE
  	       && (0 > compare_tree_int (w,
  					 min_precision (TYPE_MIN_VALUE (type),
--- 2650,2673 ----
  
        if (TREE_CODE (w) != INTEGER_CST)
  	{
! 	  cp_error_at ("bit-field %qD width not an integer constant",
  		       field);
  	  w = error_mark_node;
  	}
        else if (tree_int_cst_sgn (w) < 0)
  	{
! 	  cp_error_at ("negative width in bit-field %qD", field);
  	  w = error_mark_node;
  	}
        else if (integer_zerop (w) && DECL_NAME (field) != 0)
  	{
! 	  cp_error_at ("zero width for bit-field %qD", field);
  	  w = error_mark_node;
  	}
        else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
  	       && TREE_CODE (type) != ENUMERAL_TYPE
  	       && TREE_CODE (type) != BOOLEAN_TYPE)
! 	cp_warning_at ("width of %qD exceeds its type", field);
        else if (TREE_CODE (type) == ENUMERAL_TYPE
  	       && (0 > compare_tree_int (w,
  					 min_precision (TYPE_MIN_VALUE (type),
*************** check_bitfield_decl (tree field)
*** 2674,2680 ****
  					     min_precision
  					     (TYPE_MAX_VALUE (type),
  					      TYPE_UNSIGNED (type)))))
! 	cp_warning_at ("`%D' is too small to hold all values of `%#T'",
  		       field, type);
      }
    
--- 2676,2682 ----
  					     min_precision
  					     (TYPE_MAX_VALUE (type),
  					      TYPE_UNSIGNED (type)))))
! 	cp_warning_at ("%qD is too small to hold all values of %q#T",
  		       field, type);
      }
    
*************** check_field_decl (tree field,
*** 2736,2748 ****
        if (TREE_CODE (t) == UNION_TYPE)
  	{
  	  if (TYPE_NEEDS_CONSTRUCTING (type))
! 	    cp_error_at ("member `%#D' with constructor not allowed in union",
  			 field);
  	  if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
! 	    cp_error_at ("member `%#D' with destructor not allowed in union",
  			 field);
  	  if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
! 	    cp_error_at ("member `%#D' with copy assignment operator not allowed in union",
  			 field);
  	}
        else
--- 2738,2750 ----
        if (TREE_CODE (t) == UNION_TYPE)
  	{
  	  if (TYPE_NEEDS_CONSTRUCTING (type))
! 	    cp_error_at ("member %q#D with constructor not allowed in union",
  			 field);
  	  if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
! 	    cp_error_at ("member %q#D with destructor not allowed in union",
  			 field);
  	  if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
! 	    cp_error_at ("member %q#D with copy assignment operator not allowed in union",
  			 field);
  	}
        else
*************** check_field_decl (tree field,
*** 2769,2775 ****
        /* `build_class_init_list' does not recognize
  	 non-FIELD_DECLs.  */
        if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0)
! 	error ("multiple fields in union `%T' initialized", t);
        *any_default_members = 1;
      }
  }
--- 2771,2777 ----
        /* `build_class_init_list' does not recognize
  	 non-FIELD_DECLs.  */
        if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0)
! 	error ("multiple fields in union %qT initialized", t);
        *any_default_members = 1;
      }
  }
*************** check_field_decls (tree t, tree *access_
*** 2835,2841 ****
  	    {
  	      if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
  		cp_warning_at
! 		  ("ignoring packed attribute on unpacked non-POD field `%#D'",
  		   x);
  	      else
  		DECL_PACKED (x) = 1;
--- 2837,2843 ----
  	    {
  	      if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
  		cp_warning_at
! 		  ("ignoring packed attribute on unpacked non-POD field %q#D",
  		   x);
  	      else
  		DECL_PACKED (x) = 1;
*************** check_field_decls (tree t, tree *access_
*** 2895,2906 ****
  	     reference type, the program is ill-formed.  */
  	  if (TREE_CODE (x) == VAR_DECL)
  	    {
! 	      cp_error_at ("`%D' may not be static because it is a member of a union", x);
  	      continue;
  	    }
  	  if (TREE_CODE (type) == REFERENCE_TYPE)
  	    {
! 	      cp_error_at ("`%D' may not have reference type `%T' because it is a member of a union",
  			   x, type);
  	      continue;
  	    }
--- 2897,2908 ----
  	     reference type, the program is ill-formed.  */
  	  if (TREE_CODE (x) == VAR_DECL)
  	    {
! 	      cp_error_at ("%qD may not be static because it is a member of a union", x);
  	      continue;
  	    }
  	  if (TREE_CODE (type) == REFERENCE_TYPE)
  	    {
! 	      cp_error_at ("%qD may not have reference type `%T' because it is a member of a union",
  			   x, type);
  	      continue;
  	    }
*************** check_field_decls (tree t, tree *access_
*** 2908,2927 ****
  
        /* ``A local class cannot have static data members.'' ARM 9.4 */
        if (current_function_decl && TREE_STATIC (x))
! 	cp_error_at ("field `%D' in local class cannot be static", x);
  
        /* Perform error checking that did not get done in
  	 grokdeclarator.  */
        if (TREE_CODE (type) == FUNCTION_TYPE)
  	{
! 	  cp_error_at ("field `%D' invalidly declared function type",
! 		       x);
  	  type = build_pointer_type (type);
  	  TREE_TYPE (x) = type;
  	}
        else if (TREE_CODE (type) == METHOD_TYPE)
  	{
! 	  cp_error_at ("field `%D' invalidly declared method type", x);
  	  type = build_pointer_type (type);
  	  TREE_TYPE (x) = type;
  	}
--- 2910,2928 ----
  
        /* ``A local class cannot have static data members.'' ARM 9.4 */
        if (current_function_decl && TREE_STATIC (x))
! 	cp_error_at ("field %qD in local class cannot be static", x);
  
        /* Perform error checking that did not get done in
  	 grokdeclarator.  */
        if (TREE_CODE (type) == FUNCTION_TYPE)
  	{
! 	  cp_error_at ("field %qD invalidly declared function type", x);
  	  type = build_pointer_type (type);
  	  TREE_TYPE (x) = type;
  	}
        else if (TREE_CODE (type) == METHOD_TYPE)
  	{
! 	  cp_error_at ("field %qD invalidly declared method type", x);
  	  type = build_pointer_type (type);
  	  TREE_TYPE (x) = type;
  	}
*************** check_field_decls (tree t, tree *access_
*** 2954,2960 ****
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
  	      && extra_warnings)
!             cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
  	}
  
        type = strip_array_types (type);
--- 2955,2961 ----
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
  	      && extra_warnings)
!             cp_warning_at ("non-static reference %q#D in class without a constructor", x);
  	}
  
        type = strip_array_types (type);
*************** check_field_decls (tree t, tree *access_
*** 3002,3008 ****
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
  	      && extra_warnings)
!             cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
  	}
        /* A field that is pseudo-const makes the structure likewise.  */
        else if (CLASS_TYPE_P (type))
--- 3003,3009 ----
  
  	  if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
  	      && extra_warnings)
!             cp_warning_at ("non-static const member %q#D in class without a constructor", x);
  	}
        /* A field that is pseudo-const makes the structure likewise.  */
        else if (CLASS_TYPE_P (type))
*************** check_field_decls (tree t, tree *access_
*** 3017,3023 ****
  	 different name from the class iff the class has a
  	 user-defined constructor.  */
        if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t))
! 	cp_pedwarn_at ("field `%#D' with same name as class", x);
  
        /* We set DECL_C_BIT_FIELD in grokbitfield.
  	 If the type and width are valid, we'll also set DECL_BIT_FIELD.  */
--- 3018,3024 ----
  	 different name from the class iff the class has a
  	 user-defined constructor.  */
        if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t))
! 	cp_pedwarn_at ("field %q#D with same name as class", x);
  
        /* We set DECL_C_BIT_FIELD in grokbitfield.
  	 If the type and width are valid, we'll also set DECL_BIT_FIELD.  */
*************** check_field_decls (tree t, tree *access_
*** 3051,3066 ****
  	&& TYPE_HAS_DESTRUCTOR (t)
  	&& !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
      {
!       warning ("`%#T' has pointer data members", t);
        
        if (! TYPE_HAS_INIT_REF (t))
  	{
! 	  warning ("  but does not override `%T(const %T&)'", t, t);
  	  if (! TYPE_HAS_ASSIGN_REF (t))
! 	    warning ("  or `operator=(const %T&)'", t);
  	}
        else if (! TYPE_HAS_ASSIGN_REF (t))
! 	warning ("  but does not override `operator=(const %T&)'", t);
      }
  
  
--- 3052,3067 ----
  	&& TYPE_HAS_DESTRUCTOR (t)
  	&& !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
      {
!       warning ("%q#T has pointer data members", t);
        
        if (! TYPE_HAS_INIT_REF (t))
  	{
! 	  warning ("  but does not override %<%T(const %T&)%>", t, t);
  	  if (! TYPE_HAS_ASSIGN_REF (t))
! 	    warning ("  or %<operator=(const %T&)%>", t);
  	}
        else if (! TYPE_HAS_ASSIGN_REF (t))
! 	warning ("  but does not override %<operator=(const %T&)%>", t);
      }
  
  
*************** layout_empty_base (tree binfo, tree eoc,
*** 3493,3499 ****
  	propagate_binfo_offsets
  	  (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
        else if (warn_abi)
! 	warning ("offset of empty base `%T' may not be ABI-compliant and may"
  		 "change in a future version of GCC",
  		 BINFO_TYPE (binfo));
      }
--- 3494,3500 ----
  	propagate_binfo_offsets
  	  (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
        else if (warn_abi)
! 	warning ("offset of empty base %qT may not be ABI-compliant and may"
  		 "change in a future version of GCC",
  		 BINFO_TYPE (binfo));
      }
*************** build_base_field (record_layout_info rli
*** 3605,3611 ****
  	      if (abi_version_at_least (2))
  		CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
  	      else if (warn_abi)
! 		warning ("class `%T' will be considered nearly empty in a "
  			 "future version of GCC", t);
  	    }
  	}
--- 3606,3612 ----
  	      if (abi_version_at_least (2))
  		CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
  	      else if (warn_abi)
! 		warning ("class %qT will be considered nearly empty in a "
  			 "future version of GCC", t);
  	    }
  	}
*************** check_methods (tree t)
*** 3687,3693 ****
      {
        check_for_override (x, t);
        if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
! 	cp_error_at ("initializer specified for non-virtual method `%D'", x);
        /* The name of the field is the original field name
  	 Save this in auxiliary field for later overloading.  */
        if (DECL_VINDEX (x))
--- 3688,3694 ----
      {
        check_for_override (x, t);
        if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
! 	cp_error_at ("initializer specified for non-virtual method %qD", x);
        /* The name of the field is the original field name
  	 Save this in auxiliary field for later overloading.  */
        if (DECL_VINDEX (x))
*************** layout_virtual_bases (record_layout_info
*** 4346,4352 ****
  					 CLASSTYPE_ALIGN (basetype)),
  			       bitsize_unit_node),
  		   BINFO_OFFSET (vbase))))
! 	    warning ("offset of virtual base `%T' is not ABI-compliant and may change in a future version of GCC",
  		     basetype);
  
  	  first_vbase = false;
--- 4347,4354 ----
  					 CLASSTYPE_ALIGN (basetype)),
  			       bitsize_unit_node),
  		   BINFO_OFFSET (vbase))))
! 	    warning ("offset of virtual base %qT is not ABI-compliant and "
!                      "may change in a future version of GCC",
  		     basetype);
  
  	  first_vbase = false;
*************** warn_about_ambiguous_bases (tree t)
*** 4440,4446 ****
        basetype = BINFO_TYPE (base_binfo);
  
        if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
! 	warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
  		 basetype, t);
      }
  
--- 4442,4448 ----
        basetype = BINFO_TYPE (base_binfo);
  
        if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
! 	warning ("direct base %qT inaccessible in %qT due to ambiguity",
  		 basetype, t);
      }
  
*************** warn_about_ambiguous_bases (tree t)
*** 4452,4458 ****
  	basetype = BINFO_TYPE (binfo);
  	
  	if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
! 	  warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
  		   basetype, t);
        }
  }
--- 4454,4460 ----
  	basetype = BINFO_TYPE (binfo);
  	
  	if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
! 	  warning ("virtual base %qT inaccessible in %qT due to ambiguity",
  		   basetype, t);
        }
  }
*************** layout_class_type (tree t, tree *virtual
*** 4662,4668 ****
  		   && DECL_MODE (field) != TYPE_MODE (type))
  	    /* Versions of G++ before G++ 3.4 did not reset the
  	       DECL_MODE.  */
! 	    warning ("the offset of `%D' may not be ABI-compliant and may "
  		     "change in a future version of GCC", field);
  	}
        else
--- 4664,4670 ----
  		   && DECL_MODE (field) != TYPE_MODE (type))
  	    /* Versions of G++ before G++ 3.4 did not reset the
  	       DECL_MODE.  */
! 	    warning ("the offset of %qD may not be ABI-compliant and may "
  		     "change in a future version of GCC", field);
  	}
        else
*************** layout_class_type (tree t, tree *virtual
*** 4685,4691 ****
  	  && !integer_zerop (size_binop (TRUNC_MOD_EXPR,
  					 DECL_FIELD_BIT_OFFSET (field),
  					 bitsize_unit_node)))
! 	cp_warning_at ("offset of `%D' is not ABI-compliant and may change in a future version of GCC", 
  		       field);
  
        /* G++ used to use DECL_FIELD_OFFSET as if it were the byte
--- 4687,4694 ----
  	  && !integer_zerop (size_binop (TRUNC_MOD_EXPR,
  					 DECL_FIELD_BIT_OFFSET (field),
  					 bitsize_unit_node)))
! 	cp_warning_at ("offset of %qD is not ABI-compliant and may "
!                        "change in a future version of GCC", 
  		       field);
  
        /* G++ used to use DECL_FIELD_OFFSET as if it were the byte
*************** layout_class_type (tree t, tree *virtual
*** 4694,4700 ****
  	  && !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
  				  byte_position (field))
  	  && contains_empty_class_p (TREE_TYPE (field)))
! 	cp_warning_at ("`%D' contains empty classes which may cause base "
  		       "classes to be placed at different locations in a "
  		       "future version of GCC",
  		       field);
--- 4697,4703 ----
  	  && !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
  				  byte_position (field))
  	  && contains_empty_class_p (TREE_TYPE (field)))
! 	cp_warning_at ("%qD contains empty classes which may cause base "
  		       "classes to be placed at different locations in a "
  		       "future version of GCC",
  		       field);
*************** layout_class_type (tree t, tree *virtual
*** 4753,4759 ****
  	  TYPE_SIZE (base_t) = bitsize_zero_node;
  	  TYPE_SIZE_UNIT (base_t) = size_zero_node;
  	  if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli)))
! 	    warning ("layout of classes derived from empty class `%T' "
  		     "may change in a future version of GCC",
  		     t);
  	}
--- 4756,4762 ----
  	  TYPE_SIZE (base_t) = bitsize_zero_node;
  	  TYPE_SIZE_UNIT (base_t) = size_zero_node;
  	  if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli)))
! 	    warning ("layout of classes derived from empty class %qT "
  		     "may change in a future version of GCC",
  		     t);
  	}
*************** finish_struct_1 (tree t)
*** 4894,4900 ****
    if (COMPLETE_TYPE_P (t))
      {
        gcc_assert (IS_AGGR_TYPE (t));
!       error ("redefinition of `%#T'", t);
        popclass ();
        return;
      }
--- 4897,4903 ----
    if (COMPLETE_TYPE_P (t))
      {
        gcc_assert (IS_AGGR_TYPE (t));
!       error ("redefinition of %q#T", t);
        popclass ();
        return;
      }
*************** finish_struct_1 (tree t)
*** 5038,5044 ****
        if (!TREE_PRIVATE (dtor) ||
  	  (CLASSTYPE_FRIEND_CLASSES (t) ||
  	   DECL_FRIENDLIST (TYPE_MAIN_DECL (t))))
! 	warning ("%#T' has virtual functions but non-virtual destructor", t);
      }
  
    complete_vars (t);
--- 5041,5047 ----
        if (!TREE_PRIVATE (dtor) ||
  	  (CLASSTYPE_FRIEND_CLASSES (t) ||
  	   DECL_FRIENDLIST (TYPE_MAIN_DECL (t))))
! 	warning ("%q#T has virtual functions but non-virtual destructor", t);
      }
  
    complete_vars (t);
*************** cannot resolve overloaded function `%D' 
*** 5763,5771 ****
        /* There were *no* matches.  */
        if (flags & tf_error)
  	{
!  	  error ("no matches converting function `%D' to type `%#T'", 
! 		    DECL_NAME (OVL_FUNCTION (overload)),
! 		    target_type);
  
  	  /* print_candidates expects a chain with the functions in
               TREE_VALUE slots, so we cons one up here (we're losing anyway,
--- 5766,5774 ----
        /* There were *no* matches.  */
        if (flags & tf_error)
  	{
!  	  error ("no matches converting function %qD to type %q#T", 
!                  DECL_NAME (OVL_FUNCTION (overload)),
!                  target_type);
  
  	  /* print_candidates expects a chain with the functions in
               TREE_VALUE slots, so we cons one up here (we're losing anyway,
*************** cannot resolve overloaded function `%D' 
*** 5786,5792 ****
  	{
  	  tree match;
  
!  	  error ("converting overloaded function `%D' to type `%#T' is ambiguous", 
  		    DECL_NAME (OVL_FUNCTION (overload)),
  		    target_type);
  
--- 5789,5795 ----
  	{
  	  tree match;
  
!  	  error ("converting overloaded function %qD to type %q#T is ambiguous", 
  		    DECL_NAME (OVL_FUNCTION (overload)),
  		    target_type);
  
*************** cannot resolve overloaded function `%D' 
*** 5812,5821 ****
        if (!(flags & tf_error))
          return error_mark_node;
  
!       pedwarn ("assuming pointer to member `%D'", fn);
        if (!explained)
          {
!           pedwarn ("(a pointer to member can only be formed with `&%E')", fn);
            explained = 1;
          }
      }
--- 5815,5824 ----
        if (!(flags & tf_error))
          return error_mark_node;
  
!       pedwarn ("assuming pointer to member %qD", fn);
        if (!explained)
          {
!           pedwarn ("(a pointer to member can only be formed with %<&%E%>)", fn);
            explained = 1;
          }
      }
*************** instantiate_type (tree lhstype, tree rhs
*** 5877,5883 ****
        else
  	{
  	  if (flags & tf_error)
! 	    error ("argument of type `%T' does not match `%T'",
  		   TREE_TYPE (rhs), lhstype);
  	  return error_mark_node;
  	}
--- 5880,5886 ----
        else
  	{
  	  if (flags & tf_error)
! 	    error ("argument of type %qT does not match %qT",
  		   TREE_TYPE (rhs), lhstype);
  	  return error_mark_node;
  	}
*************** note_name_declared_in_class (tree name, 
*** 6289,6296 ****
  	 A name N used in a class S shall refer to the same declaration
  	 in its context and when re-evaluated in the completed scope of
  	 S.  */
!       error ("declaration of `%#D'", decl);
!       cp_error_at ("changes meaning of `%D' from `%+#D'", 
  		   DECL_NAME (OVL_CURRENT (decl)),
  		   (tree) n->value);
      }
--- 6292,6299 ----
  	 A name N used in a class S shall refer to the same declaration
  	 in its context and when re-evaluated in the completed scope of
  	 S.  */
!       error ("declaration of %q#D", decl);
!       cp_error_at ("changes meaning of %qD from %q+#D", 
  		   DECL_NAME (OVL_CURRENT (decl)),
  		   (tree) n->value);
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]