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]

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


"Giovanni Bajo" <giovannibajo@libero.it> writes:

| Gabriel Dos Reis wrote:
| 
| > This is assumed to finish the conversion of the C++ front-end to use
| > the newly recommended quotation marks.  
| 
| Looks like you forgot cp/cvt.c.

Fixed with this.

Bootstrapped on an i686-pc-linux-gnu.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.4467
diff -p -r1.4467 ChangeLog
*** ChangeLog	1 Nov 2004 00:07:07 -0000	1.4467
--- ChangeLog	1 Nov 2004 00:11:00 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2004-10-31  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	Convert diagnostics to use quoting flag q 8/n
+ 	* cvt.c (cp_convert_to_pointer, warn_ref_binding, 
+ 	convert_to_reference, ocp_convert, convert_to_void 
+ 	cp_convert_to_pointer): 
+ 
  2004-10-31  Mark Mitchell  <mark@codesourcery.com>
  
  	PR c++/15172
Index: cvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cvt.c,v
retrieving revision 1.170
diff -p -r1.170 cvt.c
*** cvt.c	21 Oct 2004 21:23:40 -0000	1.170
--- cvt.c	1 Nov 2004 00:11:01 -0000
*************** cp_convert_to_pointer (tree type, tree e
*** 87,94 ****
        intype = complete_type (intype);
        if (!COMPLETE_TYPE_P (intype))
  	{
! 	  error ("can't convert from incomplete type `%T' to `%T'",
! 		    intype, type);
  	  return error_mark_node;
  	}
  
--- 87,94 ----
        intype = complete_type (intype);
        if (!COMPLETE_TYPE_P (intype))
  	{
! 	  error ("can't convert from incomplete type %qT to %qT",
!                  intype, type);
  	  return error_mark_node;
  	}
  
*************** cp_convert_to_pointer (tree type, tree e
*** 96,103 ****
        if (rval)
  	{
  	  if (rval == error_mark_node)
! 	    error ("conversion of `%E' from `%T' to `%T' is ambiguous",
! 		      expr, intype, type);
  	  return rval;
  	}
      }
--- 96,103 ----
        if (rval)
  	{
  	  if (rval == error_mark_node)
! 	    error ("conversion of %qE from %qT to %qT is ambiguous",
!                    expr, intype, type);
  	  return rval;
  	}
      }
*************** cp_convert_to_pointer (tree type, tree e
*** 165,172 ****
  
        if (TYPE_PTRMEMFUNC_P (type))
  	{
! 	  error ("cannot convert `%E' from type `%T' to type `%T'",
! 		    expr, intype, type);
  	  return error_mark_node;
  	}
  
--- 165,172 ----
  
        if (TYPE_PTRMEMFUNC_P (type))
  	{
! 	  error ("cannot convert %qE from type %qT to type %qT",
!                  expr, intype, type);
  	  return error_mark_node;
  	}
  
*************** cp_convert_to_pointer (tree type, tree e
*** 194,205 ****
        if (bk == bk_via_virtual)
  	{
  	  if (force)
! 	    warning ("pointer to member cast from `%T' to `%T' is via virtual base",
! 		     intype, type);
  	  else
  	    {
! 	      error ("pointer to member cast from `%T' to `%T' is via virtual base",
! 		     intype, type);
  	      return error_mark_node;
  	    }
  	  /* This is a reinterpret cast, whose result is unspecified.
--- 194,205 ----
        if (bk == bk_via_virtual)
  	{
  	  if (force)
! 	    warning ("pointer to member cast from %qT to %qT is via"
!                      " virtual base", intype, type);
  	  else
  	    {
! 	      error ("pointer to member cast from %qT to %qT is"
!                      " via virtual base", intype, type);
  	      return error_mark_node;
  	    }
  	  /* This is a reinterpret cast, whose result is unspecified.
*************** cp_convert_to_pointer (tree type, tree e
*** 234,241 ****
  						       TREE_OPERAND (expr, 1));
  	    }
  	}
!       error ("cannot convert `%E' from type `%T' to type `%T'",
! 		expr, intype, type);
        return error_mark_node;
      }
  
--- 234,241 ----
  						       TREE_OPERAND (expr, 1));
  	    }
  	}
!       error ("cannot convert %qE from type %qT to type %qT",
!              expr, intype, type);
        return error_mark_node;
      }
  
*************** cp_convert_to_pointer (tree type, tree e
*** 260,266 ****
      }
    else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
      {
!       error ("invalid conversion from '%T' to '%T'", intype, type);
        return error_mark_node;
      }
  
--- 260,266 ----
      }
    else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
      {
!       error ("invalid conversion from %qT to %qT", intype, type);
        return error_mark_node;
      }
  
*************** cp_convert_to_pointer (tree type, tree e
*** 281,288 ****
    if (type_unknown_p (expr))
      return instantiate_type (type, expr, tf_error | tf_warning);
  
!   error ("cannot convert `%E' from type `%T' to type `%T'",
! 	    expr, intype, type);
    return error_mark_node;
  }
  
--- 281,288 ----
    if (type_unknown_p (expr))
      return instantiate_type (type, expr, tf_error | tf_warning);
  
!   error ("cannot convert %qE from type %qT to type %qT",
!          expr, intype, type);
    return error_mark_node;
  }
  
*************** warn_ref_binding (tree reftype, tree int
*** 413,425 ****
        const char *msg;
  
        if (CP_TYPE_VOLATILE_P (ttl) && decl)
! 	  msg = "initialization of volatile reference type `%#T' from rvalue of type `%T'";
        else if (CP_TYPE_VOLATILE_P (ttl))
! 	  msg = "conversion to volatile reference type `%#T' from rvalue of type `%T'";
        else if (decl)
! 	  msg = "initialization of non-const reference type `%#T' from rvalue of type `%T'";
        else
! 	  msg = "conversion to non-const reference type `%#T' from rvalue of type `%T'";
  
        pedwarn (msg, reftype, intype);
      }
--- 413,429 ----
        const char *msg;
  
        if (CP_TYPE_VOLATILE_P (ttl) && decl)
! 	  msg = "initialization of volatile reference type %q#T from"
!             " rvalue of type %qT";
        else if (CP_TYPE_VOLATILE_P (ttl))
! 	  msg = "conversion to volatile reference type %q#T "
!             " from rvalue of type %qT";
        else if (decl)
! 	  msg = "initialization of non-const reference type %q#T from"
!             " rvalue of type %qT";
        else
! 	  msg = "conversion to non-const reference type %q#T from"
!             " rvalue of type %qT";
  
        pedwarn (msg, reftype, intype);
      }
*************** convert_to_reference (tree reftype, tree
*** 492,499 ****
  	  
  	  if (! (convtype & CONV_CONST)
  		   && !at_least_as_qualified_p (ttl, ttr))
! 	    pedwarn ("conversion from `%T' to `%T' discards qualifiers",
! 			ttr, reftype);
  	}
  
        return build_up_reference (reftype, expr, flags, decl);
--- 496,503 ----
  	  
  	  if (! (convtype & CONV_CONST)
  		   && !at_least_as_qualified_p (ttl, ttr))
! 	    pedwarn ("conversion from %qT to %qT discards qualifiers",
!                      ttr, reftype);
  	}
  
        return build_up_reference (reftype, expr, flags, decl);
*************** convert_to_reference (tree reftype, tree
*** 510,516 ****
        if (TREE_CODE (intype) == POINTER_TYPE
  	  && (comptypes (TREE_TYPE (intype), type,
  			 COMPARE_BASE | COMPARE_DERIVED)))
! 	warning ("casting `%T' to `%T' does not dereference pointer",
  		 intype, reftype);
  	  
        rval = build_unary_op (ADDR_EXPR, expr, 0);
--- 514,520 ----
        if (TREE_CODE (intype) == POINTER_TYPE
  	  && (comptypes (TREE_TYPE (intype), type,
  			 COMPARE_BASE | COMPARE_DERIVED)))
! 	warning ("casting %qT to %qT does not dereference pointer",
  		 intype, reftype);
  	  
        rval = build_unary_op (ADDR_EXPR, expr, 0);
*************** convert_to_reference (tree reftype, tree
*** 537,543 ****
      }
  
    if (flags & LOOKUP_COMPLAIN)
!     error ("cannot convert type `%T' to type `%T'", intype, reftype);
  
    return error_mark_node;
  }
--- 541,547 ----
      }
  
    if (flags & LOOKUP_COMPLAIN)
!     error ("cannot convert type %qT to type %qT", intype, reftype);
  
    return error_mark_node;
  }
*************** ocp_convert (tree type, tree expr, int c
*** 661,667 ****
  	  && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
  	      || (TREE_CODE (intype) == POINTER_TYPE)))
  	{
! 	  pedwarn ("conversion from `%#T' to `%#T'", intype, type);
  
  	  if (flag_pedantic_errors)
  	    return error_mark_node;
--- 665,671 ----
  	  && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
  	      || (TREE_CODE (intype) == POINTER_TYPE)))
  	{
! 	  pedwarn ("conversion from %q#T to %q#T", intype, type);
  
  	  if (flag_pedantic_errors)
  	    return error_mark_node;
*************** ocp_convert (tree type, tree expr, int c
*** 673,679 ****
  	  if (rval)
  	    return rval;
  	  if (flags & LOOKUP_COMPLAIN)
! 	    error ("`%#T' used where a `%T' was expected", intype, type);
  	  return error_mark_node;
  	}
        if (code == BOOLEAN_TYPE)
--- 677,683 ----
  	  if (rval)
  	    return rval;
  	  if (flags & LOOKUP_COMPLAIN)
! 	    error ("%q#T used where a %qT was expected", intype, type);
  	  return error_mark_node;
  	}
        if (code == BOOLEAN_TYPE)
*************** ocp_convert (tree type, tree expr, int c
*** 693,699 ****
            if (ret_val)
              return ret_val;
            if (flags & LOOKUP_COMPLAIN)
!             error ("`%#T' used where a `%T' was expected", in_vtype, type);
            return error_mark_node;
  	}
        return fold_if_not_in_template (convert_to_vector (type, e));
--- 697,703 ----
            if (ret_val)
              return ret_val;
            if (flags & LOOKUP_COMPLAIN)
!             error ("%q#T used where a %qT was expected", in_vtype, type);
            return error_mark_node;
  	}
        return fold_if_not_in_template (convert_to_vector (type, e));
*************** ocp_convert (tree type, tree expr, int c
*** 708,714 ****
  	    return rval;
  	  else
  	    if (flags & LOOKUP_COMPLAIN)
! 	      error ("`%#T' used where a floating point value was expected",
  			TREE_TYPE (e));
  	}
        if (code == REAL_TYPE)
--- 712,718 ----
  	    return rval;
  	  else
  	    if (flags & LOOKUP_COMPLAIN)
! 	      error ("%q#T used where a floating point value was expected",
  			TREE_TYPE (e));
  	}
        if (code == REAL_TYPE)
*************** ocp_convert (tree type, tree expr, int c
*** 755,762 ****
      }
  
    if (flags & LOOKUP_COMPLAIN)
!     error ("conversion from `%T' to non-scalar type `%T' requested",
! 	      TREE_TYPE (expr), type);
    return error_mark_node;
  }
  
--- 759,766 ----
      }
  
    if (flags & LOOKUP_COMPLAIN)
!     error ("conversion from %qT to non-scalar type %qT requested",
!            TREE_TYPE (expr), type);
    return error_mark_node;
  }
  
*************** convert_to_void (tree expr, const char *
*** 843,854 ****
          int is_complete = COMPLETE_TYPE_P (complete_type (type));
          
          if (is_volatile && !is_complete)
!           warning ("object of incomplete type `%T' will not be accessed in %s",
!                       type, implicit ? implicit : "void context");
          else if (is_reference && is_volatile)
!           warning ("object of type `%T' will not be accessed in %s",
!                       TREE_TYPE (TREE_OPERAND (expr, 0)),
!                       implicit ? implicit : "void context");
          if (is_reference || !is_volatile || !is_complete)
            expr = TREE_OPERAND (expr, 0);
        
--- 847,858 ----
          int is_complete = COMPLETE_TYPE_P (complete_type (type));
          
          if (is_volatile && !is_complete)
!           warning ("object of incomplete type %qT will not be accessed in %s",
!                    type, implicit ? implicit : "void context");
          else if (is_reference && is_volatile)
!           warning ("object of type %qT will not be accessed in %s",
!                    TREE_TYPE (TREE_OPERAND (expr, 0)),
!                    implicit ? implicit : "void context");
          if (is_reference || !is_volatile || !is_complete)
            expr = TREE_OPERAND (expr, 0);
        
*************** convert_to_void (tree expr, const char *
*** 862,869 ****
          int is_complete = COMPLETE_TYPE_P (complete_type (type));
          
          if (TYPE_VOLATILE (type) && !is_complete)
!           warning ("object `%E' of incomplete type `%T' will not be accessed in %s",
!                       expr, type, implicit ? implicit : "void context");
          break;
        }
  
--- 866,873 ----
          int is_complete = COMPLETE_TYPE_P (complete_type (type));
          
          if (TYPE_VOLATILE (type) && !is_complete)
!           warning ("object %qE of incomplete type %qT will not be accessed in %s",
!                    expr, type, implicit ? implicit : "void context");
          break;
        }
  
*************** convert_to_void (tree expr, const char *
*** 884,890 ****
        }
      else if (implicit && probe == expr && is_overloaded_fn (probe))
        /* Only warn when there is no &.  */
!       warning ("%s is a reference, not call, to function `%E'",
  		  implicit, expr);
    }
    
--- 888,894 ----
        }
      else if (implicit && probe == expr && is_overloaded_fn (probe))
        /* Only warn when there is no &.  */
!       warning ("%s is a reference, not call, to function %qE",
  		  implicit, expr);
    }
    
*************** build_expr_type_conversion (int desires,
*** 1076,1085 ****
  	    {
  	      if (complain)
  		{
! 		  error ("ambiguous default type conversion from `%T'",
! 			    basetype);
! 		  error ("  candidate conversions include `%D' and `%D'",
! 			    winner, cand);
  		}
  	      return error_mark_node;
  	    }
--- 1080,1089 ----
  	    {
  	      if (complain)
  		{
! 		  error ("ambiguous default type conversion from %qT",
!                          basetype);
! 		  error ("  candidate conversions include %qD and %qD",
!                          winner, cand);
  		}
  	      return error_mark_node;
  	    }


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