From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20043 invoked by alias); 6 Dec 2013 06:25:00 -0000 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 Received: (qmail 20018 invoked by uid 89); 6 Dec 2013 06:24:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f49.google.com Received: from Unknown (HELO mail-pb0-f49.google.com) (209.85.160.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 06 Dec 2013 06:24:58 +0000 Received: by mail-pb0-f49.google.com with SMTP id jt11so487336pbb.22 for ; Thu, 05 Dec 2013 22:24:50 -0800 (PST) X-Received: by 10.66.171.13 with SMTP id aq13mr2175678pac.30.1386311090588; Thu, 05 Dec 2013 22:24:50 -0800 (PST) Received: from sspiff.sspiff.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id bp5sm149181798pbb.18.2013.12.05.22.24.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 22:24:49 -0800 (PST) From: Doug Evans To: Siva Chandra Cc: gdb-patches Subject: Re: [RFC/Patch] Call overloaded operators to perform valid Python operations on struct/class values. References: Date: Fri, 06 Dec 2013 06:25:00 -0000 In-Reply-To: (Siva Chandra's message of "Mon, 2 Dec 2013 11:28:42 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00235.txt.bz2 Siva Chandra writes: > Hi, > > This is a follow up to this thread: > https://sourceware.org/ml/gdb/2013-11/msg00101.html > > Part of Doug's response there seemed to indicate that calling > overloaded operators to perform valid Python operations has not yet > been implemented. The attached patch adds this "feature". I could not > yet think of a reason as to why adding this could be bad (as in, > leading to ambiguity or something similar). > > ChangeLog > > 2013-12-02 Siva Chandra Reddy > > Call overloaded operators to perform valid Python operations on > struct/class values. > > * python/py-value.c (valpy_binop): Call value_x_binop for struct > and class values. > > testsuite/ > * gdb.python/py-value-cc.cc: Improve test case. > * gdb.python/py-value-cc.exp: Add new tests. Hi. I'm not yet comfortable enough with going this route to approve it. It feels sexy and all, but it's not clear to me going this path is a net win. If we could release it as experimental, without any promises to keep it or change it in incompatible ways, I'd say go for it. I'm curious what others think. Nits on the patch itself: 1) In the changelog entry, no blank line here. > Call overloaded operators to perform valid Python operations on > struct/class values. > <<>> > * python/py-value.c (valpy_binop): Call value_x_binop for struct > and class values. 2) NEWS entry and doc required. I can well imagine that they're coming, pending approval of the patch thus far. Sorry! 3) gdb code uses tabs for indentation (and then uses spaces after the needed amount of tabs have been used), and it's a pain when tabbed code is mixed with non-tabbed code. 4) In the test case, don't make extra changes, or if you do split them out into a separate patch.