[commit] ada-lang, possible_user_operator_p, null pointer (take 2)

Joel Brobecker brobecker@adacore.com
Wed Aug 15 18:39:00 GMT 2007


Hello,

> > In the meantime, I think it's fine to check in your patch.
> > We'll probably end up rewriting this part of the code, but
> > that won't actually change the actual logic, so....
> 
> Glad you're on it, and I'll commit this patch.

Paul Hilfinger pointed out that we actually have the perfect
function for it, so we don't even have to create it. I just
committed the following patch, which considerably simplifies
the complexity of the condition :).

2007-08-15  Paul Hilfinger  <hilfinger@adacore.com>
            Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (possible_user_operator_p): Alternative fix to last
        checkin guarding against NULL.

Tested on x86-linux.

-- 
Joel
-------------- next part --------------
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.102
diff -u -p -r1.102 ada-lang.c
--- ada-lang.c	14 Aug 2007 20:16:16 -0000	1.102
+++ ada-lang.c	15 Aug 2007 18:31:06 -0000
@@ -3532,14 +3535,7 @@ possible_user_operator_p (enum exp_opcod
       return (!(scalar_type_p (type0) && scalar_type_p (type1)));
 
     case BINOP_CONCAT:
-      return
-        ((TYPE_CODE (type0) != TYPE_CODE_ARRAY
-          && (TYPE_CODE (type0) != TYPE_CODE_PTR
-              || TYPE_CODE (TYPE_TARGET_TYPE (type0)) != TYPE_CODE_ARRAY))
-         || (type1 != NULL && TYPE_CODE (type1) != TYPE_CODE_ARRAY
-             && (TYPE_CODE (type1) != TYPE_CODE_PTR
-                 || (TYPE_CODE (TYPE_TARGET_TYPE (type1)) 
-		     != TYPE_CODE_ARRAY))));
+      return !ada_is_array_type (type0) || !ada_is_array_type (type1);
 
     case BINOP_EXP:
       return (!(numeric_type_p (type0) && integer_type_p (type1)));


More information about the Gdb-patches mailing list