Here a little progress but maybe it s better doing this in small
"batches" rather than fixing everything in one shot ?
Kind regards.
Fixing few build warnings with clang/clang++ of this type:
../.././gcc/coretypes.h:76:1: warning: class 'rtx_def' was previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
or
../.././gcc/machmode.h:320:1: warning: 'pod_mode' defined as a struct template here but previously declared as a class template; this is valid, but may result in linker errors under the
Microsoft C++ ABI [-Wmismatched-tags]
The struct/class mismatch is mostly harmless, might be for Microsoft toolchain as mentioned above, but in general for correctness.
Index: gcc/ChangeLog
Index: gcc/cgraph.h
===================================================================
--- gcc/cgraph.h (revision 271734)
+++ gcc/cgraph.h (working copy)
@@ -100,11 +100,10 @@ enum symbol_partitioning_class
/* Base of all entries in the symbol table.
The symtab_node is inherited by cgraph and varpol nodes. */
-class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"),
+struct GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"),
chain_next ("%h.next"), chain_prev ("%h.previous")))
symtab_node
{
-public:
friend class symbol_table;
/* Return name. */
@@ -598,7 +597,6 @@ public:
/* Section name. Again can be private, if allowed. */
section_hash_entry *x_section;
-protected:
/* Dump base fields of symtab nodes to F. Not to be used directly. */
void dump_base (FILE *);
@@ -618,7 +616,6 @@ protected:
bool call_for_symbol_and_aliases_1 (bool (*callback) (symtab_node *, void *),
void *data,
bool include_overwrite);
-private:
/* Worker for set_section. */
static bool set_section (symtab_node *n, void *s);
@@ -1505,7 +1502,7 @@ struct cgraph_node_set_def
typedef cgraph_node_set_def *cgraph_node_set;
typedef struct varpool_node_set_def *varpool_node_set;
-class varpool_node;
+struct varpool_node;
/* A varpool node set is a collection of varpool nodes. A varpool node
can appear in multiple sets. */
@@ -1675,7 +1672,7 @@ struct GTY(()) cgraph_indirect_call_info
struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
for_user)) cgraph_edge {
- friend class cgraph_node;
+ friend struct cgraph_node;
friend class symbol_table;
/* Remove the edge in the cgraph. */
@@ -1856,8 +1853,7 @@ private:
/* The varpool data structure.
Each static variable decl has assigned varpool_node. */
-class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node {
-public:
+struct GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node {
/* Dump given varpool node to F. */
void dump (FILE *f);
@@ -1975,7 +1971,6 @@ public:
if we did not do any inter-procedural code movement. */
unsigned used_by_single_function : 1;
-private:
/* Assemble thunks and aliases associated to varpool node. */
void assemble_aliases (void);
@@ -2074,9 +2069,9 @@ struct asmname_hasher : ggc_ptr_hash <sy
class GTY((tag ("SYMTAB"))) symbol_table
{
public:
- friend class symtab_node;
- friend class cgraph_node;
- friend class cgraph_edge;
+ friend struct symtab_node;
+ friend struct cgraph_node;
+ friend struct cgraph_edge;
symbol_table (): cgraph_max_uid (1), cgraph_max_summary_id (0),
edges_max_uid (1), edges_max_summary_id (0)
Index: gcc/coretypes.h
===================================================================
--- gcc/coretypes.h (revision 271734)
+++ gcc/coretypes.h (working copy)
@@ -65,7 +65,7 @@ template<typename> class opt_mode;
typedef opt_mode<scalar_mode> opt_scalar_mode;
typedef opt_mode<scalar_int_mode> opt_scalar_int_mode;
typedef opt_mode<scalar_float_mode> opt_scalar_float_mode;
-template<typename> class pod_mode;
+template<typename> struct pod_mode;
typedef pod_mode<scalar_mode> scalar_mode_pod;
typedef pod_mode<scalar_int_mode> scalar_int_mode_pod;
typedef pod_mode<fixed_size_mode> fixed_size_mode_pod;
@@ -73,7 +73,7 @@ typedef pod_mode<fixed_size_mode> fixed_
/* Subclasses of rtx_def, using indentation to show the class
hierarchy, along with the relevant invariant.
Where possible, keep this list in the same order as in rtl.def. */
-class rtx_def;
+struct rtx_def;
class rtx_expr_list; /* GET_CODE (X) == EXPR_LIST */
class rtx_insn_list; /* GET_CODE (X) == INSN_LIST */
class rtx_sequence; /* GET_CODE (X) == SEQUENCE */
@@ -138,9 +138,9 @@ struct gomp_teams;
/* Subclasses of symtab_node, using indentation to show the class
hierarchy. */
-class symtab_node;
+struct symtab_node;
struct cgraph_node;
- class varpool_node;
+ struct varpool_node;
union section;
typedef union section section;
Index: gcc/dumpfile.h
===================================================================
--- gcc/dumpfile.h (revision 271734)
+++ gcc/dumpfile.h (working copy)
@@ -647,7 +647,7 @@ extern void dump_combine_total_stats (FI
/* In cfghooks.c */
extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
-struct opt_pass;
+class opt_pass;
namespace gcc {
Index: gcc/hash-table.h
===================================================================
--- gcc/hash-table.h (revision 271734)
+++ gcc/hash-table.h (working copy)
@@ -347,7 +347,7 @@ hash_table_mod2 (hashval_t hash, unsigne
return 1 + mul_mod (hash, p->prime - 2, p->inv_m2, p->shift);
}
-class mem_usage;
+struct mem_usage;
/* User-facing hash table type.
Index: gcc/ipa-prop.h
===================================================================
--- gcc/ipa-prop.h (revision 271734)
+++ gcc/ipa-prop.h (working copy)
@@ -182,7 +182,7 @@ struct GTY (()) ipa_jump_func
/* Information about value range, containing valid data only when vr_known is
true. The pointed to structure is shared betweed different jump
functions. Use ipa_set_jfunc_vr to set this field. */
- struct value_range_base *m_vr;
+ class value_range_base *m_vr;
enum jump_func_type type;
/* Represents a value of a jump function. pass_through is used only in jump
@@ -589,7 +589,7 @@ class GTY((for_user)) ipa_edge_args
/* Return the number of actual arguments. */
static inline int
-ipa_get_cs_argument_count (struct ipa_edge_args *args)
+ipa_get_cs_argument_count (class ipa_edge_args *args)
{
return vec_safe_length (args->jump_functions);
}
Index: gcc/ipa-ref.h
===================================================================
--- gcc/ipa-ref.h (revision 271734)
+++ gcc/ipa-ref.h (working copy)
@@ -22,8 +22,8 @@ along with GCC; see the file COPYING3.
#define GCC_IPA_REF_H
struct cgraph_node;
-class varpool_node;
-class symtab_node;
+struct varpool_node;
+struct symtab_node;
/* How the reference is done. */
Index: gcc/lto-streamer.h
===================================================================
--- gcc/lto-streamer.h (revision 271734)
+++ gcc/lto-streamer.h (working copy)
@@ -360,9 +360,8 @@ private:
};
/* Structure used as buffer for reading an LTO file. */
-class lto_input_block
+struct lto_input_block
{
-public:
/* Special constructor for the string table, it abuses this to
do random access but use the uhwi decoder. */
lto_input_block (const char *data_, unsigned int p_, unsigned int len_,
Index: gcc/tree-pass.h
===================================================================
--- gcc/tree-pass.h (revision 271734)
+++ gcc/tree-pass.h (working copy)
@@ -132,7 +132,7 @@ protected:
}
};
-class varpool_node;
+struct varpool_node;
struct cgraph_node;
struct lto_symtab_encoder_d;