gdb: Remove casts of NULL during assignment.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 31 Aug 2015 20:19:49 +0000 (21:19 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 4 Sep 2015 15:49:54 +0000 (16:49 +0100)
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
gdb/c-valprint.c
gdb/dbxread.c
gdb/gnu-nat.c
gdb/mdebugread.c
gdb/p-valprint.c
gdb/xcoffread.c

index a4474abde364013f570e143bb2ebb9376d07b2f9..2ae453f61629ae547f0dca70f247a69010d77aba 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-04  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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  <yao.qi@linaro.org>
 
        * NEWS: Mention the aarch64 multi-arch debugging support.
index 80a75d79db157fef43776d4493540fefff0ac06d..9c96df2002becc81757f0c2e39c79250a60dbead 100644 (file)
@@ -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)
index 029b98e38cf52ff3ce5e5aa68f462ebb984f344a..dd81ec8c49e8b3169fee6b11824f144eb7c324e0 100644 (file)
@@ -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;
 }
index c2dfe5d9b6d395a7fabb6c993a3f62685b9c5cc5..d3f54d0375dd9f02e56f24f9904f4ebdd58af25e 100644 (file)
@@ -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,
index 1e684328054297200efe6ce14b28bc74ea6cf8f7..f8338f418bf8a2bc88bff1f435c7276231fe1b1a 100644 (file)
@@ -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);
 
index a0b99f8350473793d485b43280afdc9359774170..0ceddd1faa3f6c146a0c25651f4e8ce189a65048 100644 (file)
@@ -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)
index 46958013549110d1d314e81120c27c5178bd6dd4..0d497514cd9a670aed9c6953148e295722e03ad7 100644 (file)
@@ -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;
 }
This page took 0.034853 seconds and 4 git commands to generate.