From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17934 invoked by alias); 23 Aug 2012 18:20:12 -0000 Received: (qmail 17899 invoked by uid 22791); 23 Aug 2012 18:20:09 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-bk0-f73.google.com (HELO mail-bk0-f73.google.com) (209.85.214.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Aug 2012 18:19:54 +0000 Received: by bkwj4 with SMTP id j4so51714bkw.0 for ; Thu, 23 Aug 2012 11:19:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:content-type:content-transfer-encoding:message-id:date :to:cc:subject:in-reply-to:references:x-mailer:from :x-gm-message-state; bh=iwxGT7gKgNt68V50LjQUeFIMOyxJyxLdO5vESBYl6GM=; b=ZT6PAx90fe77nXQP2cL+SJiBWKGXdifUi9mWHbBC3ALBTOQnJLcAj6yalfAUChSjgE vjeLhxQ0yM4+B0ZvZ21TzJ3TtJjVCglrQ6rcvoX0qi+BJr9o3XQkthYajpDEfYGbMp9j LQZtVDXutmnUvVXQIYt71OS61Ah9K8iZThsR57bDnYdMXcQzj7zqDIFhTfrLGjj3Fg9j CVvfGUJP3IOkwdcEprcSF6FVlwuYFeT7GRCut6x14AKkbFI3pkz1Abzt7K6dfrcY1uky lr35S01/UMY6f28amctwopfmVHULm9x/VIaR8YVrntSWLAEIcz3/LkCt1bmfMmbUYhq7 JwuA== Received: by 10.180.95.2 with SMTP id dg2mr454585wib.2.1345745993241; Thu, 23 Aug 2012 11:19:53 -0700 (PDT) Received: by 10.180.95.2 with SMTP id dg2mr454581wib.2.1345745993205; Thu, 23 Aug 2012 11:19:53 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id em7si29190wib.2.2012.08.23.11.19.53 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 23 Aug 2012 11:19:53 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.18.110.129]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id E226B5C0050; Thu, 23 Aug 2012 11:19:51 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20534.29766.629459.204573@ruffy2.mtv.corp.google.com> Date: Thu, 23 Aug 2012 18:20:00 -0000 To: Yao Qi Cc: Subject: Re: [PATCH 1/3] var_integer -> var_uinteger In-Reply-To: <1344871663-915-2-git-send-email-yao@codesourcery.com> References: <7A6A55B4-0293-4AD6-AB1F-B3169F8ADCC1@cs.umd.edu> <1344871663-915-1-git-send-email-yao@codesourcery.com> <1344871663-915-2-git-send-email-yao@codesourcery.com> From: dje@google.com X-Gm-Message-State: ALoCoQmJtxphUpHyfSUsE35LkkMby2tjFkfBRUR01OMbdOuOtzWQIdTx9SwoSkyrq+9/QCl06Fj2nUCPoHxYNplcybQPLipqskw4LcvgWPRThHseb6DvXxBkR01LGNagbRF6qZs70Voy6M7LsEyuXHJt3m5m4Tn7n9XqPMYEws28o6lG1CMjot+o3l9fmMBltSqeEFYHSgd2YbXMaA7ciN5344tazID5rA== X-IsSubscribed: yes 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-08/txt/msg00691.txt.bz2 Yao Qi writes: > Hi, > The ngative value makes no sense to these commands, so this patch simply > changes them to var_uinteger. Hi. Most of the patch is ok with me. Further comments inline. > gdb: > > 2012-08-13 Yao Qi > > * cli/cli-cmds.c (max_user_call_depth): Add 'unsigned'. > (init_cmds): Call add_setshow_uinteger_cmd for command > 'max-user-call-depth'. > * cli/cli-script.c (execute_user_command): Add 'unsigned' to the > declaration of 'max_user_call_depth'. > * frame.c (backtrace_limit): Add 'unsigned'. > (_initialize_frame): Call add_setshow_uinteger_cmd for command > 'limit'. > * remote.c (remoteaddresssize): Add 'unsigned'. > (remote_address_masked): Change local var 'address_size' to > 'unsigned'. > (_initialize_remote): Call add_setshow_uinteger_cmd for > 'remoteaddresssize'. > * top.c (history_size): Add 'unsigned'. > (show_commands): Change local variables to 'unsigned'. > (set_history_size_command): Don't check history_size is negative. > [...] > diff --git a/gdb/top.c b/gdb/top.c > index 8251d1b..fbd4120 100644 > --- a/gdb/top.c > +++ b/gdb/top.c > @@ -710,7 +710,7 @@ show_write_history_p (struct ui_file *file, int from_tty, > value); > } > > -static int history_size; > +static unsigned int history_size; > static void > show_history_size (struct ui_file *file, int from_tty, > struct cmd_list_element *c, const char *value) > @@ -1379,7 +1379,7 @@ show_commands (char *args, int from_tty) > > /* The first command in the history which doesn't exist (i.e. one more > than the number of the last command). Relative to history_base. */ > - int hist_len; > + unsigned int hist_len; > > /* Print out some of the commands from the command history. */ > /* First determine the length of the history list. */ > @@ -1444,15 +1444,13 @@ show_commands (char *args, int from_tty) > static void > set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) > { > - if (history_size == INT_MAX) > + if (history_size == UINT_MAX) > unstifle_history (); > - else if (history_size >= 0) > - stifle_history (history_size); > + else if (history_size >= INT_MAX) > + /* The type of parameter in stifle_history is int, so check the range. */ > + error (_("History size must be less than %d"), INT_MAX); I think we don't want to remove resetting "history_size = INT_MAX;" in the error case here (but see below). Also, new style rules say that since the clause is multiple lines it needs to be wrapped in {}. It's kinda funny that explicitly setting the value to UINT_MAX (instead of zero) is ok, but setting the value to anywhere between INT_MAX and UINT_MAX-1 is an error because it's too big. :-) That makes me think it'd be better to just bite the bullet and say any value from INT_MAX and up means "unlimited". They're effectively that anyway. > else > - { > - history_size = INT_MAX; > - error (_("History size must be non-negative")); > - } > + stifle_history (history_size); > } > > void > @@ -1632,13 +1630,13 @@ Without an argument, saving is enabled."), > show_write_history_p, > &sethistlist, &showhistlist); > > - add_setshow_integer_cmd ("size", no_class, &history_size, _("\ > + add_setshow_uinteger_cmd ("size", no_class, &history_size, _("\ > Set the size of the command history,"), _("\ > Show the size of the command history,"), _("\ > ie. the number of previous commands to keep a record of."), > - set_history_size_command, > - show_history_size, > - &sethistlist, &showhistlist); > + set_history_size_command, > + show_history_size, > + &sethistlist, &showhistlist); > > add_setshow_filename_cmd ("filename", no_class, &history_filename, _("\ > Set the filename in which to record the command history"), _("\ > -- > 1.7.7.6 >