From patchwork Mon Aug 31 20:49:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 8530 Received: (qmail 3745 invoked by alias); 31 Aug 2015 20:49:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3669 invoked by uid 89); 31 Aug 2015 20:49:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f173.google.com Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 31 Aug 2015 20:49:32 +0000 Received: by wicmc4 with SMTP id mc4so12125556wic.0 for ; Mon, 31 Aug 2015 13:49:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=2X7c6gFn5DZX6Y/Uyjd5NB5KGYFkHOnaRr5z4hQ4x+Q=; b=VBRnrCamEQzsagy4EKlnvBbBxo7XzvFjMhBJOpCKdyUyov6dSMBAtDW46JewuGdV7C A+PvaU21hKASOYteE5YvmxQLpR5Q3+4FiIFj1QLBE5iEG/uMWdxzYqED/MXBUbxLhTEn qNhTsC1FbruWeo8PSpkmZPcYV7FUWR9wWExvDoe2ZPev6k6KOnH67Kz/piNNWo1vnYz6 TNptrZINeefNGDjbP4/dK8dcxj/BTBWsPGn/G4P7soh+fd9VU3lWIeHlLMC84gU74kaG SmqmzUyDAFNFsTdZOe+EoDaYq7SzluDGGDwKmlERgX3JIgJRXfdUfAipT8KjjiLxQzgt fC/g== X-Gm-Message-State: ALoCoQkiksoRPLRXuV31TqZPpGTN5y1OE9IfbDoKsP45MlyvMnnEyVGrXGzLoTQATPJ+GcuomXe3 X-Received: by 10.194.79.66 with SMTP id h2mr29457590wjx.6.1441054169556; Mon, 31 Aug 2015 13:49:29 -0700 (PDT) Received: from localhost (host86-146-54-249.range86-146.btcentralplus.com. [86.146.54.249]) by smtp.gmail.com with ESMTPSA id en5sm446043wib.18.2015.08.31.13.49.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2015 13:49:28 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/3] gdb: Remove casts of NULL during assignment. Date: Mon, 31 Aug 2015 21:49:22 +0100 Message-Id: <87805f73392bb390ba2b4d9713b1d1ac05cc49de.1441054039.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes In the following code: struct symbol *wsym = (struct symbol *) NULL; the cast of NULL is redundant, it adds noise, and is just one more thing to change if the type of wsym ever changes. There are a relatively small number of places in gdb where the above code pattern is used. Usually the cast is removed like this: struct symbol *wsym = NULL; This commit updates all the places within the gdb/ directory where we cast NULL during assignment, removing the cast. gdb/ChangeLog: * c-valprint.c (print_unpacked_pointer): Remove cast of NULL pointer. * dbxread.c (dbx_end_psymtab): Likewise. * gnu-nat.c (gnu_write_inferior): Likewise. * mdebugread.c (cross_ref): Likewise. * p-valprint.c (pascal_val_print): Likewise. * xcoffread.c (xcoff_end_psymtab): Likewise. --- gdb/ChangeLog | 10 ++++++++++ gdb/c-valprint.c | 4 ++-- gdb/dbxread.c | 2 +- gdb/gnu-nat.c | 2 +- gdb/mdebugread.c | 2 +- gdb/p-valprint.c | 4 ++-- gdb/xcoffread.c | 2 +- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ddb8e78..f4dafb6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2015-08-31 Andrew Burgess + * c-valprint.c (print_unpacked_pointer): Remove cast of NULL + pointer. + * dbxread.c (dbx_end_psymtab): Likewise. + * gnu-nat.c (gnu_write_inferior): Likewise. + * mdebugread.c (cross_ref): Likewise. + * p-valprint.c (pascal_val_print): Likewise. + * xcoffread.c (xcoff_end_psymtab): Likewise. + +2015-08-31 Andrew Burgess + * tui/tui-data.c (tui_win_name): Make local variable const, remove cast of NULL. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 80a75d7..9c96df2 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -193,9 +193,9 @@ print_unpacked_pointer (struct type *type, struct type *elttype, if (vt_address && options->vtblprint) { struct value *vt_val; - struct symbol *wsym = (struct symbol *) NULL; + struct symbol *wsym = NULL; struct type *wtype; - struct block *block = (struct block *) NULL; + struct block *block = NULL; struct field_of_this_result is_this_fld; if (want_space) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 029b98e..dd81ec8 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2341,7 +2341,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst, discard_psymtab (objfile, pst); /* Indicate that psymtab was thrown away. */ - pst = (struct partial_symtab *) NULL; + pst = NULL; } return pst; } diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index c2dfe5d..d3f54d0 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2350,7 +2350,7 @@ gnu_write_inferior (task_t task, CORE_ADDR addr, char *errstr = "Bug in gnu_write_inferior"; struct vm_region_list *region_element; - struct vm_region_list *region_head = (struct vm_region_list *) NULL; + struct vm_region_list *region_head = NULL; /* Get memory from inferior with page aligned addresses. */ err = vm_read (task, diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 1e68432..f8338f4 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4376,7 +4376,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, int xref_fd; struct mdebug_pending *pend; - *tpp = (struct type *) NULL; + *tpp = NULL; (*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn); diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index a0b99f8..0ceddd1 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -239,9 +239,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, if (vt_address && options->vtblprint) { struct value *vt_val; - struct symbol *wsym = (struct symbol *) NULL; + struct symbol *wsym = NULL; struct type *wtype; - struct block *block = (struct block *) NULL; + struct block *block = NULL; struct field_of_this_result is_this_fld; if (want_space) diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 4695801..0d49751 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2108,7 +2108,7 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst, discard_psymtab (objfile, pst); /* Indicate that psymtab was thrown away. */ - pst = (struct partial_symtab *) NULL; + pst = NULL; } return pst; }