From be9033582599e50521feb879d7476756c2c8c017 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 31 Aug 2015 21:19:49 +0100 Subject: [PATCH] gdb: Remove casts of NULL during assignment. 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 a4474abde3..2ae453f616 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2015-09-04 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-09-04 Yao Qi * NEWS: Mention the aarch64 multi-arch debugging support. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 80a75d79db..9c96df2002 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 029b98e38c..dd81ec8c49 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 c2dfe5d9b6..d3f54d0375 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 1e68432805..f8338f418b 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 a0b99f8350..0ceddd1faa 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 4695801354..0d497514cd 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; }