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]

Re: [C++ PATCH]: warning on implicit float->int


Jason Merrill wrote:
> This checking does not belong in build_over_call, it belongs in
> convert_like.  Actually, we should be doing all of the checking from
> convert_for_assignment in convert_like.
You are correct. Here's an adjusted patch which does it in convert_like. This adds
FN and ARGNO parameters to convert_like, so that it can report the context
of any problems. It also needs to know whether it is being recursively called
to deal with a chain of conversions. Without that it cannot tell the difference
between converting __null to int or int *. The former is an IDENTITY_CONV, and
the latter is an IDENTITY_CONV followed by a, err, pointer conversion. The
former should be warned about (NULL to non-pointer context), but the latter
not.

This passing of the context for diagnostics is awkward, and IMO the wrong
thing. In convert_for_initialization we need the same thing, and we
have the hack of saving the error count, calling the functions and then
seeing if we issued any errors, and if so emit some context. Ug!
I think the right thing is to implement a little context stack for diagnostics
which we can push closures onto. Then when emitting a diagnostic we simply
invoke the top closure to generate the context information. No need to keep
passing the stuff around or saving error counts. Does that sound good?

> I'm not sure I agree.  I haven't seen any complaints about this particular
> warning.
Ok.

Is this one ok? comments about the context stack idea?
nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-03-03  Nathan Sidwell  <nathan@codesourcery.com>

	* call.c (convert_like): Add calling context parameters, for
	diagnostics. Call dubious_conversion_warnings for outer
	conversion.
	(build_user_type_conversion): Adjust convert_like calls.
	(build_object_call): Likewise.
	(build_conditional_expr): Likewise.
	(build_new_op): Likewise.
	(perform_implicit_conversion): Likewise.
	(initialize_reference): Likewise.
	(build_over_call): Likewise. Don't warn about dubious
	conversions here.
	(convert_default_arg): Add context parameters for diagnostics.
	Pass throught to convert_like.
	* cp-tree.h (convert_default_arg): Add context parameters.
	(dubious_conversion_warnings): Prototype new function.
	* typeck.c (convert_arguments): Adjust convert_default_arg call.
	(dubious_conversion_warnings): New function, broken
	out of convert_for_assignment. 
	(convert_for_assignment): Adjust.

Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.198
diff -c -3 -p -r1.198 call.c
*** call.c	2000/02/27 06:54:03	1.198
--- call.c	2000/03/02 15:12:21
*************** static int equal_functions PARAMS ((tree
*** 49,55 ****
  static int joust PARAMS ((struct z_candidate *, struct z_candidate *, int));
  static int compare_ics PARAMS ((tree, tree));
  static tree build_over_call PARAMS ((struct z_candidate *, tree, int));
! static tree convert_like PARAMS ((tree, tree));
  static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
  			    tree, const char *));
  static tree build_object_call PARAMS ((tree, tree));
--- 49,55 ----
  static int joust PARAMS ((struct z_candidate *, struct z_candidate *, int));
  static int compare_ics PARAMS ((tree, tree));
  static tree build_over_call PARAMS ((struct z_candidate *, tree, int));
! static tree convert_like PARAMS ((tree, tree, tree, int, int));
  static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
  			    tree, const char *));
  static tree build_object_call PARAMS ((tree, tree));
*************** build_user_type_conversion (totype, expr
*** 2450,2456 ****
      {
        if (TREE_CODE (cand->second_conv) == AMBIG_CONV)
  	return error_mark_node;
!       return convert_from_reference (convert_like (cand->second_conv, expr));
      }
    return NULL_TREE;
  }
--- 2450,2458 ----
      {
        if (TREE_CODE (cand->second_conv) == AMBIG_CONV)
  	return error_mark_node;
!       return convert_from_reference
!               (convert_like
!                 (cand->second_conv, expr, cand->fn, 0, 0));
      }
    return NULL_TREE;
  }
*************** build_object_call (obj, args)
*** 2654,2660 ****
        && DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR])
      return build_over_call (cand, mem_args, LOOKUP_NORMAL);
  
!   obj = convert_like (TREE_VEC_ELT (cand->convs, 0), obj);
  
    /* FIXME */
    return build_function_call (obj, args);
--- 2656,2662 ----
        && DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR])
      return build_over_call (cand, mem_args, LOOKUP_NORMAL);
  
!   obj = convert_like (TREE_VEC_ELT (cand->convs, 0), obj, cand->fn, -1, 0);
  
    /* FIXME */
    return build_function_call (obj, args);
*************** build_conditional_expr (arg1, arg2, arg3
*** 2891,2897 ****
  	}
        else if (conv2 && !ICS_BAD_FLAG (conv2))
  	{
! 	  arg2 = convert_like (conv2, arg2);
  	  arg2 = convert_from_reference (arg2);
  	  /* That may not quite have done the trick.  If the two types
  	     are cv-qualified variants of one another, we will have
--- 2893,2899 ----
  	}
        else if (conv2 && !ICS_BAD_FLAG (conv2))
  	{
! 	  arg2 = convert_like (conv2, arg2, NULL_TREE, 2, 0);
  	  arg2 = convert_from_reference (arg2);
  	  /* That may not quite have done the trick.  If the two types
  	     are cv-qualified variants of one another, we will have
*************** build_conditional_expr (arg1, arg2, arg3
*** 2906,2912 ****
  	}
        else if (conv3 && !ICS_BAD_FLAG (conv3))
  	{
! 	  arg3 = convert_like (conv3, arg3);
  	  arg3 = convert_from_reference (arg3);
  	  if (!same_type_p (TREE_TYPE (arg3), arg2_type))
  	    arg3 = build1 (NOP_EXPR, arg2_type, arg3);
--- 2908,2914 ----
  	}
        else if (conv3 && !ICS_BAD_FLAG (conv3))
  	{
! 	  arg3 = convert_like (conv3, arg3, NULL_TREE, 3, 0);
  	  arg3 = convert_from_reference (arg3);
  	  if (!same_type_p (TREE_TYPE (arg3), arg2_type))
  	    arg3 = build1 (NOP_EXPR, arg2_type, arg3);
*************** build_conditional_expr (arg1, arg2, arg3
*** 2977,2987 ****
  	 the converted operands are used in place of the original
  	 operands for the remainder of this section.  */
        conv = TREE_VEC_ELT (cand->convs, 0);
!       arg1 = convert_like (conv, arg1);
        conv = TREE_VEC_ELT (cand->convs, 1);
!       arg2 = convert_like (conv, arg2);
        conv = TREE_VEC_ELT (cand->convs, 2);
!       arg3 = convert_like (conv, arg3);
      }
  
    /* [expr.cond]
--- 2979,2989 ----
  	 the converted operands are used in place of the original
  	 operands for the remainder of this section.  */
        conv = TREE_VEC_ELT (cand->convs, 0);
!       arg1 = convert_like (conv, arg1, NULL_TREE, 1, 0);
        conv = TREE_VEC_ELT (cand->convs, 1);
!       arg2 = convert_like (conv, arg2, NULL_TREE, 2, 0);
        conv = TREE_VEC_ELT (cand->convs, 2);
!       arg3 = convert_like (conv, arg3, NULL_TREE, 3, 0);
      }
  
    /* [expr.cond]
*************** build_new_op (code, flags, arg1, arg2, a
*** 3371,3390 ****
    conv = TREE_VEC_ELT (cand->convs, 0);
    if (TREE_CODE (conv) == REF_BIND)
      conv = TREE_OPERAND (conv, 0);
!   arg1 = convert_like (conv, arg1);
    if (arg2)
      {
        conv = TREE_VEC_ELT (cand->convs, 1);
        if (TREE_CODE (conv) == REF_BIND)
          conv = TREE_OPERAND (conv, 0);
!       arg2 = convert_like (conv, arg2);
      }
    if (arg3)
      {
        conv = TREE_VEC_ELT (cand->convs, 2);
        if (TREE_CODE (conv) == REF_BIND)
          conv = TREE_OPERAND (conv, 0);
!       arg3 = convert_like (conv, arg3);
      }
  
  builtin:
--- 3373,3392 ----
    conv = TREE_VEC_ELT (cand->convs, 0);
    if (TREE_CODE (conv) == REF_BIND)
      conv = TREE_OPERAND (conv, 0);
!   arg1 = convert_like (conv, arg1, NULL_TREE, 1, 0);
    if (arg2)
      {
        conv = TREE_VEC_ELT (cand->convs, 1);
        if (TREE_CODE (conv) == REF_BIND)
          conv = TREE_OPERAND (conv, 0);
!       arg2 = convert_like (conv, arg2, NULL_TREE, 2, 0);
      }
    if (arg3)
      {
        conv = TREE_VEC_ELT (cand->convs, 2);
        if (TREE_CODE (conv) == REF_BIND)
          conv = TREE_OPERAND (conv, 0);
!       arg3 = convert_like (conv, arg3, NULL_TREE, 3, 0);
      }
  
  builtin:
*************** enforce_access (basetype_path, decl)
*** 3618,3628 ****
    return 1;
  }
  
! /* Perform the conversions in CONVS on the expression EXPR.  */
  
  static tree
! convert_like (convs, expr)
       tree convs, expr;
  {
    if (ICS_BAD_FLAG (convs)
        && TREE_CODE (convs) != USER_CONV
--- 3620,3635 ----
    return 1;
  }
  
! /* Perform the conversions in CONVS on the expression EXPR. 
!    FN and ARGNUM are used for diagnostics.  INNER is non-zero when
!    being called to continue a conversion chain. */
  
  static tree
! convert_like (convs, expr, fn, argnum, inner)
       tree convs, expr;
+      tree fn;
+      int argnum;
+      int inner;
  {
    if (ICS_BAD_FLAG (convs)
        && TREE_CODE (convs) != USER_CONV
*************** convert_like (convs, expr)
*** 3634,3652 ****
  	{
  	  if (TREE_CODE (t) == USER_CONV)
  	    {
! 	      expr = convert_like (t, expr);
  	      break;
  	    }
  	  else if (TREE_CODE (t) == AMBIG_CONV)
! 	    return convert_like (t, expr);
  	  else if (TREE_CODE (t) == IDENTITY_CONV)
  	    break;
  	}
        return convert_for_initialization
  	(NULL_TREE, TREE_TYPE (convs), expr, LOOKUP_NORMAL,
! 	 "conversion", NULL_TREE, 0);
      }
! 
    switch (TREE_CODE (convs))
      {
      case USER_CONV:
--- 3641,3662 ----
  	{
  	  if (TREE_CODE (t) == USER_CONV)
  	    {
! 	      expr = convert_like (t, expr, fn, argnum, 1);
  	      break;
  	    }
  	  else if (TREE_CODE (t) == AMBIG_CONV)
! 	    return convert_like (t, expr, fn, argnum, 1);
  	  else if (TREE_CODE (t) == IDENTITY_CONV)
  	    break;
  	}
        return convert_for_initialization
  	(NULL_TREE, TREE_TYPE (convs), expr, LOOKUP_NORMAL,
! 	 "conversion", fn, argnum);
      }
!   
!   if (!inner)
!     expr = dubious_conversion_warnings
!              (TREE_TYPE (convs), expr, "argument", fn, argnum);
    switch (TREE_CODE (convs))
      {
      case USER_CONV:
*************** convert_like (convs, expr)
*** 3690,3696 ****
        break;
      };
  
!   expr = convert_like (TREE_OPERAND (convs, 0), expr);
    if (expr == error_mark_node)
      return error_mark_node;
  
--- 3700,3706 ----
        break;
      };
  
!   expr = convert_like (TREE_OPERAND (convs, 0), expr, fn, argnum, 1);
    if (expr == error_mark_node)
      return error_mark_node;
  
*************** convert_type_from_ellipsis (type)
*** 3865,3874 ****
     conversions.  Return the converted value.  */
  
  tree
! convert_default_arg (type, arg, fn)
       tree type;
       tree arg;
       tree fn;
  {
    if (fn && DECL_TEMPLATE_INFO (fn))
      arg = tsubst_default_argument (fn, type, arg);
--- 3875,3885 ----
     conversions.  Return the converted value.  */
  
  tree
! convert_default_arg (type, arg, fn, parmnum)
       tree type;
       tree arg;
       tree fn;
+      int parmnum;
  {
    if (fn && DECL_TEMPLATE_INFO (fn))
      arg = tsubst_default_argument (fn, type, arg);
*************** convert_default_arg (type, arg, fn)
*** 3879,3885 ****
      {
        arg = digest_init (type, arg, 0);
        arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
! 					"default argument", 0, 0);
      }
    else
      {
--- 3890,3896 ----
      {
        arg = digest_init (type, arg, 0);
        arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
! 					"default argument", fn, parmnum);
      }
    else
      {
*************** convert_default_arg (type, arg, fn)
*** 3888,3894 ****
  	arg = copy_node (arg);
  
        arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
! 					"default argument", 0, 0);
        if (PROMOTE_PROTOTYPES
  	  && (TREE_CODE (type) == INTEGER_TYPE
  	      || TREE_CODE (type) == ENUMERAL_TYPE)
--- 3899,3905 ----
  	arg = copy_node (arg);
  
        arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
! 					"default argument", fn, parmnum);
        if (PROMOTE_PROTOTYPES
  	  && (TREE_CODE (type) == INTEGER_TYPE
  	      || TREE_CODE (type) == ENUMERAL_TYPE)
*************** build_over_call (cand, args, flags)
*** 3981,3987 ****
  	      if (TREE_CODE (t) == USER_CONV
  		  || TREE_CODE (t) == AMBIG_CONV)
  		{
! 		  val = convert_like (t, val);
  		  break;
  		}
  	      else if (TREE_CODE (t) == IDENTITY_CONV)
--- 3992,3998 ----
  	      if (TREE_CODE (t) == USER_CONV
  		  || TREE_CODE (t) == AMBIG_CONV)
  		{
! 		  val = convert_like (t, val, fn, i - is_method, 0);
  		  break;
  		}
  	      else if (TREE_CODE (t) == IDENTITY_CONV)
*************** build_over_call (cand, args, flags)
*** 3989,4004 ****
  	    }
  	  val = convert_for_initialization
  	    (NULL_TREE, type, val, LOOKUP_NORMAL,
! 	     "argument passing", fn, i - is_method);
  	}
        else
  	{
! 	  /* Issue warnings about peculiar, but legal, uses of NULL.  */
! 	  if (ARITHMETIC_TYPE_P (TREE_VALUE (parm))
! 	      && TREE_VALUE (arg) == null_node)
! 	    cp_warning ("converting NULL to non-pointer type");
! 	    
! 	  val = convert_like (conv, TREE_VALUE (arg));
  	}
  
        if (PROMOTE_PROTOTYPES
--- 4000,4011 ----
  	    }
  	  val = convert_for_initialization
  	    (NULL_TREE, type, val, LOOKUP_NORMAL,
! 	     "argument", fn, i - is_method);
  	}
        else
  	{
! 	  val = TREE_VALUE (arg);
! 	  val = convert_like (conv, TREE_VALUE (arg), fn, i - is_method, 0);
  	}
  
        if (PROMOTE_PROTOTYPES
*************** build_over_call (cand, args, flags)
*** 4010,4021 ****
      }
  
    /* Default arguments */
!   for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm))
      converted_args 
        = tree_cons (NULL_TREE, 
  		   convert_default_arg (TREE_VALUE (parm), 
  					TREE_PURPOSE (parm),
! 					fn),
  		   converted_args);
  
    /* Ellipsis */
--- 4017,4028 ----
      }
  
    /* Default arguments */
!   for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm), i++)
      converted_args 
        = tree_cons (NULL_TREE, 
  		   convert_default_arg (TREE_VALUE (parm), 
  					TREE_PURPOSE (parm),
! 					fn, i - is_method),
  		   converted_args);
  
    /* Ellipsis */
*************** perform_implicit_conversion (type, expr)
*** 5178,5184 ****
        return error_mark_node;
      }
  
!   return convert_like (conv, expr);
  }
  
  /* Convert EXPR to the indicated reference TYPE, in a way suitable for
--- 5185,5191 ----
        return error_mark_node;
      }
  
!   return convert_like (conv, expr, NULL_TREE, 0, 0);
  }
  
  /* Convert EXPR to the indicated reference TYPE, in a way suitable for
*************** initialize_reference (type, expr)
*** 5199,5203 ****
        return error_mark_node;
      }
  
!   return convert_like (conv, expr);
  }
--- 5206,5210 ----
        return error_mark_node;
      }
  
!   return convert_like (conv, expr, NULL_TREE, 0, 0);
  }
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.410
diff -c -3 -p -r1.410 cp-tree.h
*** cp-tree.h	2000/02/29 02:34:48	1.410
--- cp-tree.h	2000/03/02 15:12:26
*************** extern tree build_op_delete_call		PARAMS
*** 3583,3589 ****
  extern int can_convert				PARAMS ((tree, tree));
  extern int can_convert_arg			PARAMS ((tree, tree, tree));
  extern int enforce_access                       PARAMS ((tree, tree));
! extern tree convert_default_arg                 PARAMS ((tree, tree, tree));
  extern tree convert_arg_to_ellipsis             PARAMS ((tree));
  extern tree build_x_va_arg                      PARAMS ((tree, tree));
  extern tree convert_type_from_ellipsis          PARAMS ((tree));
--- 3583,3589 ----
  extern int can_convert				PARAMS ((tree, tree));
  extern int can_convert_arg			PARAMS ((tree, tree, tree));
  extern int enforce_access                       PARAMS ((tree, tree));
! extern tree convert_default_arg                 PARAMS ((tree, tree, tree, int));
  extern tree convert_arg_to_ellipsis             PARAMS ((tree));
  extern tree build_x_va_arg                      PARAMS ((tree, tree));
  extern tree convert_type_from_ellipsis          PARAMS ((tree));
*************** extern tree build_const_cast			PARAMS ((
*** 4374,4379 ****
--- 4374,4380 ----
  extern tree build_c_cast			PARAMS ((tree, tree));
  extern tree build_x_modify_expr			PARAMS ((tree, enum tree_code, tree));
  extern tree build_modify_expr			PARAMS ((tree, enum tree_code, tree));
+ extern tree dubious_conversion_warnings         PARAMS ((tree, tree, const char *, tree, int));
  extern tree convert_for_initialization		PARAMS ((tree, tree, tree, int, const char *, tree, int));
  extern void c_expand_asm_operands		PARAMS ((tree, tree, tree, tree, int, char *, int));
  extern void c_expand_return			PARAMS ((tree));
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck.c,v
retrieving revision 1.254
diff -c -3 -p -r1.254 typeck.c
*** typeck.c	2000/03/01 21:41:15	1.254
--- typeck.c	2000/03/02 15:12:38
*************** convert_arguments (typelist, values, fnd
*** 3217,3223 ****
  	      tree parmval 
  		= convert_default_arg (TREE_VALUE (typetail), 
  				       TREE_PURPOSE (typetail), 
! 				       fndecl);
  
  	      if (parmval == error_mark_node)
  		return error_mark_node;
--- 3217,3223 ----
  	      tree parmval 
  		= convert_default_arg (TREE_VALUE (typetail), 
  				       TREE_PURPOSE (typetail), 
! 				       fndecl, i);
  
  	      if (parmval == error_mark_node)
  		return error_mark_node;
*************** pfn_from_ptrmemfunc (t)
*** 6423,6428 ****
--- 6423,6481 ----
  	     pfn_identifier, NULL_TREE, 0)); 
  }
  
+ /* Expression EXPR is about to be implicitly converted to TYPE.  Warn
+    if this is a potentially dangerous thing to do.  Returns a possibly
+    marked EXPR.  */
+ 
+ tree
+ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
+      tree type;
+      tree expr;
+      const char *errtype;
+      tree fndecl;
+      int parmnum;
+ {
+   /* Issue warnings about peculiar, but legal, uses of NULL.  */
+   if (ARITHMETIC_TYPE_P (type) && expr == null_node)
+     {
+       if (fndecl)
+         cp_warning ("passing NULL used for non-pointer %s %P of `%D'",
+                     errtype, parmnum, fndecl);
+       else
+         cp_warning ("%s to non-pointer type `%T' from NULL", errtype, type);
+     }
+   
+   /* Warn about assigning a floating-point type to an integer type.  */
+   if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+       && TREE_CODE (type) == INTEGER_TYPE)
+     {
+       if (fndecl)
+ 	cp_warning ("passing `%T' for %s %P of `%D'",
+ 		    TREE_TYPE (expr), errtype, parmnum, fndecl);
+       else
+ 	cp_warning ("%s to `%T' from `%T'", errtype, type, TREE_TYPE (expr));
+     }
+   /* And warn about assigning a negative value to an unsigned
+      variable.  */
+   else if (TREE_UNSIGNED (type) && TREE_CODE (type) != BOOLEAN_TYPE)
+     {
+       if (TREE_CODE (expr) == INTEGER_CST
+ 	  && TREE_NEGATED_INT (expr))
+ 	{
+ 	  if (fndecl)
+ 	    cp_warning ("passing negative value `%E' for %s %P of `%D'",
+ 			expr, errtype, parmnum, fndecl);
+ 	  else
+ 	    cp_warning ("%s of negative value `%E' to `%T'",
+ 			errtype, expr, type);
+ 	}
+       overflow_warning (expr);
+       if (TREE_CONSTANT (expr))
+ 	expr = fold (expr);
+     }
+   return expr;
+ }
+ 
  /* Convert value RHS to type TYPE as preparation for an assignment to
     an lvalue of type TYPE.  ERRTYPE is a string to use in error
     messages: "assignment", "return", etc.  If FNDECL is non-NULL, we
*************** convert_for_assignment (type, rhs, errty
*** 6458,6469 ****
    if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
      return error_mark_node;
  
!   /* Issue warnings about peculiar, but legal, uses of NULL.  We
!      do this *before* the call to decl_constant_value so as to
!      avoid duplicate warnings on code like `const int I = NULL;
!      f(I);'.  */
!   if (ARITHMETIC_TYPE_P (type) && rhs == null_node)
!     cp_warning ("converting NULL to non-pointer type");
  
    /* The RHS of an assignment cannot have void type.  */
    if (coder == VOID_TYPE)
--- 6511,6517 ----
    if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
      return error_mark_node;
  
!   rhs = dubious_conversion_warnings (type, rhs, errtype, fndecl, parmnum);
  
    /* The RHS of an assignment cannot have void type.  */
    if (coder == VOID_TYPE)
*************** convert_for_assignment (type, rhs, errty
*** 6477,6510 ****
      rhs = DECL_INITIAL (rhs);
    else if (TREE_READONLY_DECL_P (rhs))
      rhs = decl_constant_value (rhs);
- 
-   /* Warn about assigning a floating-point type to an integer type.  */
-   if (coder == REAL_TYPE && codel == INTEGER_TYPE)
-     {
-       if (fndecl)
- 	cp_warning ("`%T' used for argument %P of `%D'",
- 		    rhstype, parmnum, fndecl);
-       else
- 	cp_warning ("%s to `%T' from `%T'", errtype, type, rhstype);
-     }
-   /* And warn about assigning a negative value to an unsigned
-      variable.  */
-   else if (TREE_UNSIGNED (type) && codel != BOOLEAN_TYPE)
-     {
-       if (TREE_CODE (rhs) == INTEGER_CST
- 	  && TREE_NEGATED_INT (rhs))
- 	{
- 	  if (fndecl)
- 	    cp_warning ("negative value `%E' passed as argument %P of `%D'",
- 			rhs, parmnum, fndecl);
- 	  else
- 	    cp_warning ("%s of negative value `%E' to `%T'",
- 			errtype, rhs, type);
- 	}
-       overflow_warning (rhs);
-       if (TREE_CONSTANT (rhs))
- 	rhs = fold (rhs);
-     }
  
    /* [expr.ass]
  
--- 6525,6530 ----
Index: testsuite/g++.old-deja/g++.martin/sts_vectini.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 sts_vectini.C
*** sts_vectini.C	1999/09/04 15:09:03	1.2
--- sts_vectini.C	2000/03/02 15:12:49
***************
*** 1,4 ****
! // Special g++ Options: -O2
  // egcs-bugs 1999-02-22 14:24 Stefan Schwarzer
  // sts@ica1.uni-stuttgart.de
  // optimizer problem in egcs <= 1.1.1
--- 1,4 ----
! // Special g++ Options: -O2 -w
  // egcs-bugs 1999-02-22 14:24 Stefan Schwarzer
  // sts@ica1.uni-stuttgart.de
  // optimizer problem in egcs <= 1.1.1
Index: testsuite/g++.old-deja/g++.pt/explicit10.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit10.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit10.C
*** explicit10.C	1998/12/16 21:55:00	1.2
--- explicit10.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't link:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  void foo(T t);
  
Index: testsuite/g++.old-deja/g++.pt/explicit12.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit12.C,v
retrieving revision 1.3
diff -c -3 -p -r1.3 explicit12.C
*** explicit12.C	1998/12/16 21:55:02	1.3
--- explicit12.C	2000/03/02 15:12:50
***************
*** 1,4 ****
--- 1,5 ----
  // Build don't run:
+ // Special g++ Options: -ansi -pedantic-errors -w
  // GROUPS passed templates
  template <class U>
  struct S 
Index: testsuite/g++.old-deja/g++.pt/explicit13.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit13.C,v
retrieving revision 1.3
diff -c -3 -p -r1.3 explicit13.C
*** explicit13.C	1998/12/16 21:55:03	1.3
--- explicit13.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  
  template <class U>
  struct S 
Index: testsuite/g++.old-deja/g++.pt/explicit17.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit17.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit17.C
*** explicit17.C	1998/12/16 21:55:07	1.2
--- explicit17.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't link:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T, class U>
  void foo(U u, T t);
  
Index: testsuite/g++.old-deja/g++.pt/explicit18.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit18.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit18.C
*** explicit18.C	1998/12/16 21:55:08	1.2
--- explicit18.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  int foo(T t) { return 0; }
  
Index: testsuite/g++.old-deja/g++.pt/explicit19.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit19.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit19.C
*** explicit19.C	1998/12/16 21:55:10	1.2
--- explicit19.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  int foo(T t);
  
Index: testsuite/g++.old-deja/g++.pt/explicit23.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit23.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit23.C
*** explicit23.C	1998/12/16 21:55:15	1.2
--- explicit23.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  int foo(T t) { return 1; }
  
Index: testsuite/g++.old-deja/g++.pt/explicit31.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit31.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit31.C
*** explicit31.C	1998/12/16 21:55:24	1.2
--- explicit31.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  struct S
  {
Index: testsuite/g++.old-deja/g++.pt/explicit35.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit35.C,v
retrieving revision 1.3
diff -c -3 -p -r1.3 explicit35.C
*** explicit35.C	1998/12/16 21:55:28	1.3
--- explicit35.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  struct S 
  {
    template <class T>
Index: testsuite/g++.old-deja/g++.pt/explicit6.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/explicit6.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 explicit6.C
*** explicit6.C	1998/12/16 21:55:50	1.2
--- explicit6.C	2000/03/02 15:12:50
***************
*** 1,5 ****
--- 1,6 ----
  // Build don't run:
  // GROUPS passed templates
+ // Special g++ Options: -ansi -pedantic-errors -w
  template <class T>
  int foo(T t);
  
Index: testsuite/g++.old-deja/g++.pt/memclass7.C
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/g++.old-deja/g++.pt/memclass7.C,v
retrieving revision 1.3
diff -c -3 -p -r1.3 memclass7.C
*** memclass7.C	1998/12/16 21:57:47	1.3
--- memclass7.C	2000/03/02 15:12:50
***************
*** 1,3 ****
--- 1,4 ----
+ // Special g++ Options: -ansi -pedantic-errors -w
  struct S 
  {
    template <class U>

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