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]

Silence class vs. struct warnings (opt_pass, ipa_opt_pass_d)


Hi,

When building GCC on OSX with its native XCode/Clang tools, it outputs
quite some "struct X was previously declared as a class" or similar
warnings (-Wmismatched-tags is enabled by default).

The attached patch fixes this for class opt_pass and class
ipa_opt_pass_d by removing the redundant 'struct' tag which seems to be
a leftover from the plain C days.

Tested with make all-gcc.
OK for trunk?

Cheers,
Oleg

gcc/ChangeLog:
	* cgraphunit.c: Remove struct tags when referring to class
	ipa_opt_pass_d or class opt_pass.
	* function.h: Likewise.
	* lto-cgraph.c: Likewise.
	* pass_manager.h: Likewise.
	* passes.c: Likewise.
	* tree-pass.h: Likewise.
Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c	(revision 205573)
+++ gcc/cgraphunit.c	(working copy)
@@ -2019,7 +2019,7 @@
       cgraph_process_new_functions ();
 
       execute_ipa_summary_passes
-	((struct ipa_opt_pass_d *) passes->all_regular_ipa_passes);
+	((ipa_opt_pass_d *) passes->all_regular_ipa_passes);
     }
 
   /* Some targets need to handle LTO assembler output specially.  */
Index: gcc/function.h
===================================================================
--- gcc/function.h	(revision 205573)
+++ gcc/function.h	(working copy)
@@ -167,8 +167,8 @@
 struct call_site_record_d;
 struct dw_fde_struct;
 
-struct ipa_opt_pass_d;
-typedef struct ipa_opt_pass_d *ipa_opt_pass;
+class ipa_opt_pass_d;
+typedef ipa_opt_pass_d *ipa_opt_pass;
 
 
 struct GTY(()) varasm_status {
Index: gcc/lto-cgraph.c
===================================================================
--- gcc/lto-cgraph.c	(revision 205573)
+++ gcc/lto-cgraph.c	(working copy)
@@ -389,7 +389,7 @@
   intptr_t ref;
   bool in_other_partition = false;
   struct cgraph_node *clone_of, *ultimate_clone_of;
-  struct ipa_opt_pass_d *pass;
+  ipa_opt_pass_d *pass;
   int i;
   bool alias_p;
 
@@ -1060,12 +1060,12 @@
   node->ipa_transforms_to_apply = vNULL;
   for (i = 0; i < count; i++)
     {
-      struct opt_pass *pass;
+      opt_pass *pass;
       int pid = streamer_read_hwi (ib);
 
       gcc_assert (pid < passes->passes_by_id_size);
       pass = passes->passes_by_id[pid];
-      node->ipa_transforms_to_apply.safe_push ((struct ipa_opt_pass_d *) pass);
+      node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *) pass);
     }
 
   if (tag == LTO_symtab_analyzed_node)
Index: gcc/pass_manager.h
===================================================================
--- gcc/pass_manager.h	(revision 205573)
+++ gcc/pass_manager.h	(working copy)
@@ -51,7 +51,7 @@
   pass_manager (context *ctxt);
 
   void register_pass (struct register_pass_info *pass_info);
-  void register_one_dump_file (struct opt_pass *pass);
+  void register_one_dump_file (opt_pass *pass);
 
   opt_pass *get_pass_for_id (int id) const;
 
@@ -91,8 +91,8 @@
 
 private:
   void set_pass_for_id (int id, opt_pass *pass);
-  int register_dump_files_1 (struct opt_pass *pass, int properties);
-  void register_dump_files (struct opt_pass *pass, int properties);
+  int register_dump_files_1 (opt_pass *pass, int properties);
+  void register_dump_files (opt_pass *pass, int properties);
 
 private:
   context *m_ctxt;
Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 205573)
+++ gcc/passes.c	(working copy)
@@ -90,9 +90,9 @@
 /* This is used for debugging.  It allows the current pass to printed
    from anywhere in compilation.
    The variable current_pass is also used for statistics and plugins.  */
-struct opt_pass *current_pass;
+opt_pass *current_pass;
 
-static void register_pass_name (struct opt_pass *, const char *);
+static void register_pass_name (opt_pass *, const char *);
 
 /* Most passes are single-instance (within their context) and thus don't
    need to implement cloning, but passes that support multiple instances
@@ -613,12 +613,12 @@
 
 void
 pass_manager::
-set_pass_for_id (int id, struct opt_pass *pass)
+set_pass_for_id (int id, opt_pass *pass)
 {
   pass->static_pass_number = id;
   if (passes_by_id_size <= id)
     {
-      passes_by_id = XRESIZEVEC (struct opt_pass *, passes_by_id, id + 1);
+      passes_by_id = XRESIZEVEC (opt_pass *, passes_by_id, id + 1);
       memset (passes_by_id + passes_by_id_size, 0,
 	      (id + 1 - passes_by_id_size) * sizeof (void *));
       passes_by_id_size = id + 1;
@@ -628,7 +628,7 @@
 
 /* Return the pass with the static pass number ID.  */
 
-struct opt_pass *
+opt_pass *
 pass_manager::get_pass_for_id (int id) const
 {
   if (id >= passes_by_id_size)
@@ -641,13 +641,13 @@
    enabled or not.  */
 
 void
-register_one_dump_file (struct opt_pass *pass)
+register_one_dump_file (opt_pass *pass)
 {
   g->get_passes ()->register_one_dump_file (pass);
 }
 
 void
-pass_manager::register_one_dump_file (struct opt_pass *pass)
+pass_manager::register_one_dump_file (opt_pass *pass)
 {
   char *dot_name, *flag_name, *glob_name;
   const char *name, *full_name, *prefix;
@@ -707,7 +707,7 @@
 
 int
 pass_manager::
-register_dump_files_1 (struct opt_pass *pass, int properties)
+register_dump_files_1 (opt_pass *pass, int properties)
 {
   do
     {
@@ -740,7 +740,7 @@
 
 void
 pass_manager::
-register_dump_files (struct opt_pass *pass,int properties)
+register_dump_files (opt_pass *pass,int properties)
 {
   pass->properties_required |= properties;
   register_dump_files_1 (pass, properties);
@@ -749,7 +749,7 @@
 struct pass_registry
 {
   const char* unique_name;
-  struct opt_pass *pass;
+  opt_pass *pass;
 };
 
 /* Helper for pass_registry hash table.  */
@@ -783,7 +783,7 @@
 /* Register PASS with NAME.  */
 
 static void
-register_pass_name (struct opt_pass *pass, const char *name)
+register_pass_name (opt_pass *pass, const char *name)
 {
   struct pass_registry **slot;
   struct pass_registry pr;
@@ -816,7 +816,7 @@
 int
 passes_pass_traverse (pass_registry **p, void *data ATTRIBUTE_UNUSED)
 {
-  struct opt_pass *pass = (*p)->pass;
+  opt_pass *pass = (*p)->pass;
 
   gcc_assert (pass->static_pass_number > 0);
   gcc_assert (pass_tab.exists ());
@@ -839,13 +839,13 @@
   name_to_pass_map.traverse <void *, passes_pass_traverse> (NULL);
 }
 
-static bool override_gate_status (struct opt_pass *, tree, bool);
+static bool override_gate_status (opt_pass *, tree, bool);
 
 /* Dump the instantiated name for PASS. IS_ON indicates if PASS
    is turned on or not.  */
 
 static void
-dump_one_pass (struct opt_pass *pass, int pass_indent)
+dump_one_pass (opt_pass *pass, int pass_indent)
 {
   int indent = 3 * pass_indent;
   const char *pn;
@@ -869,7 +869,7 @@
 /* Dump pass list PASS with indentation INDENT.  */
 
 static void
-dump_pass_list (struct opt_pass *pass, int indent)
+dump_pass_list (opt_pass *pass, int indent)
 {
   do
     {
@@ -920,7 +920,7 @@
 
 /* Returns the pass with NAME.  */
 
-static struct opt_pass *
+static opt_pass *
 get_pass_by_name (const char *name)
 {
   struct pass_registry **slot, pr;
@@ -967,7 +967,7 @@
 static void
 enable_disable_pass (const char *arg, bool is_enable)
 {
-  struct opt_pass *pass;
+  opt_pass *pass;
   char *range_str, *phase_name;
   char *argstr = xstrdup (arg);
   vec<uid_range_p> *tab = 0;
@@ -1150,7 +1150,7 @@
 /* Returns true if PASS is explicitly enabled/disabled for FUNC.  */
 
 static bool
-is_pass_explicitly_enabled_or_disabled (struct opt_pass *pass,
+is_pass_explicitly_enabled_or_disabled (opt_pass *pass,
 					tree func,
 					vec<uid_range_p> tab)
 {
@@ -1216,7 +1216,7 @@
      (TDI_end + current value of extra_dump_files_in_use) )  */
 
 static void
-add_pass_instance (struct opt_pass *new_pass, bool track_duplicates,
+add_pass_instance (opt_pass *new_pass, bool track_duplicates,
 		   opt_pass *initial_pass)
 {
   /* Are we dealing with the first pass of its kind, or a clone?  */
@@ -1248,9 +1248,8 @@
 /* Add a pass to the pass list. Duplicate the pass if it's already
    in the list.  */
 
-static struct opt_pass **
-next_pass_1 (struct opt_pass **list, struct opt_pass *pass,
-	     struct opt_pass *initial_pass)
+static opt_pass **
+next_pass_1 (opt_pass **list, opt_pass *pass, opt_pass *initial_pass)
 {
   /* Every pass should have a name so that plugins can refer to them.  */
   gcc_assert (pass->name != NULL);
@@ -1270,7 +1269,7 @@
 
 struct pass_list_node
 {
-  struct opt_pass *pass;
+  opt_pass *pass;
   struct pass_list_node *next;
 };
 
@@ -1284,10 +1283,9 @@
    PASS_LIST - root of the pass list to insert the new pass to  */
 
 static bool
-position_pass (struct register_pass_info *new_pass_info,
-               struct opt_pass **pass_list)
+position_pass (struct register_pass_info *new_pass_info, opt_pass **pass_list)
 {
-  struct opt_pass *pass = *pass_list, *prev_pass = NULL;
+  opt_pass *pass = *pass_list, *prev_pass = NULL;
   bool success = false;
 
   for ( ; pass; prev_pass = pass, pass = pass->next)
@@ -1303,7 +1301,7 @@
               || (new_pass_info->ref_pass_instance_number == 1
                   && pass->todo_flags_start & TODO_mark_first_instance)))
         {
-          struct opt_pass *new_pass;
+          opt_pass *new_pass;
           struct pass_list_node *new_pass_node;
 
 	  if (new_pass_info->ref_pass_instance_number == 0)
@@ -1503,7 +1501,7 @@
   all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0),
   m_ctxt (ctxt)
 {
-  struct opt_pass **p;
+  opt_pass **p;
 
   /* Initialize the pass_lists array.  */
 #define DEF_PASS_LIST(LIST) pass_lists[PASS_LIST_NO_##LIST] = &LIST;
@@ -1517,7 +1515,7 @@
 
 #define PUSH_INSERT_PASSES_WITHIN(PASS) \
   { \
-    struct opt_pass **p = &(PASS ## _1)->sub;
+    opt_pass **p = &(PASS ## _1)->sub;
 
 #define POP_INSERT_PASSES() \
   }
@@ -1936,7 +1934,7 @@
 /* This is non-static so that the plugins can use it.  */
 
 bool
-pass_init_dump_file (struct opt_pass *pass)
+pass_init_dump_file (opt_pass *pass)
 {
   /* If a dump file name is present, open it if enabled.  */
   if (pass->static_pass_number != -1)
@@ -1964,7 +1962,7 @@
 /* This is non-static so that plugins can use it.  */
 
 void
-pass_fini_dump_file (struct opt_pass *pass)
+pass_fini_dump_file (opt_pass *pass)
 {
   timevar_push (TV_DUMP);
 
@@ -1985,7 +1983,7 @@
 static void
 update_properties_after_pass (void *data)
 {
-  struct opt_pass *pass = (struct opt_pass *) data;
+  opt_pass *pass = (opt_pass *) data;
   cfun->curr_properties = (cfun->curr_properties | pass->properties_provided)
 		           & ~pass->properties_destroyed;
 }
@@ -1993,11 +1991,11 @@
 /* Execute summary generation for all of the passes in IPA_PASS.  */
 
 void
-execute_ipa_summary_passes (struct ipa_opt_pass_d *ipa_pass)
+execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
 {
   while (ipa_pass)
     {
-      struct opt_pass *pass = ipa_pass;
+      opt_pass *pass = ipa_pass;
 
       /* Execute all of the IPA_PASSes in the list.  */
       if (ipa_pass->type == IPA_PASS
@@ -2018,7 +2016,7 @@
 
 	  pass_fini_dump_file (pass);
 	}
-      ipa_pass = (struct ipa_opt_pass_d *)ipa_pass->next;
+      ipa_pass = (ipa_opt_pass_d *)ipa_pass->next;
     }
 }
 
@@ -2026,9 +2024,9 @@
 
 static void
 execute_one_ipa_transform_pass (struct cgraph_node *node,
-				struct ipa_opt_pass_d *ipa_pass)
+				ipa_opt_pass_d *ipa_pass)
 {
-  struct opt_pass *pass = ipa_pass;
+  opt_pass *pass = ipa_pass;
   unsigned int todo_after = 0;
 
   current_pass = pass;
@@ -2115,7 +2113,7 @@
    default.  */
 
 static bool
-override_gate_status (struct opt_pass *pass, tree func, bool gate_status)
+override_gate_status (opt_pass *pass, tree func, bool gate_status)
 {
   bool explicitly_enabled = false;
   bool explicitly_disabled = false;
@@ -2136,7 +2134,7 @@
 /* Execute PASS. */
 
 bool
-execute_one_pass (struct opt_pass *pass)
+execute_one_pass (opt_pass *pass)
 {
   unsigned int todo_after = 0;
 
@@ -2237,7 +2235,7 @@
     {
       struct cgraph_node *node;
       FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
-	node->ipa_transforms_to_apply.safe_push ((struct ipa_opt_pass_d *)pass);
+	node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass);
     }
 
   if (!current_function_decl)
@@ -2259,7 +2257,7 @@
 }
 
 void
-execute_pass_list (struct opt_pass *pass)
+execute_pass_list (opt_pass *pass)
 {
   do
     {
@@ -2289,11 +2287,11 @@
    those node in SET. */
 
 static void
-ipa_write_summaries_2 (struct opt_pass *pass, struct lto_out_decl_state *state)
+ipa_write_summaries_2 (opt_pass *pass, struct lto_out_decl_state *state)
 {
   while (pass)
     {
-      struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass;
+      ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass;
       gcc_assert (!current_function_decl);
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
@@ -2406,11 +2404,12 @@
    only those node in SET. */
 
 static void
-ipa_write_optimization_summaries_1 (struct opt_pass *pass, struct lto_out_decl_state *state)
+ipa_write_optimization_summaries_1 (opt_pass *pass,
+				    struct lto_out_decl_state *state)
 {
   while (pass)
     {
-      struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *)pass;
+      ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *)pass;
       gcc_assert (!current_function_decl);
       gcc_assert (!cfun);
       gcc_assert (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS);
@@ -2484,11 +2483,11 @@
    are local passes.  */
 
 static void
-ipa_read_summaries_1 (struct opt_pass *pass)
+ipa_read_summaries_1 (opt_pass *pass)
 {
   while (pass)
     {
-      struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass;
+      ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
 
       gcc_assert (!current_function_decl);
       gcc_assert (!cfun);
@@ -2534,11 +2533,11 @@
    are local passes.  */
 
 static void
-ipa_read_optimization_summaries_1 (struct opt_pass *pass)
+ipa_read_optimization_summaries_1 (opt_pass *pass)
 {
   while (pass)
     {
-      struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass;
+      ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
 
       gcc_assert (!current_function_decl);
       gcc_assert (!cfun);
@@ -2582,7 +2581,7 @@
 /* Same as execute_pass_list but assume that subpasses of IPA passes
    are local passes.  */
 void
-execute_ipa_pass_list (struct opt_pass *pass)
+execute_ipa_pass_list (opt_pass *pass)
 {
   do
     {
@@ -2614,8 +2613,8 @@
 /* Execute stmt fixup hooks of all passes in PASS for NODE and STMTS.  */
 
 static void
-execute_ipa_stmt_fixups (struct opt_pass *pass,
-			  struct cgraph_node *node, gimple *stmts)
+execute_ipa_stmt_fixups (opt_pass *pass,
+			 struct cgraph_node *node, gimple *stmts)
 {
   while (pass)
     {
@@ -2623,7 +2622,7 @@
       if (pass->type == IPA_PASS
 	  && ((!pass->has_gate) || pass->gate ()))
 	{
-	  struct ipa_opt_pass_d *ipa_pass = (struct ipa_opt_pass_d *) pass;
+	  ipa_opt_pass_d *ipa_pass = (ipa_opt_pass_d *) pass;
 
 	  if (ipa_pass->stmt_fixup)
 	    {
Index: gcc/tree-pass.h
===================================================================
--- gcc/tree-pass.h	(revision 205573)
+++ gcc/tree-pass.h	(working copy)
@@ -106,10 +106,10 @@
 
 public:
   /* A list of sub-passes to run, dependent on gate predicate.  */
-  struct opt_pass *sub;
+  opt_pass *sub;
 
   /* Next in the list of passes to run, independent of gate predicate.  */
-  struct opt_pass *next;
+  opt_pass *next;
 
   /* Static pass number, used as a fragment of the dump file name.  */
   int static_pass_number;
@@ -321,7 +321,7 @@
 
 struct register_pass_info
 {
-  struct opt_pass *pass;            /* New pass to register.  */
+  opt_pass *pass;		    /* New pass to register.  */
   const char *reference_pass_name;  /* Name of the reference pass for hooking
                                        up the new pass.  */
   int ref_pass_instance_number;     /* Insert the pass at the specified
@@ -583,16 +583,16 @@
 extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt);
 
 /* Current optimization pass.  */
-extern struct opt_pass *current_pass;
+extern opt_pass *current_pass;
 
-extern bool execute_one_pass (struct opt_pass *);
-extern void execute_pass_list (struct opt_pass *);
-extern void execute_ipa_pass_list (struct opt_pass *);
-extern void execute_ipa_summary_passes (struct ipa_opt_pass_d *);
+extern bool execute_one_pass (opt_pass *);
+extern void execute_pass_list (opt_pass *);
+extern void execute_ipa_pass_list (opt_pass *);
+extern void execute_ipa_summary_passes (ipa_opt_pass_d *);
 extern void execute_all_ipa_transforms (void);
 extern void execute_all_ipa_stmt_fixups (struct cgraph_node *, gimple *);
-extern bool pass_init_dump_file (struct opt_pass *);
-extern void pass_fini_dump_file (struct opt_pass *);
+extern bool pass_init_dump_file (opt_pass *);
+extern void pass_fini_dump_file (opt_pass *);
 
 extern const char *get_current_pass_name (void);
 extern void print_current_pass (FILE *);
@@ -601,7 +601,7 @@
 extern void ipa_write_optimization_summaries (struct lto_symtab_encoder_d *);
 extern void ipa_read_summaries (void);
 extern void ipa_read_optimization_summaries (void);
-extern void register_one_dump_file (struct opt_pass *);
+extern void register_one_dump_file (opt_pass *);
 extern bool function_called_by_processed_nodes_p (void);
 
 /* Set to true if the pass is called the first time during compilation of the

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