This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] 1/n remove useless typedefs


On Tue, Aug 11, 2015 at 12:40 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> Hi,
>
> This just cleans things up slightly by removing typedefs that don't serve any
> real purpose in C++.  If people don't object I'll go through and try and remove
> as many more similarly useless typedefs as I can.
>
> bootstrapped + regtest x86_64-linux-gnu, ok?

Ok.  Similarly pre-approved are redundant 'struct' spellings (if they are always
non-forward declarations...).

Richard.

> Trev
>
> gcc/ChangeLog:
>
> 2015-08-11  trevor Saunders  <tbsaunde@tbsaunde.org>
>
>         * bt-load.c, cgraph.h, dwarf2out.c, dwarf2out.h, final.c,
>         function.c, graphite-scop-detection.c, haifa-sched.c,
>         ipa-devirt.c, ipa-split.c, recog.c, ree.c, stmt.c,
>         tree-data-ref.c, tree-ssa-dom.c, tree-ssa-loop-ivopts.c,
>         varasm.c: Remove typedefs of structs.
> ---
>  gcc/bt-load.c                 |  4 ++--
>  gcc/cgraph.h                  |  4 +---
>  gcc/dwarf2out.c               |  5 ++---
>  gcc/dwarf2out.h               |  4 ++--
>  gcc/final.c                   |  4 ++--
>  gcc/function.c                |  8 ++++----
>  gcc/graphite-scop-detection.c |  8 ++++----
>  gcc/haifa-sched.c             |  2 +-
>  gcc/ipa-devirt.c              |  4 ++--
>  gcc/ipa-split.c               |  8 ++++----
>  gcc/recog.c                   |  4 ++--
>  gcc/ree.c                     |  8 ++++----
>  gcc/stmt.c                    |  1 -
>  gcc/tree-data-ref.c           |  4 ++--
>  gcc/tree-ssa-dom.c            |  4 ++--
>  gcc/tree-ssa-loop-ivopts.c    |  4 ++--
>  gcc/varasm.c                  | 12 ++++++------
>  17 files changed, 42 insertions(+), 46 deletions(-)
>
> diff --git a/gcc/bt-load.c b/gcc/bt-load.c
> index 031b95d..5d8b752 100644
> --- a/gcc/bt-load.c
> +++ b/gcc/bt-load.c
> @@ -404,13 +404,13 @@ note_other_use_this_block (unsigned int regno, btr_user users_this_bb)
>        user->other_use_this_block = 1;
>  }
>
> -typedef struct {
> +struct defs_uses_info {
>    btr_user users_this_bb;
>    HARD_REG_SET btrs_written_in_block;
>    HARD_REG_SET btrs_live_in_block;
>    sbitmap bb_gen;
>    sbitmap *btr_defset;
> -} defs_uses_info;
> +};
>
>  /* Called via note_stores or directly to register stores into /
>     clobbers of a branch target register DEST that are not recognized as
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 9476896..6607b11 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -39,7 +39,7 @@ enum symtab_type
>  /* Section names are stored as reference counted strings in GGC safe hashtable
>     (to make them survive through PCH).  */
>
> -struct GTY((for_user)) section_hash_entry_d
> +struct GTY((for_user)) section_hash_entry
>  {
>    int ref_count;
>    char *name;  /* As long as this datastructure stays in GGC, we can not put
> @@ -47,8 +47,6 @@ struct GTY((for_user)) section_hash_entry_d
>                   way  */
>  };
>
> -typedef struct section_hash_entry_d section_hash_entry;
> -
>  struct section_name_hasher : ggc_ptr_hash<section_hash_entry>
>  {
>    typedef const char *compare_type;
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index 2c7dc71..3a245be 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -1258,7 +1258,7 @@ enum ate_kind {
>    ate_kind_label
>  };
>
> -typedef struct GTY((for_user)) addr_table_entry_struct {
> +struct GTY((for_user)) addr_table_entry {
>    enum ate_kind kind;
>    unsigned int refcount;
>    unsigned int index;
> @@ -1268,8 +1268,7 @@ typedef struct GTY((for_user)) addr_table_entry_struct {
>        char * GTY ((tag ("1"))) label;
>      }
>    GTY ((desc ("%1.kind"))) addr;
> -}
> -addr_table_entry;
> +};
>
>  /* Location lists are ranges + location descriptions for that range,
>     so you can track variables that are in different places over
> diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
> index 7777251..4fe3527 100644
> --- a/gcc/dwarf2out.h
> +++ b/gcc/dwarf2out.h
> @@ -161,14 +161,14 @@ struct GTY(()) dw_vec_const {
>    unsigned elt_size;
>  };
>
> -struct addr_table_entry_struct;
> +struct addr_table_entry;
>
>  /* The dw_val_node describes an attribute's value, as it is
>     represented internally.  */
>
>  struct GTY(()) dw_val_node {
>    enum dw_val_class val_class;
> -  struct addr_table_entry_struct * GTY(()) val_entry;
> +  struct addr_table_entry * GTY(()) val_entry;
>    union dw_val_struct_union
>      {
>        rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
> diff --git a/gcc/final.c b/gcc/final.c
> index 5d91609..f01f4fc 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -1518,14 +1518,14 @@ asm_str_count (const char *templ)
>  /* Structure recording the mapping from source file and directory
>     names at compile time to those to be embedded in debug
>     information.  */
> -typedef struct debug_prefix_map
> +struct debug_prefix_map
>  {
>    const char *old_prefix;
>    const char *new_prefix;
>    size_t old_len;
>    size_t new_len;
>    struct debug_prefix_map *next;
> -} debug_prefix_map;
> +};
>
>  /* Linked list of such structures.  */
>  static debug_prefix_map *debug_prefix_maps;
> diff --git a/gcc/function.c b/gcc/function.c
> index 20bf3b3..53dcba9 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -1224,18 +1224,18 @@ init_temp_slots (void)
>
>  /* Private type used by get_hard_reg_initial_reg, get_hard_reg_initial_val,
>     and has_hard_reg_initial_val..  */
> -typedef struct GTY(()) initial_value_pair {
> +struct GTY(()) initial_value_pair {
>    rtx hard_reg;
>    rtx pseudo;
> -} initial_value_pair;
> +};
>  /* ???  This could be a VEC but there is currently no way to define an
>     opaque VEC type.  This could be worked around by defining struct
>     initial_value_pair in function.h.  */
> -typedef struct GTY(()) initial_value_struct {
> +struct GTY(()) initial_value_struct {
>    int num_entries;
>    int max_entries;
>    initial_value_pair * GTY ((length ("%h.num_entries"))) entries;
> -} initial_value_struct;
> +};
>
>  /* If a pseudo represents an initial hard reg (or expression), return
>     it, else return NULL_RTX.  */
> diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
> index fb7247e..b2a4aaf 100644
> --- a/gcc/graphite-scop-detection.c
> +++ b/gcc/graphite-scop-detection.c
> @@ -58,7 +58,7 @@ static void make_close_phi_nodes_unique (basic_block);
>
>  /* The type of the analyzed basic block.  */
>
> -typedef enum gbb_type {
> +enum gbb_type {
>    GBB_UNKNOWN,
>    GBB_LOOP_SING_EXIT_HEADER,
>    GBB_LOOP_MULT_EXIT_HEADER,
> @@ -66,7 +66,7 @@ typedef enum gbb_type {
>    GBB_COND_HEADER,
>    GBB_SIMPLE,
>    GBB_LAST
> -} gbb_type;
> +};
>
>  /* Detect the type of BB.  Loop headers are only marked, if they are
>     new.  This means their loop_father is different to LAST_LOOP.
> @@ -128,7 +128,7 @@ get_bb_type (basic_block bb, struct loop *last_loop)
>       9 <- exit  */
>
>
> -typedef struct sd_region_p
> +struct sd_region
>  {
>    /* The entry bb dominates all bbs in the sd_region.  It is part of
>       the region.  */
> @@ -137,7 +137,7 @@ typedef struct sd_region_p
>    /* The exit bb postdominates all bbs in the sd_region, but is not
>       part of the region.  */
>    basic_block exit;
> -} sd_region;
> +};
>
>
>
> diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
> index 0912606..c35d777 100644
> --- a/gcc/haifa-sched.c
> +++ b/gcc/haifa-sched.c
> @@ -2569,7 +2569,7 @@ static const char *rfs_str[RFS_N] = {
>    "RFS_DEP_COUNT", "RFS_TIE", "RFS_FUSION" };
>
>  /* Statistical breakdown of rank_for_schedule decisions.  */
> -typedef struct { unsigned stats[RFS_N]; } rank_for_schedule_stats_t;
> +struct rank_for_schedule_stats_t { unsigned stats[RFS_N]; };
>  static rank_for_schedule_stats_t rank_for_schedule_stats;
>
>  /* Return the result of comparing insns TMP and TMP2 and update
> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
> index 0a92768..3eb2456 100644
> --- a/gcc/ipa-devirt.c
> +++ b/gcc/ipa-devirt.c
> @@ -145,11 +145,11 @@ along with GCC; see the file COPYING3.  If not see
>  #include "lto-streamer.h"
>
>  /* Hash based set of pairs of types.  */
> -typedef struct
> +struct type_pair
>  {
>    tree first;
>    tree second;
> -} type_pair;
> +};
>
>  template <>
>  struct default_hash_traits <type_pair> : typed_noop_remove <type_pair>
> diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
> index 69f293f..8bb3e60 100644
> --- a/gcc/ipa-split.c
> +++ b/gcc/ipa-split.c
> @@ -122,11 +122,11 @@ along with GCC; see the file COPYING3.  If not see
>
>  /* Per basic block info.  */
>
> -typedef struct
> +struct split_bb_info
>  {
>    unsigned int size;
>    unsigned int time;
> -} split_bb_info;
> +};
>
>  static vec<split_bb_info> bb_info_vec;
>
> @@ -1008,7 +1008,7 @@ visit_bb (basic_block bb, basic_block return_bb,
>
>  /* Stack entry for recursive DFS walk in find_split_point.  */
>
> -typedef struct
> +struct stack_entry
>  {
>    /* Basic block we are examining.  */
>    basic_block bb;
> @@ -1034,7 +1034,7 @@ typedef struct
>
>    /* When false we can not split on this BB.  */
>    bool can_split;
> -} stack_entry;
> +};
>
>
>  /* Find all articulations and call consider_split on them.
> diff --git a/gcc/recog.c b/gcc/recog.c
> index 120f7b9..c595bbd 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -188,14 +188,14 @@ check_asm_operands (rtx x)
>
>  /* Static data for the next two routines.  */
>
> -typedef struct change_t
> +struct change_t
>  {
>    rtx object;
>    int old_code;
>    rtx *loc;
>    rtx old;
>    bool unshare;
> -} change_t;
> +};
>
>  static change_t *changes;
>  static int changes_allocated;
> diff --git a/gcc/ree.c b/gcc/ree.c
> index 016659c..6156eec 100644
> --- a/gcc/ree.c
> +++ b/gcc/ree.c
> @@ -249,7 +249,7 @@ along with GCC; see the file COPYING3.  If not see
>
>  /* This structure represents a candidate for elimination.  */
>
> -typedef struct ext_cand
> +struct ext_cand
>  {
>    /* The expression.  */
>    const_rtx expr;
> @@ -262,7 +262,7 @@ typedef struct ext_cand
>
>    /* The instruction where it lives.  */
>    rtx_insn *insn;
> -} ext_cand;
> +};
>
>
>  static int max_insn_uid;
> @@ -565,7 +565,7 @@ struct ATTRIBUTE_PACKED ext_modified
>  };
>
>  /* Vectors used by combine_reaching_defs and its helpers.  */
> -typedef struct ext_state
> +struct ext_state
>  {
>    /* In order to avoid constant alloc/free, we keep these
>       4 vectors live through the entire find_and_remove_re and just
> @@ -579,7 +579,7 @@ typedef struct ext_state
>       the original mode from which the insn is extending and
>       kind of extension.  */
>    struct ext_modified *modified;
> -} ext_state;
> +};
>
>  /* Reaching Definitions of the extended register could be conditional copies
>     or regular definitions.  This function separates the two types into two
> diff --git a/gcc/stmt.c b/gcc/stmt.c
> index 391686c..8c49fd2 100644
> --- a/gcc/stmt.c
> +++ b/gcc/stmt.c
> @@ -106,7 +106,6 @@ struct case_node
>    int                   subtree_prob;
>  };
>
> -typedef struct case_node case_node;
>  typedef struct case_node *case_node_ptr;
>
>  extern basic_block label_to_block_fn (struct function *, tree);
> diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
> index d0b7aa2..ebf9dd2 100644
> --- a/gcc/tree-data-ref.c
> +++ b/gcc/tree-data-ref.c
> @@ -3798,14 +3798,14 @@ compute_all_dependences (vec<data_reference_p> datarefs,
>
>  /* Describes a location of a memory reference.  */
>
> -typedef struct data_ref_loc_d
> +struct data_ref_loc
>  {
>    /* The memory reference.  */
>    tree ref;
>
>    /* True if the memory reference is read.  */
>    bool is_read;
> -} data_ref_loc;
> +};
>
>
>  /* Stores the locations of memory references in STMT to REFERENCES.  Returns
> diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
> index 3eb003c..248b037 100644
> --- a/gcc/tree-ssa-dom.c
> +++ b/gcc/tree-ssa-dom.c
> @@ -85,11 +85,11 @@ struct hashable_expr
>  /* Structure for recording known values of a conditional expression
>     at the exits from its block.  */
>
> -typedef struct cond_equivalence_s
> +struct cond_equivalence
>  {
>    struct hashable_expr cond;
>    tree value;
> -} cond_equivalence;
> +};
>
>
>  /* Structure for recording edge equivalences as well as any pending
> diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
> index 6bce3a1..723a9f7 100644
> --- a/gcc/tree-ssa-loop-ivopts.c
> +++ b/gcc/tree-ssa-loop-ivopts.c
> @@ -169,14 +169,14 @@ enum use_type
>  };
>
>  /* Cost of a computation.  */
> -typedef struct
> +struct comp_cost
>  {
>    int cost;            /* The runtime cost.  */
>    unsigned complexity; /* The estimate of the complexity of the code for
>                            the computation (in no concrete units --
>                            complexity field should be larger for more
>                            complex expressions and addressing modes).  */
> -} comp_cost;
> +};
>
>  static const comp_cost no_cost = {0, 0};
>  static const comp_cost infinite_cost = {INFTY, INFTY};
> diff --git a/gcc/varasm.c b/gcc/varasm.c
> index 6a4ba0b..2ebac89 100644
> --- a/gcc/varasm.c
> +++ b/gcc/varasm.c
> @@ -4640,10 +4640,10 @@ initializer_constant_valid_for_bitfield_p (tree value)
>  /* output_constructor outer state of relevance in recursive calls, typically
>     for nested aggregate bitfields.  */
>
> -typedef struct {
> +struct oc_outer_state {
>    unsigned int bit_offset;  /* current position in ...  */
>    int byte;                 /* ... the outer byte buffer.  */
> -} oc_outer_state;
> +};
>
>  static unsigned HOST_WIDE_INT
>    output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int,
> @@ -4883,7 +4883,7 @@ array_size_for_constructor (tree val)
>
>  /* output_constructor local state to support interaction with helpers.  */
>
> -typedef struct {
> +struct oc_local_state {
>
>    /* Received arguments.  */
>    tree exp;                     /* Constructor expression.  */
> @@ -4904,7 +4904,7 @@ typedef struct {
>    tree val;        /* Current element value.  */
>    tree index;      /* Current element index.  */
>
> -} oc_local_state;
> +};
>
>  /* Helper for output_constructor.  From the current LOCAL state, output a
>     RANGE_EXPR element.  */
> @@ -5829,12 +5829,12 @@ get_tm_clone_pair (tree o)
>    return NULL_TREE;
>  }
>
> -typedef struct tm_alias_pair
> +struct tm_alias_pair
>  {
>    unsigned int uid;
>    tree from;
>    tree to;
> -} tm_alias_pair;
> +};
>
>
>  /* Dump the actual pairs to the .tm_clone_table section.  */
> --
> 2.4.0
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]