diff mbox series

Replace PTR with 'void *' in compiler.

Message ID 876b42c5-7459-57f5-63f5-ece34c295cd1@suse.cz
State New
Headers show
Series Replace PTR with 'void *' in compiler. | expand

Commit Message

Martin Liška May 10, 2022, 8:56 a.m. UTC
Similarly in GCC itself. I've built all FEs with the patch.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ada/ChangeLog:

	* gcc-interface/decl.cc (compare_field_bitpos): Use void *
	instead PTR.
	* gcc-interface/utils2.cc (compare_elmt_bitpos): Likewise.

gcc/ChangeLog:

	* basic-block.h (struct basic_block_d): Use void *
	instead PTR.
	* cfgloop.h: Likewise.
	* cgraph.h: Likewise.
	* gengtype-state.cc (state_ident_by_name): Likewise.
	(record_type): Likewise.
	(read_state_already_seen_type): Likewise.
	* gengtype.cc (dump_type): Likewise.
	(input_file_by_name): Likewise.
	(main): Likewise.
	* ggc-common.cc (ggc_cleared_alloc_ptr_array_two_args): Likewise.
	* ipa-utils.h (struct ipa_dfs_info): Likewise.
	* plugin.cc (htab_hash_plugin): Likewise.
---
 gcc/ada/gcc-interface/decl.cc   | 4 ++--
 gcc/ada/gcc-interface/utils2.cc | 2 +-
 gcc/basic-block.h               | 4 ++--
 gcc/cfgloop.h                   | 2 +-
 gcc/cgraph.h                    | 4 ++--
 gcc/gengtype-state.cc           | 6 +++---
 gcc/gengtype.cc                 | 6 +++---
 gcc/ggc-common.cc               | 4 ++--
 gcc/ipa-utils.h                 | 2 +-
 gcc/plugin.cc                   | 2 +-
 10 files changed, 18 insertions(+), 18 deletions(-)

Comments

Richard Biener May 10, 2022, 10:07 a.m. UTC | #1
On Tue, May 10, 2022 at 11:38 AM Martin Liška <mliska@suse.cz> wrote:
>
> Similarly in GCC itself. I've built all FEs with the patch.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?

OK for the middle-end parts.

Richard.

> Thanks,
> Martin
>
> gcc/ada/ChangeLog:
>
>         * gcc-interface/decl.cc (compare_field_bitpos): Use void *
>         instead PTR.
>         * gcc-interface/utils2.cc (compare_elmt_bitpos): Likewise.
>
> gcc/ChangeLog:
>
>         * basic-block.h (struct basic_block_d): Use void *
>         instead PTR.
>         * cfgloop.h: Likewise.
>         * cgraph.h: Likewise.
>         * gengtype-state.cc (state_ident_by_name): Likewise.
>         (record_type): Likewise.
>         (read_state_already_seen_type): Likewise.
>         * gengtype.cc (dump_type): Likewise.
>         (input_file_by_name): Likewise.
>         (main): Likewise.
>         * ggc-common.cc (ggc_cleared_alloc_ptr_array_two_args): Likewise.
>         * ipa-utils.h (struct ipa_dfs_info): Likewise.
>         * plugin.cc (htab_hash_plugin): Likewise.
> ---
>  gcc/ada/gcc-interface/decl.cc   | 4 ++--
>  gcc/ada/gcc-interface/utils2.cc | 2 +-
>  gcc/basic-block.h               | 4 ++--
>  gcc/cfgloop.h                   | 2 +-
>  gcc/cgraph.h                    | 4 ++--
>  gcc/gengtype-state.cc           | 6 +++---
>  gcc/gengtype.cc                 | 6 +++---
>  gcc/ggc-common.cc               | 4 ++--
>  gcc/ipa-utils.h                 | 2 +-
>  gcc/plugin.cc                   | 2 +-
>  10 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
> index 1c7a716840e..d52c4fb3623 100644
> --- a/gcc/ada/gcc-interface/decl.cc
> +++ b/gcc/ada/gcc-interface/decl.cc
> @@ -224,7 +224,7 @@ static bool constructor_address_p (tree);
>  static bool allocatable_size_p (tree, bool);
>  static bool initial_value_needs_conversion (tree, tree);
>  static tree update_n_elem (tree, tree, tree);
> -static int compare_field_bitpos (const PTR, const PTR);
> +static int compare_field_bitpos (const void *, const void *);
>  static bool components_to_record (Node_Id, Entity_Id, tree, tree, int, bool,
>                                   bool, bool, bool, bool, bool, bool, tree,
>                                   tree *);
> @@ -7712,7 +7712,7 @@ field_has_variable_size (tree field)
>  /* qsort comparer for the bit positions of two record components.  */
>
>  static int
> -compare_field_bitpos (const PTR rt1, const PTR rt2)
> +compare_field_bitpos (const void *rt1, const void *rt2)
>  {
>    const_tree const field1 = * (const_tree const *) rt1;
>    const_tree const field2 = * (const_tree const *) rt2;
> diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
> index e5cd85662b9..76622da8081 100644
> --- a/gcc/ada/gcc-interface/utils2.cc
> +++ b/gcc/ada/gcc-interface/utils2.cc
> @@ -1936,7 +1936,7 @@ build_call_raise_range (int msg, Node_Id gnat_node, char kind,
>     for record components.  */
>
>  static int
> -compare_elmt_bitpos (const PTR rt1, const PTR rt2)
> +compare_elmt_bitpos (const void *rt1, const void *rt2)
>  {
>    const constructor_elt * const elmt1 = (const constructor_elt *) rt1;
>    const constructor_elt * const elmt2 = (const constructor_elt *) rt2;
> diff --git a/gcc/basic-block.h b/gcc/basic-block.h
> index 21a9b24dbf9..c9d1fc91bbb 100644
> --- a/gcc/basic-block.h
> +++ b/gcc/basic-block.h
> @@ -36,7 +36,7 @@ public:
>    } insns;
>
>    /* Auxiliary info specific to a pass.  */
> -  PTR aux;
> +  void *aux;
>
>    /* Location of any goto implicit in the edge.  */
>    location_t goto_locus;
> @@ -120,7 +120,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
>    vec<edge, va_gc> *succs;
>
>    /* Auxiliary info specific to a pass.  */
> -  PTR GTY ((skip (""))) aux;
> +  void *GTY ((skip (""))) aux;
>
>    /* Innermost loop containing the block.  */
>    class loop *loop_father;
> diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
> index d2714e20cb0..528b1219bc3 100644
> --- a/gcc/cfgloop.h
> +++ b/gcc/cfgloop.h
> @@ -148,7 +148,7 @@ public:
>    class loop *next;
>
>    /* Auxiliary info specific to a pass.  */
> -  PTR GTY ((skip (""))) aux;
> +  void *GTY ((skip (""))) aux;
>
>    /* The number of times the latch of the loop is executed.  This can be an
>       INTEGER_CST, or a symbolic expression representing the number of
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 8c512b648ee..4be67e3cea9 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -628,7 +628,7 @@ public:
>    /* File stream where this node is being written to.  */
>    struct lto_file_decl_data * lto_file_data;
>
> -  PTR GTY ((skip)) aux;
> +  void *GTY ((skip)) aux;
>
>    /* Comdat group the symbol is in.  Can be private if GGC allowed that.  */
>    tree x_comdat_group;
> @@ -1895,7 +1895,7 @@ public:
>    /* Additional information about an indirect call.  Not cleared when an edge
>       becomes direct.  */
>    cgraph_indirect_call_info *indirect_info;
> -  PTR GTY ((skip (""))) aux;
> +  void *GTY ((skip (""))) aux;
>    /* When equal to CIF_OK, inline this call.  Otherwise, points to the
>       explanation why function was not inlined.  */
>    enum cgraph_inline_failed_t inline_failed;
> diff --git a/gcc/gengtype-state.cc b/gcc/gengtype-state.cc
> index dfd9ea52785..2c7f642cd3d 100644
> --- a/gcc/gengtype-state.cc
> +++ b/gcc/gengtype-state.cc
> @@ -313,7 +313,7 @@ fatal_reading_state (struct state_token_st* tok, const char*msg)
>  static struct state_ident_st *
>  state_ident_by_name (const char *name, enum insert_option optins)
>  {
> -  PTR *slot = NULL;
> +  void **slot = NULL;
>    int namlen = 0;
>    struct state_ident_st *stid = NULL;
>
> @@ -1435,7 +1435,7 @@ static void read_state_common_type_content (type_p current);
>  static void
>  record_type (type_p type)
>  {
> -  PTR *slot;
> +  void **slot;
>
>    slot = htab_find_slot (state_seen_types, type, INSERT);
>    gcc_assert (slot);
> @@ -1451,7 +1451,7 @@ read_state_already_seen_type (type_p *type)
>
>    if (state_token_kind (t0) == STOK_INTEGER)
>      {
> -      PTR *slot = NULL;
> +      void **slot = NULL;
>        struct type loctype = { TYPE_SCALAR, 0, 0, 0, GC_UNUSED, {0} };
>
>        loctype.state_number = t0->stok_un.stok_num;
> diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
> index 793ebd70906..e11da9e46d0 100644
> --- a/gcc/gengtype.cc
> +++ b/gcc/gengtype.cc
> @@ -4869,7 +4869,7 @@ static htab_t seen_types;
>  static void
>  dump_type (int indent, type_p t)
>  {
> -  PTR *slot;
> +  void **slot;
>
>    printf ("%*cType at %p: ", indent, ' ', (void *) t);
>    if (t->kind == TYPE_UNDEFINED)
> @@ -5118,7 +5118,7 @@ static htab_t input_file_htab;
>  input_file*
>  input_file_by_name (const char* name)
>  {
> -  PTR* slot;
> +  void ** slot;
>    input_file* f = NULL;
>    int namlen = 0;
>    if (!name)
> @@ -5227,7 +5227,7 @@ main (int argc, char **argv)
>        POS_HERE (do_scalar_typedef ("machine_mode", &pos));
>        POS_HERE (do_scalar_typedef ("fixed_size_mode", &pos));
>        POS_HERE (do_scalar_typedef ("CONSTEXPR", &pos));
> -      POS_HERE (do_typedef ("PTR",
> +      POS_HERE (do_typedef ("void *",
>                             create_pointer (resolve_typedef ("void", &pos)),
>                             &pos));
>  #undef POS_HERE
> diff --git a/gcc/ggc-common.cc b/gcc/ggc-common.cc
> index 9d737d079aa..8b3389e8760 100644
> --- a/gcc/ggc-common.cc
> +++ b/gcc/ggc-common.cc
> @@ -175,8 +175,8 @@ ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
>  void *
>  ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
>  {
> -  gcc_assert (sizeof (PTR *) == n);
> -  return ggc_cleared_vec_alloc<PTR *> (c);
> +  gcc_assert (sizeof (void **) == n);
> +  return ggc_cleared_vec_alloc<void **> (c);
>  }
>
>  /* These are for splay_tree_new_ggc.  */
> diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
> index dc6ba0d52cb..3ca058c0b56 100644
> --- a/gcc/ipa-utils.h
> +++ b/gcc/ipa-utils.h
> @@ -30,7 +30,7 @@ struct ipa_dfs_info {
>    bool new_node;
>    bool on_stack;
>    struct cgraph_node* next_cycle;
> -  PTR aux;
> +  void *aux;
>  };
>
>
> diff --git a/gcc/plugin.cc b/gcc/plugin.cc
> index cbe4b7eff60..17b33e463a9 100644
> --- a/gcc/plugin.cc
> +++ b/gcc/plugin.cc
> @@ -128,7 +128,7 @@ static const char *str_license = "plugin_is_GPL_compatible";
>     structure to be inserted into the hash table.  */
>
>  static hashval_t
> -htab_hash_plugin (const PTR p)
> +htab_hash_plugin (const void *p)
>  {
>    const struct plugin_name_args *plugin = (const struct plugin_name_args *) p;
>    return htab_hash_string (plugin->base_name);
> --
> 2.36.0
>
Arnaud Charlet May 10, 2022, 10:23 a.m. UTC | #2
> > Similarly in GCC itself. I've built all FEs with the patch.
> >
> > Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >
> > Ready to be installed?
> 
> OK for the middle-end parts.

and OK for the Ada parts.
diff mbox series

Patch

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 1c7a716840e..d52c4fb3623 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -224,7 +224,7 @@  static bool constructor_address_p (tree);
 static bool allocatable_size_p (tree, bool);
 static bool initial_value_needs_conversion (tree, tree);
 static tree update_n_elem (tree, tree, tree);
-static int compare_field_bitpos (const PTR, const PTR);
+static int compare_field_bitpos (const void *, const void *);
 static bool components_to_record (Node_Id, Entity_Id, tree, tree, int, bool,
 				  bool, bool, bool, bool, bool, bool, tree,
 				  tree *);
@@ -7712,7 +7712,7 @@  field_has_variable_size (tree field)
 /* qsort comparer for the bit positions of two record components.  */
 
 static int
-compare_field_bitpos (const PTR rt1, const PTR rt2)
+compare_field_bitpos (const void *rt1, const void *rt2)
 {
   const_tree const field1 = * (const_tree const *) rt1;
   const_tree const field2 = * (const_tree const *) rt2;
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index e5cd85662b9..76622da8081 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -1936,7 +1936,7 @@  build_call_raise_range (int msg, Node_Id gnat_node, char kind,
    for record components.  */
 
 static int
-compare_elmt_bitpos (const PTR rt1, const PTR rt2)
+compare_elmt_bitpos (const void *rt1, const void *rt2)
 {
   const constructor_elt * const elmt1 = (const constructor_elt *) rt1;
   const constructor_elt * const elmt2 = (const constructor_elt *) rt2;
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 21a9b24dbf9..c9d1fc91bbb 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -36,7 +36,7 @@  public:
   } insns;
 
   /* Auxiliary info specific to a pass.  */
-  PTR aux;
+  void *aux;
 
   /* Location of any goto implicit in the edge.  */
   location_t goto_locus;
@@ -120,7 +120,7 @@  struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
   vec<edge, va_gc> *succs;
 
   /* Auxiliary info specific to a pass.  */
-  PTR GTY ((skip (""))) aux;
+  void *GTY ((skip (""))) aux;
 
   /* Innermost loop containing the block.  */
   class loop *loop_father;
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index d2714e20cb0..528b1219bc3 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -148,7 +148,7 @@  public:
   class loop *next;
 
   /* Auxiliary info specific to a pass.  */
-  PTR GTY ((skip (""))) aux;
+  void *GTY ((skip (""))) aux;
 
   /* The number of times the latch of the loop is executed.  This can be an
      INTEGER_CST, or a symbolic expression representing the number of
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 8c512b648ee..4be67e3cea9 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -628,7 +628,7 @@  public:
   /* File stream where this node is being written to.  */
   struct lto_file_decl_data * lto_file_data;
 
-  PTR GTY ((skip)) aux;
+  void *GTY ((skip)) aux;
 
   /* Comdat group the symbol is in.  Can be private if GGC allowed that.  */
   tree x_comdat_group;
@@ -1895,7 +1895,7 @@  public:
   /* Additional information about an indirect call.  Not cleared when an edge
      becomes direct.  */
   cgraph_indirect_call_info *indirect_info;
-  PTR GTY ((skip (""))) aux;
+  void *GTY ((skip (""))) aux;
   /* When equal to CIF_OK, inline this call.  Otherwise, points to the
      explanation why function was not inlined.  */
   enum cgraph_inline_failed_t inline_failed;
diff --git a/gcc/gengtype-state.cc b/gcc/gengtype-state.cc
index dfd9ea52785..2c7f642cd3d 100644
--- a/gcc/gengtype-state.cc
+++ b/gcc/gengtype-state.cc
@@ -313,7 +313,7 @@  fatal_reading_state (struct state_token_st* tok, const char*msg)
 static struct state_ident_st *
 state_ident_by_name (const char *name, enum insert_option optins)
 {
-  PTR *slot = NULL;
+  void **slot = NULL;
   int namlen = 0;
   struct state_ident_st *stid = NULL;
 
@@ -1435,7 +1435,7 @@  static void read_state_common_type_content (type_p current);
 static void
 record_type (type_p type)
 {
-  PTR *slot;
+  void **slot;
 
   slot = htab_find_slot (state_seen_types, type, INSERT);
   gcc_assert (slot);
@@ -1451,7 +1451,7 @@  read_state_already_seen_type (type_p *type)
 
   if (state_token_kind (t0) == STOK_INTEGER)
     {
-      PTR *slot = NULL;
+      void **slot = NULL;
       struct type loctype = { TYPE_SCALAR, 0, 0, 0, GC_UNUSED, {0} };
 
       loctype.state_number = t0->stok_un.stok_num;
diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
index 793ebd70906..e11da9e46d0 100644
--- a/gcc/gengtype.cc
+++ b/gcc/gengtype.cc
@@ -4869,7 +4869,7 @@  static htab_t seen_types;
 static void
 dump_type (int indent, type_p t)
 {
-  PTR *slot;
+  void **slot;
 
   printf ("%*cType at %p: ", indent, ' ', (void *) t);
   if (t->kind == TYPE_UNDEFINED)
@@ -5118,7 +5118,7 @@  static htab_t input_file_htab;
 input_file*
 input_file_by_name (const char* name)
 {
-  PTR* slot;
+  void ** slot;
   input_file* f = NULL;
   int namlen = 0;
   if (!name)
@@ -5227,7 +5227,7 @@  main (int argc, char **argv)
       POS_HERE (do_scalar_typedef ("machine_mode", &pos));
       POS_HERE (do_scalar_typedef ("fixed_size_mode", &pos));
       POS_HERE (do_scalar_typedef ("CONSTEXPR", &pos));
-      POS_HERE (do_typedef ("PTR", 
+      POS_HERE (do_typedef ("void *",
 			    create_pointer (resolve_typedef ("void", &pos)),
 			    &pos));
 #undef POS_HERE
diff --git a/gcc/ggc-common.cc b/gcc/ggc-common.cc
index 9d737d079aa..8b3389e8760 100644
--- a/gcc/ggc-common.cc
+++ b/gcc/ggc-common.cc
@@ -175,8 +175,8 @@  ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
 void *
 ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
 {
-  gcc_assert (sizeof (PTR *) == n);
-  return ggc_cleared_vec_alloc<PTR *> (c);
+  gcc_assert (sizeof (void **) == n);
+  return ggc_cleared_vec_alloc<void **> (c);
 }
 
 /* These are for splay_tree_new_ggc.  */
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index dc6ba0d52cb..3ca058c0b56 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -30,7 +30,7 @@  struct ipa_dfs_info {
   bool new_node;
   bool on_stack;
   struct cgraph_node* next_cycle;
-  PTR aux;
+  void *aux;
 };
 
 
diff --git a/gcc/plugin.cc b/gcc/plugin.cc
index cbe4b7eff60..17b33e463a9 100644
--- a/gcc/plugin.cc
+++ b/gcc/plugin.cc
@@ -128,7 +128,7 @@  static const char *str_license = "plugin_is_GPL_compatible";
    structure to be inserted into the hash table.  */
 
 static hashval_t
-htab_hash_plugin (const PTR p)
+htab_hash_plugin (const void *p)
 {
   const struct plugin_name_args *plugin = (const struct plugin_name_args *) p;
   return htab_hash_string (plugin->base_name);