Re: [PATCH 1/3] var_zuinteger_unlimited and 'set listsize'.

Doug Evans
2012-08-02T08:34:14Z

On Wed, Aug 1, 2012 at 6:55 AM, Yao Qi <yao@codesourcery.com> wrote:
> Hi,
> This patch is to add new var_types 'var_zuinteger_unlimited' and
> fix 'set listsize'.
>
> gdb:
>
> 2012-08-01 Yao Qi <yao@codesourcery.com>
> Mark Kettenis <kettenis@gnu.org>
>
> * cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
> * cli/cli-setshow.c (do_setshow_command): Handle case
> 'var_zuinteger_unlimited'.
> (do_setshow_command): Check the range for var_uinteger and
> var_zuinteger.
> * command.h (typedef enum var_types): New enum
> 'var_zuinteger_unlimited'.
> Declare add_setshow_zuinteger_unlimited_cmd.
> * source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd.

Nit: The changelog entry for source.c should mention "listsize". And
the entry for do_setshow_command should also mention that it fixes the
setting of var_integer and var_zinteger to allow negative values.

Things are quite a mess, aren't they.
Adding yet another var_foo doesn't appeal to me, but we can't break
anything and being able to set both "0" and "unlimited" (expressed
however) would be nice.

Is there any real use-case that wants to be able to set negative
values and have "0" mean unlimited? It's never (until this patch)
been the case that one can set negative values to var_integer. Can we
remove (or at least deprecate) var_integer? [we'd switch all existing
uses to var_uinteger, the only remaining use would be the Python API]

btw, you also might want to update python/py-param.c.
Though py-param.c also doesn't handle var_zuinteger, and I don't mind
not extending the Python API until we know we want to.