Re: [PATCH] Display var_zinteger as signed

Andrew Burgess
2011-07-05T10:44:11Z

On 05/07/2011 09:47, Andreas Schwab wrote:
> "Andrew Burgess"<aburgess@broadcom.com> writes:
>
>> + if (c->var_type == var_uinteger&&
>> + *(unsigned int *) c->var == UINT_MAX)
>
> GNU style is to break before the operator.

Updated patch below. Thanks for the feedback.

Thanks,
Andrew

2011-07-04 Andrew Burgess <aburgess@broadcom.com>

* cli/cli-setshow.c (do_setshow_command): Display var_zinteger
variables as signed, not unsigned.

diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 6acdd91..8dbfaad 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -358,21 +358,18 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
}
break;
case var_uinteger:
- if (*(unsigned int *) c->var == UINT_MAX)
- {
- fputs_filtered ("unlimited", stb->stream);
- break;
- }
- /* else fall through */
case var_zuinteger:
- case var_zinteger:
- fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
+ if (c->var_type == var_uinteger
+ && *(unsigned int *) c->var == UINT_MAX)
+ fputs_filtered ("unlimited", stb->stream);
+ else
+ fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
break;
case var_integer:
- if (*(int *) c->var == INT_MAX)
- {
- fputs_filtered ("unlimited", stb->stream);
- }
+ case var_zinteger:
+ if (c->var_type == var_integer
+ && *(int *) c->var == INT_MAX)
+ fputs_filtered ("unlimited", stb->stream);
else
fprintf_filtered (stb->stream, "%d", *(int *) c->var);
break;