This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

[PATCH]: Allow rank_one_type to see through reference types


This patch  (against the latest cvs) allows rank_one_type to see through
reference types, rather than claim the overload is incompatbile.Since we
can cast to references anyway, it shouldn't claim they were incompatible,
and at worst, if we can't figure out how to cast it, you'll get an error
when it tries to cast it.

This helps overload resolution quite a bit. I can now successfully use all
STL containers's member functions, when combined with my other patch.

Next up, the exception handling stuff.

--Dan

Index: gdbtypes.c
===================================================================
RCS file: /cvs/gdb/gdb/gdb/gdbtypes.c,v
retrieving revision 1.1.1.12
diff -c -3 -p -r1.1.1.12 gdbtypes.c
*** gdbtypes.c	1999/12/14 01:05:31	1.1.1.12
--- gdbtypes.c	2000/01/25 18:17:48
*************** rank_one_type (parm, arg)
*** 2276,2282 ****
  	  else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
  	    return INTEGER_PROMOTION_BADNESS;
  	  else
! 	    return INTEGER_COERCION_BADNESS;
  	case TYPE_CODE_ENUM:
  	case TYPE_CODE_CHAR:
  	case TYPE_CODE_RANGE:
--- 2276,2286 ----
  	  else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
  	    return INTEGER_PROMOTION_BADNESS;
  	  else
! 		  /*Catches const char * cases that above don't catch */
! 		  if (!strcmp_iw (TYPE_NAME (parm), TYPE_NAME (arg)))
! 		  	return 0; 
! 	    else
! 			return INTEGER_COERCION_BADNESS;
  	case TYPE_CODE_ENUM:
  	case TYPE_CODE_CHAR:
  	case TYPE_CODE_RANGE:
*************** rank_one_type (parm, arg)
*** 2411,2416 ****
--- 2415,2423 ----
        /* currently same as TYPE_CODE_CLASS */
        switch (TYPE_CODE (arg))
  	{
+ 	case TYPE_CODE_REF:
+ 	  /* Ignore the reference*/
+ 	  return rank_one_type(parm,TYPE_TARGET_TYPE(arg));
  	case TYPE_CODE_STRUCT:
  	  /* Check for derivation */
  	  if (is_ancestor (parm, arg))
*************** rank_one_type (parm, arg)
*** 2446,2454 ****
      case TYPE_CODE_REF:
        switch (TYPE_CODE (arg))
  	{
! 
  	default:
! 	  return INCOMPATIBLE_TYPE_BADNESS;
  	}
  
        break;
--- 2453,2464 ----
      case TYPE_CODE_REF:
        switch (TYPE_CODE (arg))
  	{
! 	case TYPE_CODE_REF:
! 			/*Two references, ignore both*/
! 		return rank_one_type(TYPE_TARGET_TYPE(parm),TYPE_TARGET_TYPE(arg));
  	default:
! 		/*One refrence, ignore it*/
! 		return rank_one_type(TYPE_TARGET_TYPE(parm),arg);
  	}
  
        break;
Index: ChangeLog
===================================================================
RCS file: /cvs/gdb/gdb/gdb/ChangeLog,v
retrieving revision 1.1.1.41
diff -c -3 -p -r1.1.1.41 ChangeLog
*** ChangeLog	2000/01/25 02:39:20	1.1.1.41
--- ChangeLog	2000/01/25 18:17:48
***************
*** 1,3 ****
--- 1,7 ----
+ 2000-01-25	Daniel Berlin <dan@cgsoftware.com>
+ 	* gdbtypes.c (rank_one_type): Handle references properly. Also, handle case of
+ 	weird flags on char types.
+ 	
  2000-01-24  Kevin Buettner  <kevinb@redhat.com>
  
  	* utils.c (get_field, put_field): Fix buffer underruns and

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