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 varpool_node 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: * asan.c: Remove struct tags when referring to class varpool_node. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cp/decl2.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * gimple-fold.c: Likewise. * ipa-devirt.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-utils.c: Likewise. * ipa.c: Likewise. * lto/lto-partition.c: Likewise. * lto/lto-symtab.c: Likewise. * lto/lto.c: Likewise. * lto-cgraph.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * passes.c: Likewise. * toplev.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-pass.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-vectorizer.c: Likewise. * tree.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise.
Index: gcc/asan.c =================================================================== --- gcc/asan.c (revision 205573) +++ gcc/asan.c (working copy) @@ -1634,7 +1634,7 @@ { /* For static vars if they are known not to be dynamically initialized, they will be always accessible. */ - struct varpool_node *vnode = varpool_get_node (inner); + varpool_node *vnode = varpool_get_node (inner); if (vnode && !vnode->dynamically_initialized) return; } @@ -2214,7 +2214,7 @@ fold_convert (const_ptr_type_node, str_cst)); CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE, fold_convert (const_ptr_type_node, module_name_cst)); - struct varpool_node *vnode = varpool_get_node (decl); + varpool_node *vnode = varpool_get_node (decl); int has_dynamic_init = vnode ? vnode->dynamically_initialized : 0; CONSTRUCTOR_APPEND_ELT (vinner, NULL_TREE, build_int_cst (uptr, has_dynamic_init)); @@ -2380,7 +2380,7 @@ void asan_finish_file (void) { - struct varpool_node *vnode; + varpool_node *vnode; unsigned HOST_WIDE_INT gcount = 0; if (shadow_ptr_types[0] == NULL_TREE) Index: gcc/cgraph.h =================================================================== --- gcc/cgraph.h (revision 205573) +++ gcc/cgraph.h (working copy) @@ -483,7 +483,8 @@ vec<cgraph_node_ptr> nodes; }; -typedef struct varpool_node *varpool_node_ptr; +class varpool_node; +typedef varpool_node *varpool_node_ptr; /* A varpool node set is a collection of varpool nodes. A varpool node @@ -796,7 +797,7 @@ typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *); typedef void (*cgraph_node_hook)(struct cgraph_node *, void *); -typedef void (*varpool_node_hook)(struct varpool_node *, void *); +typedef void (*varpool_node_hook)(varpool_node *, void *); typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *, void *); typedef void (*cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *, @@ -910,50 +911,50 @@ varpool_node_set varpool_node_set_new (void); varpool_node_set_iterator varpool_node_set_find (varpool_node_set, - struct varpool_node *); -void varpool_node_set_add (varpool_node_set, struct varpool_node *); -void varpool_node_set_remove (varpool_node_set, struct varpool_node *); + varpool_node *); +void varpool_node_set_add (varpool_node_set, varpool_node *); +void varpool_node_set_remove (varpool_node_set, varpool_node *); void dump_varpool_node_set (FILE *, varpool_node_set); void debug_varpool_node_set (varpool_node_set); void free_varpool_node_set (varpool_node_set); void ipa_discover_readonly_nonaddressable_vars (void); -bool varpool_externally_visible_p (struct varpool_node *); +bool varpool_externally_visible_p (varpool_node *); /* In predict.c */ bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e); bool cgraph_optimize_for_size_p (struct cgraph_node *); /* In varpool.c */ -struct varpool_node *varpool_create_empty_node (void); -struct varpool_node *varpool_node_for_decl (tree); -struct varpool_node *varpool_node_for_asm (tree asmname); -void varpool_mark_needed_node (struct varpool_node *); +varpool_node *varpool_create_empty_node (void); +varpool_node *varpool_node_for_decl (tree); +varpool_node *varpool_node_for_asm (tree asmname); +void varpool_mark_needed_node (varpool_node *); void debug_varpool (void); void dump_varpool (FILE *); -void dump_varpool_node (FILE *, struct varpool_node *); +void dump_varpool_node (FILE *, varpool_node *); void varpool_finalize_decl (tree); -enum availability cgraph_variable_initializer_availability (struct varpool_node *); +enum availability cgraph_variable_initializer_availability (varpool_node *); void cgraph_make_node_local (struct cgraph_node *); bool cgraph_node_can_be_local_p (struct cgraph_node *); -void varpool_remove_node (struct varpool_node *node); -void varpool_finalize_named_section_flags (struct varpool_node *node); +void varpool_remove_node (varpool_node *node); +void varpool_finalize_named_section_flags (varpool_node *node); bool varpool_output_variables (void); -bool varpool_assemble_decl (struct varpool_node *node); -void varpool_analyze_node (struct varpool_node *); -struct varpool_node * varpool_extra_name_alias (tree, tree); -struct varpool_node * varpool_create_variable_alias (tree, tree); +bool varpool_assemble_decl (varpool_node *node); +void varpool_analyze_node (varpool_node *); +varpool_node * varpool_extra_name_alias (tree, tree); +varpool_node * varpool_create_variable_alias (tree, tree); void varpool_reset_queue (void); tree ctor_for_folding (tree); -bool varpool_for_node_and_aliases (struct varpool_node *, - bool (*) (struct varpool_node *, void *), +bool varpool_for_node_and_aliases (varpool_node *, + bool (*) (varpool_node *, void *), void *, bool); void varpool_add_new_variable (tree); void symtab_initialize_asm_name_hash (void); void symtab_prevail_in_asm_name_hash (symtab_node *node); -void varpool_remove_initializer (struct varpool_node *); +void varpool_remove_initializer (varpool_node *); /* In cgraph.c */ extern void change_decl_assembler_name (tree, tree); @@ -967,11 +968,11 @@ } /* Return varpool node for given symbol and check it is a variable. */ -static inline struct varpool_node * +static inline varpool_node * varpool (symtab_node *node) { gcc_checking_assert (!node || node->type == SYMTAB_VARIABLE); - return (struct varpool_node *)node; + return (varpool_node *)node; } /* Return callgraph node for given symbol and check it is a function. */ @@ -983,7 +984,7 @@ } /* Return varpool node for given symbol and check it is a function. */ -static inline struct varpool_node * +static inline varpool_node * varpool_get_node (const_tree decl) { gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); @@ -996,7 +997,7 @@ /* Return first variable. */ -static inline struct varpool_node * +static inline varpool_node * varpool_first_variable (void) { symtab_node *node; @@ -1007,8 +1008,8 @@ } /* Return next variable after NODE. */ -static inline struct varpool_node * -varpool_next_variable (struct varpool_node *node) +static inline varpool_node * +varpool_next_variable (varpool_node *node) { symtab_node *node1 = node->next; for (; node1; node1 = node1->next) @@ -1023,7 +1024,7 @@ (node) = varpool_next_variable ((node))) /* Return first reachable static variable with initializer. */ -static inline struct varpool_node * +static inline varpool_node * varpool_first_static_initializer (void) { symtab_node *node; @@ -1037,8 +1038,8 @@ } /* Return next reachable static variable with initializer after NODE. */ -static inline struct varpool_node * -varpool_next_static_initializer (struct varpool_node *node) +static inline varpool_node * +varpool_next_static_initializer (varpool_node *node) { symtab_node *node1 = node->next; for (; node1; node1 = node1->next) @@ -1056,7 +1057,7 @@ (node) = varpool_next_static_initializer (node)) /* Return first reachable static variable with initializer. */ -static inline struct varpool_node * +static inline varpool_node * varpool_first_defined_variable (void) { symtab_node *node; @@ -1070,8 +1071,8 @@ } /* Return next reachable static variable with initializer after NODE. */ -static inline struct varpool_node * -varpool_next_defined_variable (struct varpool_node *node) +static inline varpool_node * +varpool_next_defined_variable (varpool_node *node) { symtab_node *node1 = node->next; for (; node1; node1 = node1->next) @@ -1257,7 +1258,7 @@ } /* Return the node pointed to by VSI. */ -static inline struct varpool_node * +static inline varpool_node * vsi_node (varpool_node_set_iterator vsi) { return vsi.set->nodes[vsi.index]; @@ -1276,7 +1277,7 @@ /* Return true if SET contains NODE. */ static inline bool -varpool_node_in_set_p (struct varpool_node *node, varpool_node_set set) +varpool_node_in_set_p (varpool_node *node, varpool_node_set set) { varpool_node_set_iterator vsi; vsi = varpool_node_set_find (set, node); @@ -1341,7 +1342,7 @@ if all direct calls are eliminated. */ static inline bool -varpool_can_remove_if_no_refs (struct varpool_node *node) +varpool_can_remove_if_no_refs (varpool_node *node) { if (DECL_EXTERNAL (node->decl)) return true; @@ -1359,7 +1360,7 @@ The magic uses are all summarized in force_output flag. */ static inline bool -varpool_all_refs_explicit_p (struct varpool_node *vnode) +varpool_all_refs_explicit_p (varpool_node *vnode) { return (vnode->definition && !vnode->externally_visible @@ -1390,8 +1391,8 @@ return dyn_cast <cgraph_node> (symtab_alias_target (n)); } -static inline struct varpool_node * -varpool_alias_target (struct varpool_node *n) +static inline varpool_node * +varpool_alias_target (varpool_node *n) { return dyn_cast <varpool_node> (symtab_alias_target (n)); } @@ -1416,11 +1417,11 @@ Do not walk through thunks. When AVAILABILITY is non-NULL, get minimal availability in the chain. */ -static inline struct varpool_node * -varpool_variable_node (struct varpool_node *node, +static inline varpool_node * +varpool_variable_node (varpool_node *node, enum availability *availability = NULL) { - struct varpool_node *n; + varpool_node *n; n = dyn_cast <varpool_node> (symtab_alias_ultimate_target (node, availability)); Index: gcc/cgraphbuild.c =================================================================== --- gcc/cgraphbuild.c (revision 205573) +++ gcc/cgraphbuild.c (working copy) @@ -44,7 +44,7 @@ struct record_reference_ctx { bool only_vars; - struct varpool_node *varpool_node; + class varpool_node *varpool_node; }; /* Walk tree and record all calls and references to functions/variables. @@ -89,7 +89,7 @@ if (TREE_CODE (decl) == VAR_DECL) { - struct varpool_node *vnode = varpool_node_for_decl (decl); + varpool_node *vnode = varpool_node_for_decl (decl); ipa_record_reference (ctx->varpool_node, vnode, IPA_REF_ADDR, NULL); @@ -128,7 +128,7 @@ type = TREE_OPERAND (type, 0); if (TREE_CODE (type) == VAR_DECL) { - struct varpool_node *vnode = varpool_node_for_decl (type); + varpool_node *vnode = varpool_node_for_decl (type); ipa_record_reference (node, vnode, IPA_REF_ADDR, NULL); @@ -238,7 +238,7 @@ else if (addr && TREE_CODE (addr) == VAR_DECL && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) { - struct varpool_node *vnode = varpool_node_for_decl (addr); + varpool_node *vnode = varpool_node_for_decl (addr); ipa_record_reference ((symtab_node *)data, vnode, @@ -267,7 +267,7 @@ else if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { - struct varpool_node *vnode = varpool_node_for_decl (t); + varpool_node *vnode = varpool_node_for_decl (t); ipa_record_reference ((symtab_node *)data, vnode, @@ -285,7 +285,7 @@ if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { - struct varpool_node *vnode = varpool_node_for_decl (t); + varpool_node *vnode = varpool_node_for_decl (t); ipa_record_reference ((symtab_node *)data, vnode, @@ -426,7 +426,7 @@ record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - struct varpool_node *node = varpool_node_for_decl (decl); + varpool_node *node = varpool_node_for_decl (decl); struct record_reference_ctx ctx = {false, NULL}; ctx.varpool_node = node; Index: gcc/cgraphunit.c =================================================================== --- gcc/cgraphunit.c (revision 205573) +++ gcc/cgraphunit.c (working copy) @@ -737,10 +737,10 @@ static void process_function_and_variable_attributes (struct cgraph_node *first, - struct varpool_node *first_var) + varpool_node *first_var) { struct cgraph_node *node; - struct varpool_node *vnode; + varpool_node *vnode; for (node = cgraph_first_function (); node != first; node = cgraph_next_function (node)) @@ -813,7 +813,7 @@ void varpool_finalize_decl (tree decl) { - struct varpool_node *node = varpool_node_for_decl (decl); + varpool_node *node = varpool_node_for_decl (decl); gcc_assert (TREE_STATIC (decl) || DECL_EXTERNAL (decl)); @@ -928,8 +928,8 @@ intermodule optimization. */ static struct cgraph_node *first_analyzed; struct cgraph_node *first_handled = first_analyzed; - static struct varpool_node *first_analyzed_var; - struct varpool_node *first_handled_var = first_analyzed_var; + static varpool_node *first_analyzed_var; + varpool_node *first_handled_var = first_analyzed_var; struct pointer_set_t *reachable_call_targets = pointer_set_create (); symtab_node *node; @@ -1891,7 +1891,7 @@ union { struct cgraph_node *f; - struct varpool_node *v; + varpool_node *v; struct asm_node *a; } u; }; @@ -1909,7 +1909,7 @@ struct cgraph_order_sort *nodes; int i; struct cgraph_node *pf; - struct varpool_node *pv; + varpool_node *pv; struct asm_node *pa; max = symtab_order; Index: gcc/cp/decl2.c =================================================================== --- gcc/cp/decl2.c (revision 205573) +++ gcc/cp/decl2.c (working copy) @@ -1749,7 +1749,7 @@ if (VAR_P (decl)) { - struct varpool_node *node = varpool_node_for_decl (decl); + varpool_node *node = varpool_node_for_decl (decl); DECL_COMDAT (decl) = 1; /* Mark it needed so we don't forget to emit it. */ node->forced_by_abi = true; @@ -1871,7 +1871,7 @@ } else if (TREE_CODE (decl) == VAR_DECL) { - struct varpool_node *node = varpool_node_for_decl (decl); + varpool_node *node = varpool_node_for_decl (decl); /* C++ frontend use mark_decl_references to force COMDAT variables to be output that might appear dead otherwise. */ node->forced_by_abi = true; @@ -1920,7 +1920,7 @@ tree vtbl; tree primary_vtbl; int needed = 0; - struct varpool_node *current = NULL, *last = NULL; + varpool_node *current = NULL, *last = NULL; /* If the vtables for this class have already been emitted there is nothing more to do. */ @@ -3466,7 +3466,7 @@ finish_expr_stmt (init); if (flag_sanitize & SANITIZE_ADDRESS) { - struct varpool_node *vnode = varpool_get_node (decl); + varpool_node *vnode = varpool_get_node (decl); if (vnode) vnode->dynamically_initialized = 1; } Index: gcc/dbxout.c =================================================================== --- gcc/dbxout.c (revision 205573) +++ gcc/dbxout.c (working copy) @@ -2481,7 +2481,7 @@ /* If this is a var that might not be actually output, return NULL, otherwise stabs might reference an undefined symbol. */ - struct varpool_node *node = varpool_get_node (expr); + varpool_node *node = varpool_get_node (expr); if (!node || !node->definition) return NULL; } Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 205573) +++ gcc/dwarf2out.c (working copy) @@ -15147,7 +15147,7 @@ return *tp; else if (TREE_CODE (*tp) == VAR_DECL) { - struct varpool_node *node = varpool_get_node (*tp); + varpool_node *node = varpool_get_node (*tp); if (!node || !node->definition) return *tp; } @@ -17827,7 +17827,7 @@ { /* Ask cgraph if the global variable really is to be emitted. If yes, then we'll keep the DIE of ENTRY->TYPE. */ - struct varpool_node *node = varpool_get_node (entry->var_decl); + varpool_node *node = varpool_get_node (entry->var_decl); if (node && node->definition) { die->die_perennial_p = 1; Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 205573) +++ gcc/gimple-fold.c (working copy) @@ -77,7 +77,7 @@ static bool can_refer_decl_in_current_unit_p (tree decl, tree from_decl) { - struct varpool_node *vnode; + varpool_node *vnode; struct cgraph_node *node; symtab_node *snode; Index: gcc/ipa-devirt.c =================================================================== --- gcc/ipa-devirt.c (revision 205573) +++ gcc/ipa-devirt.c (working copy) @@ -653,7 +653,7 @@ if (!flag_ltrans && anonymous) { tree vtable = BINFO_VTABLE (inner_binfo); - struct varpool_node *vnode; + varpool_node *vnode; if (TREE_CODE (vtable) == POINTER_PLUS_EXPR) vtable = TREE_OPERAND (TREE_OPERAND (vtable, 0), 0); @@ -1144,7 +1144,7 @@ /* When virtual table is removed, we may need to flush the cache. */ static void -devirt_variable_node_removal_hook (struct varpool_node *n, +devirt_variable_node_removal_hook (varpool_node *n, void *d ATTRIBUTE_UNUSED) { if (cached_polymorphic_call_targets Index: gcc/ipa-ref-inline.h =================================================================== --- gcc/ipa-ref-inline.h (revision 205573) +++ gcc/ipa-ref-inline.h (working copy) @@ -27,7 +27,7 @@ /* Return varpool node REF is referring. */ -static inline struct varpool_node * +static inline varpool_node * ipa_ref_varpool_node (struct ipa_ref *ref) { return varpool (ref->referred); @@ -43,7 +43,7 @@ /* Return varpool node REF is in. */ -static inline struct varpool_node * +static inline varpool_node * ipa_ref_referring_varpool_node (struct ipa_ref *ref) { return varpool (ref->referring); Index: gcc/ipa-ref.h =================================================================== --- gcc/ipa-ref.h (revision 205573) +++ gcc/ipa-ref.h (working copy) @@ -19,7 +19,7 @@ <http://www.gnu.org/licenses/>. */ struct cgraph_node; -struct varpool_node; +class varpool_node; class symtab_node; Index: gcc/ipa-reference.c =================================================================== --- gcc/ipa-reference.c (revision 205573) +++ gcc/ipa-reference.c (working copy) @@ -667,7 +667,7 @@ propagate (void) { struct cgraph_node *node; - struct varpool_node *vnode; + varpool_node *vnode; struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); int order_pos; Index: gcc/ipa-utils.c =================================================================== --- gcc/ipa-utils.c (revision 205573) +++ gcc/ipa-utils.c (working copy) @@ -527,7 +527,7 @@ /* Add varpool_node NODE to varpool_node_set SET. */ void -varpool_node_set_add (varpool_node_set set, struct varpool_node *node) +varpool_node_set_add (varpool_node_set set, varpool_node *node) { void **slot; @@ -551,11 +551,11 @@ /* Remove varpool_node NODE from varpool_node_set SET. */ void -varpool_node_set_remove (varpool_node_set set, struct varpool_node *node) +varpool_node_set_remove (varpool_node_set set, varpool_node *node) { void **slot, **last_slot; int index; - struct varpool_node *last_node; + varpool_node *last_node; slot = pointer_map_contains (set->map, node); if (slot == NULL || !*slot) @@ -587,7 +587,7 @@ is returned if NODE is not in SET. */ varpool_node_set_iterator -varpool_node_set_find (varpool_node_set set, struct varpool_node *node) +varpool_node_set_find (varpool_node_set set, varpool_node *node) { void **slot; varpool_node_set_iterator vsi; @@ -612,7 +612,7 @@ for (iter = vsi_start (set); !vsi_end_p (iter); vsi_next (&iter)) { - struct varpool_node *node = vsi_node (iter); + varpool_node *node = vsi_node (iter); fprintf (f, " %s", node->name ()); } fprintf (f, "\n"); Index: gcc/ipa.c =================================================================== --- gcc/ipa.c (revision 205573) +++ gcc/ipa.c (working copy) @@ -291,7 +291,7 @@ { symtab_node *first = (symtab_node *) (void *) 1; struct cgraph_node *node, *next; - struct varpool_node *vnode, *vnext; + varpool_node *vnode, *vnext; bool changed = false; struct pointer_set_t *reachable = pointer_set_create (); struct pointer_set_t *body_needed_for_clonning = pointer_set_create (); @@ -606,7 +606,7 @@ void ipa_discover_readonly_nonaddressable_vars (void) { - struct varpool_node *vnode; + varpool_node *vnode; if (dump_file) fprintf (dump_file, "Clearing variable flags:"); FOR_EACH_VARIABLE (vnode) @@ -663,7 +663,7 @@ i, ref); i++) if (ref->use == IPA_REF_ADDR) { - struct varpool_node *node; + varpool_node *node; if (is_a <cgraph_node> (ref->referring)) return true; node = ipa_ref_referring_varpool_node (ref); @@ -801,7 +801,7 @@ /* Return true when variable VNODE should be considered externally visible. */ bool -varpool_externally_visible_p (struct varpool_node *vnode) +varpool_externally_visible_p (varpool_node *vnode) { if (DECL_EXTERNAL (vnode->decl)) return true; @@ -895,7 +895,7 @@ function_and_variable_visibility (bool whole_program) { struct cgraph_node *node; - struct varpool_node *vnode; + varpool_node *vnode; /* All aliases should be procssed at this point. */ gcc_checking_assert (!alias_pairs || !alias_pairs->length ()); Index: gcc/lto/lto-partition.c =================================================================== --- gcc/lto/lto-partition.c (revision 205573) +++ gcc/lto/lto-partition.c (working copy) @@ -408,8 +408,8 @@ static int varpool_node_cmp (const void *pa, const void *pb) { - const struct varpool_node *a = *(const struct varpool_node * const *) pa; - const struct varpool_node *b = *(const struct varpool_node * const *) pb; + const varpool_node *a = *(const varpool_node * const *) pa; + const varpool_node *b = *(const varpool_node * const *) pb; return b->order - a->order; } @@ -457,14 +457,14 @@ int n_nodes = 0; int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0; struct cgraph_node **order = XNEWVEC (struct cgraph_node *, cgraph_max_uid); - struct varpool_node **varpool_order = NULL; + varpool_node **varpool_order = NULL; int i; struct cgraph_node *node; int total_size = 0, best_total_size = 0; int partition_size; ltrans_partition partition; int last_visited_node = 0; - struct varpool_node *vnode; + varpool_node *vnode; int cost = 0, internal = 0; int best_n_nodes = 0, best_i = 0, best_cost = INT_MAX, best_internal = 0; @@ -494,13 +494,13 @@ FOR_EACH_VARIABLE (vnode) if (get_symbol_class (vnode) == SYMBOL_PARTITION) n_varpool_nodes++; - varpool_order = XNEWVEC (struct varpool_node *, n_varpool_nodes); + varpool_order = XNEWVEC (varpool_node *, n_varpool_nodes); n_varpool_nodes = 0; FOR_EACH_VARIABLE (vnode) if (get_symbol_class (vnode) == SYMBOL_PARTITION) varpool_order[n_varpool_nodes++] = vnode; - qsort (varpool_order, n_varpool_nodes, sizeof (struct varpool_node *), + qsort (varpool_order, n_varpool_nodes, sizeof (varpool_node *), varpool_node_cmp); } Index: gcc/lto/lto-symtab.c =================================================================== --- gcc/lto/lto-symtab.c (revision 205573) +++ gcc/lto/lto-symtab.c (working copy) @@ -103,8 +103,8 @@ all edges and removing the old node. */ static void -lto_varpool_replace_node (struct varpool_node *vnode, - struct varpool_node *prevailing_node) +lto_varpool_replace_node (varpool_node *vnode, + varpool_node *prevailing_node) { gcc_assert (!vnode->definition || prevailing_node->definition); gcc_assert (!vnode->analyzed || prevailing_node->analyzed); Index: gcc/lto/lto.c =================================================================== --- gcc/lto/lto.c (revision 205573) +++ gcc/lto/lto.c (working copy) @@ -3314,7 +3314,7 @@ do_whole_program_analysis (); else { - struct varpool_node *vnode; + varpool_node *vnode; timevar_start (TV_PHASE_OPT_GEN); Index: gcc/lto-cgraph.c =================================================================== --- gcc/lto-cgraph.c (revision 205573) +++ gcc/lto-cgraph.c (working copy) @@ -204,7 +204,7 @@ bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t encoder, - struct varpool_node *node) + varpool_node *node) { int index = lto_symtab_encoder_lookup (encoder, node); if (index == LCC_NOT_FOUND) @@ -216,7 +216,7 @@ static void lto_set_symtab_encoder_encode_initializer (lto_symtab_encoder_t encoder, - struct varpool_node *node) + varpool_node *node) { int index = lto_symtab_encoder_lookup (encoder, node); encoder->nodes[index].initializer = true; @@ -539,7 +539,7 @@ If NODE is not in SET, then NODE is a boundary. */ static void -lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node *node, +lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, lto_symtab_encoder_t encoder) { bool boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node); @@ -796,7 +796,7 @@ for (lsei = lsei_start_variable_in_partition (in_encoder); !lsei_end_p (lsei); lsei_next_variable_in_partition (&lsei)) { - struct varpool_node *vnode = lsei_varpool_node (lsei); + varpool_node *vnode = lsei_varpool_node (lsei); lto_set_symtab_encoder_in_partition (encoder, vnode); lto_set_symtab_encoder_encode_initializer (encoder, vnode); @@ -804,7 +804,7 @@ /* For proper debug info, we need to ship the origins, too. */ if (DECL_ABSTRACT_ORIGIN (vnode->decl)) { - struct varpool_node *origin_node + varpool_node *origin_node = varpool_get_node (DECL_ABSTRACT_ORIGIN (node->decl)); lto_set_symtab_encoder_in_partition (encoder, origin_node); } @@ -1113,13 +1113,13 @@ /* Read a node from input_block IB. TAG is the node's tag just read. Return the node read or overwriten. */ -static struct varpool_node * +static varpool_node * input_varpool_node (struct lto_file_decl_data *file_data, struct lto_input_block *ib) { int decl_index; tree var_decl; - struct varpool_node *node; + varpool_node *node; struct bitpack_d bp; int ref = LCC_NOT_FOUND; int order; Index: gcc/lto-streamer-out.c =================================================================== --- gcc/lto-streamer-out.c (revision 205573) +++ gcc/lto-streamer-out.c (working copy) @@ -322,7 +322,7 @@ && initial) { lto_symtab_encoder_t encoder; - struct varpool_node *vnode; + varpool_node *vnode; encoder = ob->decl_state->symtab_node_encoder; vnode = varpool_get_node (expr); Index: gcc/lto-streamer.h =================================================================== --- gcc/lto-streamer.h (revision 205573) +++ gcc/lto-streamer.h (working copy) @@ -885,7 +885,7 @@ symtab_node *); bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t, - struct varpool_node *); + varpool_node *); void output_symtab (void); void input_symtab (void); bool referenced_from_other_partition_p (struct ipa_ref_list *, @@ -1080,7 +1080,7 @@ } /* Return the node pointed to by LSI. */ -static inline struct varpool_node * +static inline varpool_node * lsei_varpool_node (lto_symtab_encoder_iterator lsei) { return varpool (lsei.encoder->nodes[lsei.index].node); Index: gcc/passes.c =================================================================== --- gcc/passes.c (revision 205573) +++ gcc/passes.c (working copy) @@ -2353,7 +2353,7 @@ { lto_symtab_encoder_t encoder; int i, order_pos; - struct varpool_node *vnode; + varpool_node *vnode; struct cgraph_node *node; struct cgraph_node **order; Index: gcc/toplev.c =================================================================== --- gcc/toplev.c (revision 205573) +++ gcc/toplev.c (working copy) @@ -390,7 +390,7 @@ if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) { - struct varpool_node *node; + varpool_node *node; bool needed = true; node = varpool_get_node (decl); Index: gcc/tree-eh.c =================================================================== --- gcc/tree-eh.c (revision 205573) +++ gcc/tree-eh.c (working copy) @@ -2685,7 +2685,7 @@ LTO partition. */ if (DECL_WEAK (expr) && !DECL_COMDAT (expr)) { - struct varpool_node *node; + varpool_node *node; if (!DECL_EXTERNAL (expr)) return false; node = varpool_variable_node (varpool_get_node (expr), NULL); Index: gcc/tree-emutls.c =================================================================== --- gcc/tree-emutls.c (revision 205573) +++ gcc/tree-emutls.c (working copy) @@ -373,7 +373,7 @@ static tree emutls_decl (tree decl) { - struct varpool_node *var; + varpool_node *var; unsigned int i; i = emutls_index (decl); @@ -435,7 +435,7 @@ addr = access_vars[index]; if (addr == NULL) { - struct varpool_node *cvar; + varpool_node *cvar; tree cdecl; gimple x; @@ -707,10 +707,10 @@ Callback for varpool_for_variable_and_aliases. */ static bool -create_emultls_var (struct varpool_node *var, void *data) +create_emultls_var (varpool_node *var, void *data) { tree cdecl; - struct varpool_node *cvar; + varpool_node *cvar; cdecl = new_emutls_decl (var->decl, var->alias && var->analyzed @@ -743,7 +743,7 @@ static unsigned int ipa_lower_emutls (void) { - struct varpool_node *var; + varpool_node *var; struct cgraph_node *func; bool any_aliases = false; tree ctor_body = NULL; Index: gcc/tree-pass.h =================================================================== --- gcc/tree-pass.h (revision 205573) +++ gcc/tree-pass.h (working copy) @@ -138,7 +138,7 @@ } }; -struct varpool_node; +class varpool_node; struct cgraph_node; struct lto_symtab_encoder_d; @@ -171,7 +171,7 @@ function body via this hook. */ unsigned int function_transform_todo_flags_start; unsigned int (*function_transform) (struct cgraph_node *); - void (*variable_transform) (struct varpool_node *); + void (*variable_transform) (varpool_node *); protected: ipa_opt_pass_d (const pass_data& data, gcc::context *ctxt, @@ -183,7 +183,7 @@ void (*stmt_fixup) (struct cgraph_node *, gimple *), unsigned int function_transform_todo_flags_start, unsigned int (*function_transform) (struct cgraph_node *), - void (*variable_transform) (struct varpool_node *)) + void (*variable_transform) (varpool_node *)) : opt_pass (data, ctxt), generate_summary (generate_summary), write_summary (write_summary), Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 205573) +++ gcc/tree-ssa-structalias.c (working copy) @@ -2900,7 +2900,7 @@ if (TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { - struct varpool_node *node = varpool_get_node (t); + varpool_node *node = varpool_get_node (t); if (node && node->alias && node->analyzed) { node = varpool_variable_node (node, NULL); @@ -5733,7 +5733,7 @@ for it. */ else { - struct varpool_node *vnode = varpool_get_node (decl); + varpool_node *vnode = varpool_get_node (decl); /* For escaped variables initialize them from nonlocal. */ if (!varpool_all_refs_explicit_p (vnode)) @@ -7066,7 +7066,7 @@ ipa_pta_execute (void) { struct cgraph_node *node; - struct varpool_node *var; + varpool_node *var; int from; in_ipa_mode = 1; Index: gcc/tree-vectorizer.c =================================================================== --- gcc/tree-vectorizer.c (revision 205573) +++ gcc/tree-vectorizer.c (working copy) @@ -551,7 +551,7 @@ static unsigned int increase_alignment (void) { - struct varpool_node *vnode; + varpool_node *vnode; vect_location = UNKNOWN_LOCATION; Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 205573) +++ gcc/tree.c (working copy) @@ -5474,7 +5474,7 @@ NAMESPACE_DECLs, etc). */ static void -find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) +find_decls_types_in_var (varpool_node *v, struct free_lang_data_d *fld) { find_decls_types (v->decl, fld); } @@ -5528,7 +5528,7 @@ free_lang_data_in_cgraph (void) { struct cgraph_node *n; - struct varpool_node *v; + varpool_node *v; struct free_lang_data_d fld; tree t; unsigned i; Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 205573) +++ gcc/varasm.c (working copy) @@ -2366,7 +2366,7 @@ } else if (TREE_CODE (decl) == VAR_DECL) { - struct varpool_node *node = varpool_node_for_decl (decl); + varpool_node *node = varpool_node_for_decl (decl); /* C++ frontend use mark_decl_references to force COMDAT variables to be output that might appear dead otherwise. */ node->force_output = true; @@ -6727,7 +6727,7 @@ if (TREE_CODE (exp) == VAR_DECL && TREE_PUBLIC (exp) && (TREE_STATIC (exp) || DECL_EXTERNAL (exp))) { - struct varpool_node *vnode = varpool_get_node (exp); + varpool_node *vnode = varpool_get_node (exp); if (vnode && resolution_local_p (vnode->resolution)) resolved_locally = true; if (vnode @@ -6820,7 +6820,7 @@ if (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) { - struct varpool_node *vnode = varpool_get_node (decl); + varpool_node *vnode = varpool_get_node (decl); if (vnode && vnode->resolution != LDPR_UNKNOWN) return resolution_to_local_definition_p (vnode->resolution); Index: gcc/varpool.c =================================================================== --- gcc/varpool.c (revision 205573) +++ gcc/varpool.c (working copy) @@ -78,7 +78,7 @@ /* Call all node removal hooks. */ static void -varpool_call_node_removal_hooks (struct varpool_node *node) +varpool_call_node_removal_hooks (varpool_node *node) { struct varpool_node_hook_list *entry = first_varpool_node_removal_hook; while (entry) @@ -119,7 +119,7 @@ /* Call all node insertion hooks. */ void -varpool_call_variable_insertion_hooks (struct varpool_node *node) +varpool_call_variable_insertion_hooks (varpool_node *node) { struct varpool_node_hook_list *entry = first_varpool_variable_insertion_hook; while (entry) @@ -131,19 +131,19 @@ /* Allocate new callgraph node and insert it into basic data structures. */ -struct varpool_node * +varpool_node * varpool_create_empty_node (void) { - struct varpool_node *node = ggc_alloc_cleared_varpool_node (); + varpool_node *node = ggc_alloc_cleared_varpool_node (); node->type = SYMTAB_VARIABLE; return node; } /* Return varpool node assigned to DECL. Create new one when needed. */ -struct varpool_node * +varpool_node * varpool_node_for_decl (tree decl) { - struct varpool_node *node = varpool_get_node (decl); + varpool_node *node = varpool_get_node (decl); gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); if (node) return node; @@ -156,7 +156,7 @@ /* Remove node from the varpool. */ void -varpool_remove_node (struct varpool_node *node) +varpool_remove_node (varpool_node *node) { tree init; varpool_call_node_removal_hooks (node); @@ -174,7 +174,7 @@ /* Renove node initializer when it is no longer needed. */ void -varpool_remove_initializer (struct varpool_node *node) +varpool_remove_initializer (varpool_node *node) { if (DECL_INITIAL (node->decl) && !DECL_IN_CONSTANT_POOL (node->decl) @@ -192,7 +192,7 @@ /* Dump given cgraph node. */ void -dump_varpool_node (FILE *f, struct varpool_node *node) +dump_varpool_node (FILE *f, varpool_node *node) { dump_symtab_base (f, node); fprintf (f, " Availability: %s\n", @@ -215,7 +215,7 @@ void dump_varpool (FILE *f) { - struct varpool_node *node; + varpool_node *node; fprintf (f, "variable pool:\n\n"); FOR_EACH_VARIABLE (node) @@ -231,7 +231,7 @@ } /* Given an assembler name, lookup node. */ -struct varpool_node * +varpool_node * varpool_node_for_asm (tree asmname) { if (symtab_node *node = symtab_node_for_asm (asmname)) @@ -247,7 +247,7 @@ tree ctor_for_folding (tree decl) { - struct varpool_node *node, *real_node; + varpool_node *node, *real_node; tree real_decl; if (TREE_CODE (decl) != VAR_DECL @@ -337,7 +337,7 @@ void varpool_add_new_variable (tree decl) { - struct varpool_node *node; + varpool_node *node; varpool_finalize_decl (decl); node = varpool_node_for_decl (decl); varpool_call_variable_insertion_hooks (node); @@ -348,7 +348,7 @@ /* Return variable availability. See cgraph.h for description of individual return values. */ enum availability -cgraph_variable_initializer_availability (struct varpool_node *node) +cgraph_variable_initializer_availability (varpool_node *node) { gcc_assert (cgraph_function_flags_ready); if (!node->definition) @@ -376,7 +376,7 @@ } void -varpool_analyze_node (struct varpool_node *node) +varpool_analyze_node (varpool_node *node) { tree decl = node->decl; @@ -401,14 +401,14 @@ /* Assemble thunks and aliases associated to NODE. */ static void -assemble_aliases (struct varpool_node *node) +assemble_aliases (varpool_node *node) { int i; struct ipa_ref *ref; for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++) if (ref->use == IPA_REF_ALIAS) { - struct varpool_node *alias = ipa_ref_referring_varpool_node (ref); + varpool_node *alias = ipa_ref_referring_varpool_node (ref); do_assemble_alias (alias->decl, DECL_ASSEMBLER_NAME (node->decl)); assemble_aliases (alias); @@ -418,7 +418,7 @@ /* Output one variable, if necessary. Return whether we output it. */ bool -varpool_assemble_decl (struct varpool_node *node) +varpool_assemble_decl (varpool_node *node) { tree decl = node->decl; @@ -465,7 +465,7 @@ The queue is linked via AUX pointers and terminated by pointer to 1. */ static void -enqueue_node (struct varpool_node *node, struct varpool_node **first) +enqueue_node (varpool_node *node, varpool_node **first) { if (node->aux) return; @@ -482,8 +482,8 @@ static void varpool_remove_unreferenced_decls (void) { - struct varpool_node *next, *node; - struct varpool_node *first = (struct varpool_node *)(void *)1; + varpool_node *next, *node; + varpool_node *first = (varpool_node *)(void *)1; int i; struct ipa_ref *ref; @@ -505,10 +505,10 @@ fprintf (cgraph_dump_file, " %s", node->asm_name ()); } } - while (first != (struct varpool_node *)(void *)1) + while (first != (varpool_node *)(void *)1) { node = first; - first = (struct varpool_node *)first->aux; + first = (varpool_node *)first->aux; if (node->same_comdat_group) { @@ -553,7 +553,7 @@ conflicts between read-only and read-only requiring relocations sections can be resolved. */ void -varpool_finalize_named_section_flags (struct varpool_node *node) +varpool_finalize_named_section_flags (varpool_node *node) { if (!TREE_ASM_WRITTEN (node->decl) && !node->alias @@ -570,7 +570,7 @@ varpool_output_variables (void) { bool changed = false; - struct varpool_node *node; + varpool_node *node; if (seen_error ()) return false; @@ -594,7 +594,7 @@ add_new_static_var (tree type) { tree new_decl; - struct varpool_node *new_node; + varpool_node *new_node; new_decl = create_tmp_var_raw (type, NULL); DECL_NAME (new_decl) = create_tmp_var_name (NULL); @@ -613,10 +613,10 @@ /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful. Extra name aliases are output whenever DECL is output. */ -struct varpool_node * +varpool_node * varpool_create_variable_alias (tree alias, tree decl) { - struct varpool_node *alias_node; + varpool_node *alias_node; gcc_assert (TREE_CODE (decl) == VAR_DECL); gcc_assert (TREE_CODE (alias) == VAR_DECL); @@ -632,10 +632,10 @@ /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful. Extra name aliases are output whenever DECL is output. */ -struct varpool_node * +varpool_node * varpool_extra_name_alias (tree alias, tree decl) { - struct varpool_node *alias_node; + varpool_node *alias_node; #ifndef ASM_OUTPUT_DEF /* If aliases aren't supported by the assembler, fail. */ @@ -659,8 +659,8 @@ skipped. */ bool -varpool_for_node_and_aliases (struct varpool_node *node, - bool (*callback) (struct varpool_node *, void *), +varpool_for_node_and_aliases (varpool_node *node, + bool (*callback) (varpool_node *, void *), void *data, bool include_overwritable) { @@ -672,7 +672,7 @@ for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++) if (ref->use == IPA_REF_ALIAS) { - struct varpool_node *alias = ipa_ref_referring_varpool_node (ref); + varpool_node *alias = ipa_ref_referring_varpool_node (ref); if (include_overwritable || cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE) if (varpool_for_node_and_aliases (alias, callback, data,