From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25197 invoked by alias); 4 Jun 2012 20:53:46 -0000 Received: (qmail 25111 invoked by uid 22791); 4 Jun 2012 20:53:44 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_FN,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jun 2012 20:53:28 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q54KrRY3006487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 4 Jun 2012 16:53:27 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q54KrPSY025671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 4 Jun 2012 16:53:26 -0400 From: Tom Tromey To: Siva Chandra Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Extend existing support for evaluating expressions using overloaded operators References: Date: Mon, 04 Jun 2012 20:53:00 -0000 In-Reply-To: (Siva Chandra's message of "Sat, 2 Jun 2012 01:22:11 +0530") Message-ID: <87aa0in6ii.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00102.txt.bz2 >>>>> "Siva" == Siva Chandra writes: Siva> * valarith.c (value_binop): Extend to handle overloaded Siva> binary operations on compound types. I don't understand why value_binop must be modified. I think in the current design it is up to the caller to check this. (I don't necessarily think this is a good design -- but changing it would require more changes elsewhere.) Siva> +int Siva> +is_compound_type (struct type *type) Siva> +{ Siva> + enum type_code type_code; Siva> + Siva> + CHECK_TYPEDEF (type); Siva> + Siva> + type_code = TYPE_CODE (type); Siva> + if (type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION) It seems to me that there is other code which assumes that only TYPE_CODE_STRUCT can be overloaded. At least binop_types_user_defined_p, but maybe others. Those spots should be updated. It would be nice if the test suite tested this case as well. Siva> + TRY_CATCH (except, RETURN_MASK_ERROR) Siva> + { Siva> + /* Retrieve the list of methods with the name NAME. */ Siva> + fns_ptr = value_find_oload_method_list (&temp, name, Siva> + 0, &num_fns, Siva> + &basetype, &boffset); Siva> + } Siva> + if (except.reason < 0) Siva> + fns_ptr = NULL; I'll have to go read this in more depth; but I wonder why it is ok to ignore exceptions here. Tom