This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFC/Patch] Call overloaded operators to perform valid Python operations on struct/class values.


Siva Chandra <sivachandra@google.com> 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  <sivachandra@google.com>
>
>         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.
>  <<<no blank line here>>>
>         * 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.


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