Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: Extend some arithmetic operations to range types.
@ 2004-03-26 10:59 Paul Hilfinger
  2004-03-26 18:07 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Hilfinger @ 2004-03-26 10:59 UTC (permalink / raw)
  To: gdb-patches


The following patch extends a few operations on struct value*s that 
currently fail when an operand has a range type.  For C/C++ these 
extensions have no effect, since those languages don't make use of 
range types, but it is an issue in Ada.

Paul N. Hilfinger
ACT, Inc.


2004-03-26  Paul N. Hilfinger  <Hilfinger@gnat.com>

	* gdbtypes.c (base_type): New function.
	* gdbtypes.h (base_type): Declare.
	* valarith.c: Update copyright notice.
	(value_add): Handle range types.
	(value_sub): Ditto.
	(value_equal): Ditto.
	(value_less): Ditto.
	(value_neg): Ditto.
	(value_complement): Ditto.
	* value.h (COERCE_ENUM): Extend to ranges of enumerated types.

Index: current-public.55/gdb/gdbtypes.c
--- current-public.55/gdb/gdbtypes.c Fri, 12 Mar 2004 22:56:54 -0800 hilfingr (GdbPub/h/48_gdbtypes.c 1.1.1.5.1.1.1.1.1.1.3.1.1.1.1.1.2.1 644)
+++ submit.47(w)/gdb/gdbtypes.c Sat, 13 Mar 2004 01:57:12 -0800 hilfingr (GdbPub/h/48_gdbtypes.c 1.1.1.5.1.1.1.1.1.1.3.1.1.1.1.1.2.1.1.1 644)
@@ -720,6 +720,22 @@ get_discrete_bounds (struct type *type, 
     }
 }
 
+/* The identity on non-range types.  For range types, the underlying
+   non-range scalar type. */  
+
+struct type*
+base_type (struct type* type)
+{
+  while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE)
+    {
+      if (type == TYPE_TARGET_TYPE (type) 
+	  || TYPE_TARGET_TYPE (type) == NULL)	
+	return type;
+      type = TYPE_TARGET_TYPE (type);
+    }
+  return type;
+}
+
 /* Create an array type using either a blank type supplied in RESULT_TYPE,
    or creating a new type, inheriting the objfile from RANGE_TYPE.
 
Index: current-public.55/gdb/gdbtypes.h
--- current-public.55/gdb/gdbtypes.h Mon, 09 Feb 2004 01:03:21 -0800 hilfingr (GdbPub/h/49_gdbtypes.h 1.1.1.3.1.1.1.1.1.1.3.1 644)
+++ submit.47(w)/gdb/gdbtypes.h Sat, 06 Mar 2004 02:39:59 -0800 hilfingr (GdbPub/h/49_gdbtypes.h 1.1.1.3.1.1.1.1.1.1.3.1.1.1 644)
@@ -1135,6 +1146,8 @@ extern struct type *lookup_function_type
 
 extern struct type *create_range_type (struct type *, struct type *, int,
 				       int);
+
+extern struct type* base_type (struct type*);
 
 extern struct type *create_array_type (struct type *, struct type *,
 				       struct type *);
Index: current-public.55/gdb/valarith.c
--- current-public.55/gdb/valarith.c Wed, 17 Sep 2003 23:22:28 -0700 hilfingr (GdbPub/l/16_valarith.c 1.1.1.3 644)
+++ submit.47(w)/gdb/valarith.c Fri, 26 Mar 2004 01:48:40 -0800 hilfingr (GdbPub/l/16_valarith.c 1.1.1.3.2.1 644)
@@ -1,7 +1,7 @@
 /* Perform arithmetic and other operations on values, for GDB.
 
    Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -99,8 +99,8 @@ value_add (struct value *arg1, struct va
   if ((TYPE_CODE (type1) == TYPE_CODE_PTR
        || TYPE_CODE (type2) == TYPE_CODE_PTR)
       &&
-      (TYPE_CODE (type1) == TYPE_CODE_INT
-       || TYPE_CODE (type2) == TYPE_CODE_INT))
+      (TYPE_CODE (base_type (type1)) == TYPE_CODE_INT
+       || TYPE_CODE (base_type (type2)) == TYPE_CODE_INT))
     /* Exactly one argument is a pointer, and one is an integer.  */
     {
       struct value *retval;
@@ -141,7 +141,7 @@ value_sub (struct value *arg1, struct va
 
   if (TYPE_CODE (type1) == TYPE_CODE_PTR)
     {
-      if (TYPE_CODE (type2) == TYPE_CODE_INT)
+      if (TYPE_CODE (base_type (type2)) == TYPE_CODE_INT)
 	{
 	  /* pointer - integer.  */
 	  LONGEST sz = find_size_for_pointer_math (type1);
@@ -1227,8 +1227,8 @@ value_equal (struct value *arg1, struct 
 
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
-  code1 = TYPE_CODE (type1);
-  code2 = TYPE_CODE (type2);
+  code1 = TYPE_CODE (base_type (type1));
+  code2 = TYPE_CODE (base_type (type2));
 
   if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL) &&
       (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
@@ -1284,8 +1284,8 @@ value_less (struct value *arg1, struct v
 
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
-  code1 = TYPE_CODE (type1);
-  code2 = TYPE_CODE (type2);
+  code1 = TYPE_CODE (base_type (type1));
+  code2 = TYPE_CODE (base_type (type2));
 
   if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL) &&
       (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
@@ -1323,7 +1323,7 @@ value_neg (struct value *arg1)
   COERCE_REF (arg1);
   COERCE_ENUM (arg1);
 
-  type = check_typedef (VALUE_TYPE (arg1));
+  type = base_type (check_typedef (VALUE_TYPE (arg1)));
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     return value_from_double (result_type, -value_as_double (arg1));
@@ -1353,7 +1353,7 @@ value_complement (struct value *arg1)
   COERCE_REF (arg1);
   COERCE_ENUM (arg1);
 
-  type = check_typedef (VALUE_TYPE (arg1));
+  type = base_type (check_typedef (VALUE_TYPE (arg1)));
 
   typecode = TYPE_CODE (type);
   if ((typecode != TYPE_CODE_INT) && (typecode != TYPE_CODE_BOOL))
Index: current-public.55/gdb/value.h
--- current-public.55/gdb/value.h Thu, 30 Oct 2003 00:47:47 -0800 hilfingr (GdbPub/l/20_value.h 1.9 644)
+++ submit.47(w)/gdb/value.h Fri, 26 Mar 2004 01:48:40 -0800 hilfingr (GdbPub/l/20_value.h 1.9.1.1 644)
@@ -267,7 +267,7 @@ extern int value_fetch_lazy (struct valu
 
 #define COERCE_ENUM(arg) \
   do {									\
-    if (TYPE_CODE (check_typedef (VALUE_TYPE (arg))) == TYPE_CODE_ENUM)	\
+    if (TYPE_CODE (base_type (check_typedef (VALUE_TYPE (arg)))) == TYPE_CODE_ENUM)	\
       arg = value_cast (builtin_type_unsigned_int, arg);		\
   } while (0)
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-26 10:59 [RFA]: Extend some arithmetic operations to range types Paul Hilfinger
@ 2004-03-26 18:07 ` Daniel Jacobowitz
  2004-03-26 19:03   ` Joel Brobecker
  2004-03-29 11:29   ` Paul Hilfinger
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-03-26 18:07 UTC (permalink / raw)
  To: Paul Hilfinger; +Cc: gdb-patches

On Fri, Mar 26, 2004 at 05:59:16AM -0500, Paul Hilfinger wrote:
> +/* The identity on non-range types.  For range types, the underlying
> +   non-range scalar type. */  
> +
> +struct type*
> +base_type (struct type* type)

Is there something clearer you can call this?  "base" to me means "as
in inheritance", which is not really appropriate here.

> @@ -99,8 +99,8 @@ value_add (struct value *arg1, struct va
>    if ((TYPE_CODE (type1) == TYPE_CODE_PTR
>         || TYPE_CODE (type2) == TYPE_CODE_PTR)
>        &&
> -      (TYPE_CODE (type1) == TYPE_CODE_INT
> -       || TYPE_CODE (type2) == TYPE_CODE_INT))
> +      (TYPE_CODE (base_type (type1)) == TYPE_CODE_INT
> +       || TYPE_CODE (base_type (type2)) == TYPE_CODE_INT))
>      /* Exactly one argument is a pointer, and one is an integer.  */
>      {
>        struct value *retval;

Most of your changes just need a predicate for
integer-or-scalar-range-type.  You can probably find a better name if
the predicate is all you need.

> @@ -1323,7 +1323,7 @@ value_neg (struct value *arg1)
>    COERCE_REF (arg1);
>    COERCE_ENUM (arg1);
>  
> -  type = check_typedef (VALUE_TYPE (arg1));
> +  type = base_type (check_typedef (VALUE_TYPE (arg1)));
>  
>    if (TYPE_CODE (type) == TYPE_CODE_FLT)
>      return value_from_double (result_type, -value_as_double (arg1));
> @@ -1353,7 +1353,7 @@ value_complement (struct value *arg1)
>    COERCE_REF (arg1);
>    COERCE_ENUM (arg1);
>  
> -  type = check_typedef (VALUE_TYPE (arg1));
> +  type = base_type (check_typedef (VALUE_TYPE (arg1)));
>  
>    typecode = TYPE_CODE (type);
>    if ((typecode != TYPE_CODE_INT) && (typecode != TYPE_CODE_BOOL))

I think that even these just need a predicate.  All they use are
TYPE_CODE and TYPE_LENGTH of the range type.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-26 18:07 ` Daniel Jacobowitz
@ 2004-03-26 19:03   ` Joel Brobecker
  2004-03-26 20:32     ` Daniel Jacobowitz
  2004-03-29 11:29   ` Paul Hilfinger
  1 sibling, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2004-03-26 19:03 UTC (permalink / raw)
  To: Paul Hilfinger, gdb-patches

> Is there something clearer you can call this?  "base" to me means "as
> in inheritance", which is not really appropriate here.

How about using the dwarf-2 terminology: basis_type? That's how they
call the type on which the range type is based:

        The subrange entry may have a DW_AT_type attribute to describe
        the type of object, called the basis type, of whose values this
        subrange is a subset.

(base type is the equivalent in Ada terminology)

-- 
Joel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-26 19:03   ` Joel Brobecker
@ 2004-03-26 20:32     ` Daniel Jacobowitz
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-03-26 20:32 UTC (permalink / raw)
  To: gdb-patches

On Fri, Mar 26, 2004 at 11:03:34AM -0800, Joel Brobecker wrote:
> > Is there something clearer you can call this?  "base" to me means "as
> > in inheritance", which is not really appropriate here.
> 
> How about using the dwarf-2 terminology: basis_type? That's how they
> call the type on which the range type is based:
> 
>         The subrange entry may have a DW_AT_type attribute to describe
>         the type of object, called the basis type, of whose values this
>         subrange is a subset.
> 
> (base type is the equivalent in Ada terminology)

Well, if I'm right that all we need is the predicate, we could probably
just use integral_type_p?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-26 18:07 ` Daniel Jacobowitz
  2004-03-26 19:03   ` Joel Brobecker
@ 2004-03-29 11:29   ` Paul Hilfinger
  2004-03-31 19:05     ` Daniel Jacobowitz
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Hilfinger @ 2004-03-29 11:29 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches


Here is a second draft of the patch I submitted on 26 March.  I
believe I have addressed Daniel's comments.  Rather than using a
'base_type' function to strip off range-type wrappers, I use the
existing is_integral_type.  This has the side-effect of extending some
of the operations to work on BOOL or CHAR, which I am assuming is
harmless.  By using is_integral_type, we also can eliminate some calls
to COERCE_ENUM.  For consistency and to tidy things up a bit, I have
taken the liberty of changing value_binop to also use is_integral_type.

Comments?

Paul Hilfinger
ACT, Inc.

2004-03-26  Paul N. Hilfinger  <Hilfinger@gnat.com>

	* valarith.c: Update copyright notice.
	(value_add): Handle range types.
	(value_sub): Ditto.
	(value_equal): Ditto.
	(value_less): Ditto.
	(value_neg): Ditto.
	(value_complement): Ditto.
	(value_binop): Simplify slightly by using is_integral_type and 
	eliminiating unnecessary COERCE_ENUMs.
	
Index: current-public.55/gdb/valarith.c
--- current-public.55/gdb/valarith.c Wed, 17 Sep 2003 23:22:28 -0700 hilfingr (GdbPub/l/16_valarith.c 1.1.1.3 644)
+++ submit.50(w)/gdb/valarith.c Sun, 28 Mar 2004 01:42:22 -0800 hilfingr (GdbPub/l/16_valarith.c 1.1.1.3.2.3 644)
@@ -1,7 +1,7 @@
 /* Perform arithmetic and other operations on values, for GDB.
 
    Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -91,16 +91,15 @@ value_add (struct value *arg1, struct va
   LONGEST sz;
   struct type *type1, *type2, *valptrtype;
 
-  COERCE_NUMBER (arg1);
-  COERCE_NUMBER (arg2);
+  COERCE_ARRAY (arg1);
+  COERCE_ARRAY (arg2);
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
 
   if ((TYPE_CODE (type1) == TYPE_CODE_PTR
        || TYPE_CODE (type2) == TYPE_CODE_PTR)
       &&
-      (TYPE_CODE (type1) == TYPE_CODE_INT
-       || TYPE_CODE (type2) == TYPE_CODE_INT))
+      (is_integral_type (type1) || is_integral_type (type2)))
     /* Exactly one argument is a pointer, and one is an integer.  */
     {
       struct value *retval;
@@ -134,14 +133,14 @@ struct value *
 value_sub (struct value *arg1, struct value *arg2)
 {
   struct type *type1, *type2;
-  COERCE_NUMBER (arg1);
-  COERCE_NUMBER (arg2);
+  COERCE_ARRAY (arg1);
+  COERCE_ARRAY (arg2);
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
 
   if (TYPE_CODE (type1) == TYPE_CODE_PTR)
     {
-      if (TYPE_CODE (type2) == TYPE_CODE_INT)
+      if (is_integral_type (type2))
 	{
 	  /* pointer - integer.  */
 	  LONGEST sz = find_size_for_pointer_math (type1);
@@ -752,22 +751,12 @@ value_binop (struct value *arg1, struct 
 
   COERCE_REF (arg1);
   COERCE_REF (arg2);
-  COERCE_ENUM (arg1);
-  COERCE_ENUM (arg2);
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
 
-  if ((TYPE_CODE (type1) != TYPE_CODE_FLT
-       && TYPE_CODE (type1) != TYPE_CODE_CHAR
-       && TYPE_CODE (type1) != TYPE_CODE_INT
-       && TYPE_CODE (type1) != TYPE_CODE_BOOL
-       && TYPE_CODE (type1) != TYPE_CODE_RANGE)
+  if ((TYPE_CODE (type1) != TYPE_CODE_FLT && !is_integral_type (type1))
       ||
-      (TYPE_CODE (type2) != TYPE_CODE_FLT
-       && TYPE_CODE (type2) != TYPE_CODE_CHAR
-       && TYPE_CODE (type2) != TYPE_CODE_INT
-       && TYPE_CODE (type2) != TYPE_CODE_BOOL
-       && TYPE_CODE (type2) != TYPE_CODE_RANGE))
+      (TYPE_CODE (type2) != TYPE_CODE_FLT && !is_integral_type (type2)))
     error ("Argument to arithmetic operation not a number or boolean.");
 
   if (TYPE_CODE (type1) == TYPE_CODE_FLT
@@ -1221,28 +1210,30 @@ value_equal (struct value *arg1, struct 
   struct type *type1, *type2;
   enum type_code code1;
   enum type_code code2;
+  int is_int1, is_int2;
 
-  COERCE_NUMBER (arg1);
-  COERCE_NUMBER (arg2);
+  COERCE_ARRAY (arg1);
+  COERCE_ARRAY (arg2);
 
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
   code1 = TYPE_CODE (type1);
   code2 = TYPE_CODE (type2);
+  is_int1 = is_integral_type (type1);
+  is_int2 = is_integral_type (type2);
 
-  if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL) &&
-      (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  if (is_int1 && is_int2)
     return longest_to_int (value_as_long (value_binop (arg1, arg2,
 						       BINOP_EQUAL)));
-  else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL)
-	   && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  else if ((code1 == TYPE_CODE_FLT || is_int1)
+	   && (code2 == TYPE_CODE_FLT || is_int2))
     return value_as_double (arg1) == value_as_double (arg2);
 
   /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
      is bigger.  */
-  else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  else if (code1 == TYPE_CODE_PTR && is_int2)
     return value_as_address (arg1) == (CORE_ADDR) value_as_long (arg2);
-  else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
+  else if (code2 == TYPE_CODE_PTR && is_int1)
     return (CORE_ADDR) value_as_long (arg1) == value_as_address (arg2);
 
   else if (code1 == code2
@@ -1278,30 +1269,32 @@ value_less (struct value *arg1, struct v
   enum type_code code1;
   enum type_code code2;
   struct type *type1, *type2;
+  int is_int1, is_int2;
 
-  COERCE_NUMBER (arg1);
-  COERCE_NUMBER (arg2);
+  COERCE_ARRAY (arg1);
+  COERCE_ARRAY (arg2);
 
   type1 = check_typedef (VALUE_TYPE (arg1));
   type2 = check_typedef (VALUE_TYPE (arg2));
   code1 = TYPE_CODE (type1);
   code2 = TYPE_CODE (type2);
+  is_int1 = is_integral_type (type1);
+  is_int2 = is_integral_type (type2);
 
-  if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL) &&
-      (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  if (is_int1 && is_int2)
     return longest_to_int (value_as_long (value_binop (arg1, arg2,
 						       BINOP_LESS)));
-  else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL)
-	   && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  else if ((code1 == TYPE_CODE_FLT || is_int1)
+	   && (code2 == TYPE_CODE_FLT || is_int2))
     return value_as_double (arg1) < value_as_double (arg2);
   else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
     return value_as_address (arg1) < value_as_address (arg2);
 
   /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
      is bigger.  */
-  else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
+  else if (code1 == TYPE_CODE_PTR && is_int2)
     return value_as_address (arg1) < (CORE_ADDR) value_as_long (arg2);
-  else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
+  else if (code2 == TYPE_CODE_PTR && is_int1)
     return (CORE_ADDR) value_as_long (arg1) < value_as_address (arg2);
   else if (code1 == TYPE_CODE_STRING && code2 == TYPE_CODE_STRING)
     return value_strcmp (arg1, arg2) < 0;
@@ -1321,13 +1314,12 @@ value_neg (struct value *arg1)
   struct type *result_type = VALUE_TYPE (arg1);
 
   COERCE_REF (arg1);
-  COERCE_ENUM (arg1);
 
   type = check_typedef (VALUE_TYPE (arg1));
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     return value_from_double (result_type, -value_as_double (arg1));
-  else if (TYPE_CODE (type) == TYPE_CODE_INT || TYPE_CODE (type) == TYPE_CODE_BOOL)
+  else if (is_integral_type (type))
     {
       /* Perform integral promotion for ANSI C/C++.  FIXME: What about
          FORTRAN and (the deleted) chill ?  */
@@ -1348,15 +1340,12 @@ value_complement (struct value *arg1)
 {
   struct type *type;
   struct type *result_type = VALUE_TYPE (arg1);
-  int typecode;
 
   COERCE_REF (arg1);
-  COERCE_ENUM (arg1);
 
   type = check_typedef (VALUE_TYPE (arg1));
 
-  typecode = TYPE_CODE (type);
-  if ((typecode != TYPE_CODE_INT) && (typecode != TYPE_CODE_BOOL))
+  if (!is_integral_type (type))
     error ("Argument to complement operation not an integer or boolean.");
 
   /* Perform integral promotion for ANSI C/C++.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-29 11:29   ` Paul Hilfinger
@ 2004-03-31 19:05     ` Daniel Jacobowitz
  2004-04-01 12:11       ` Paul Hilfinger
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-03-31 19:05 UTC (permalink / raw)
  To: Paul Hilfinger; +Cc: gdb-patches

On Mon, Mar 29, 2004 at 06:29:51AM -0500, Paul Hilfinger wrote:
> 
> Here is a second draft of the patch I submitted on 26 March.  I
> believe I have addressed Daniel's comments.  Rather than using a
> 'base_type' function to strip off range-type wrappers, I use the
> existing is_integral_type.  This has the side-effect of extending some
> of the operations to work on BOOL or CHAR, which I am assuming is
> harmless.  By using is_integral_type, we also can eliminate some calls
> to COERCE_ENUM.  For consistency and to tidy things up a bit, I have
> taken the liberty of changing value_binop to also use is_integral_type.
> 
> Comments?
> 
> Paul Hilfinger
> ACT, Inc.
> 
> 2004-03-26  Paul N. Hilfinger  <Hilfinger@gnat.com>
> 
> 	* valarith.c: Update copyright notice.
> 	(value_add): Handle range types.
> 	(value_sub): Ditto.
> 	(value_equal): Ditto.
> 	(value_less): Ditto.
> 	(value_neg): Ditto.
> 	(value_complement): Ditto.
> 	(value_binop): Simplify slightly by using is_integral_type and 
> 	eliminiating unnecessary COERCE_ENUMs.

This patch looks good to me.  Assuming that you've run the testsuite
with no regressions, it is OK.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA]: Extend some arithmetic operations to range types.
  2004-03-31 19:05     ` Daniel Jacobowitz
@ 2004-04-01 12:11       ` Paul Hilfinger
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Hilfinger @ 2004-04-01 12:11 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches


> > 2004-03-26  Paul N. Hilfinger  <Hilfinger@gnat.com>
> > 
> > 	* valarith.c: Update copyright notice.
> > 	(value_add): Handle range types.
> > 	(value_sub): Ditto.
> > 	(value_equal): Ditto.
> > 	(value_less): Ditto.
> > 	(value_neg): Ditto.
> > 	(value_complement): Ditto.
> > 	(value_binop): Simplify slightly by using is_integral_type and 
> > 	eliminiating unnecessary COERCE_ENUMs.
> 
> This patch looks good to me.  Assuming that you've run the testsuite

Always.  No regressions on Linux.

> with no regressions, it is OK.

Thanks.  Checked into HEAD.  

Paul Hilfinger
ACT, Inc.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-04-01 12:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-26 10:59 [RFA]: Extend some arithmetic operations to range types Paul Hilfinger
2004-03-26 18:07 ` Daniel Jacobowitz
2004-03-26 19:03   ` Joel Brobecker
2004-03-26 20:32     ` Daniel Jacobowitz
2004-03-29 11:29   ` Paul Hilfinger
2004-03-31 19:05     ` Daniel Jacobowitz
2004-04-01 12:11       ` Paul Hilfinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox